PageSourceSearch

https://melissaenderle.com/js/globalScripts.js?v=178dcae0e7

js melissaenderle.com collected 2026-09-26 01:33:05 UTC 107,206 bytes, 3,517 lines download raw bytes

1    // Common Scripts for All Pages
2
3    var timeoutopen    = 200;
4    var timeoutclose = 500;
5    var closetimer = 0;
6    var opentimer = 0;
7    var dropDownMenuItem = 0;
8    var dropDownMenuSourceItem = 0;
9    var flaguserenteringkeyword = 0;
10    menubaroverrideflag = 1;
11
12    var closetimersearchtypeoptionsheader = 0;
13    var globalFocusTrap;
14	
15	var autoPromptTimerId = -99;
16    var autoPromptTimestamp = new Date();
17    var autoPromptPreviousTimestamp = autoPromptTimestamp.getTime();
18	var autoPromptInputId = '';
19	var autoPromptContainerId = '';
20
21    var httpobject = [];
22    var requestcount = 0;
23
24    function newHttpReq()
25    {
26        var newRequest = null;
27
28        try
29        {
30            newRequest = new XMLHttpRequest();
31        }
32        catch(trymicrosoft)
33        {
34            try
35            {
36                newRequest = new ActiveXObject("Msxml2.XMLHTTP");
37            }
38            catch(othermicrosoft)
39            {
40                try
41                {
42                    newRequest = new ActiveXObject("Microsoft.XMLHTTP");
43                }
44                catch(failed)
45                {
46                    newRequest = null;
47                }
48            }
49        }
50
51        return newRequest;
52
53    }
54
55    function checksearchtagheader()
56    {
57        if(document.getElementById('searchtagheader'))
58        {
59            if(document.getElementById('searchtagheader').value == 'Search')
60            {
61                document.getElementById('searchtagheader').value = '';
62                document.getElementById('searchtagheader').style.color = '#000000';
63            }
64        }
65    }
66
67    function keyDownSearchTypeOptionsHeader(targetId, theEvent)
68    {
69        theEvent = theEvent || window.event;
70        if(theEvent.keyCode === 13)
71        {
72            showsearchtypeoptionsheader(targetId, 'keyDown');
73        }
74    }
75
76
77    function showsearchtypeoptionsheader(targetId,triggerMethod)
78    {
79        triggerMethod = triggerMethod || 'default';
80
81        cancelclosetimersearchtypeoptionsheader();
82
83        if(targetId)
84        {
85            if(document.getElementById(targetId))
86            {
87                document.getElementById(targetId).style.display = 'inline-block';
88
89                if(true || triggerMethod == 'keyDown')
90                {
91                    globalFocusTrap = focusTrap(document.getElementById(targetId),{onDeactivate: hidesearchtypeoptionsheader, clickOutsideDeactivates: true,});
92                    globalFocusTrap.activate();
93                }
94
95                return;
96            }
97        }
98
99        document.getElementById('searchtypeoptionsheaderdiv').style.display = 'inline-block';
100    }
101
102
103    function hidesearchtypeoptionstimeheader()
104    {
105        closetimersearchtypeoptionsheader = window.setTimeout(hidesearchtypeoptionsheader, 250);
106    }
107
108    function hidesearchtypeoptionsheader()
109    {
110        var elements = document.getElementsByClassName('searchTypeOptionsContainer');
111
112        for(var i = 0; i < elements.length; i ++)
113        {
114            elements[i].style.display = 'none';
115        }
116
117        if(document.getElementById('searchtypeoptionsheaderdiv'))
118        {
119            document.getElementById('searchtypeoptionsheaderdiv').style.display = 'none';
120        }
121        
122        if(document.getElementById('searchFormHeaderInput'))
123        {
124            if(typeof globalFocusTrap === 'object' && globalFocusTrap.isActive())
125            {
126                globalFocusTrap.stopCallBack();
127                globalFocusTrap.deactivate();
128            }            
129            
130            document.getElementById('searchFormHeaderInput').focus();
131        }
132        
133        if(document.getElementById('headerCustomSearchTag'))
134        {
135            if(typeof globalFocusTrap === 'object' && globalFocusTrap.isActive())
136            {
137                globalFocusTrap.stopCallBack();
138                globalFocusTrap.deactivate();
139            }            
140            
141            document.getElementById('headerCustomSearchTag').focus();
142        }        
143        
144    }
145
146    function cancelclosetimersearchtypeoptionsheader()
147    {
148        if(closetimersearchtypeoptionsheader)
149        {
150            window.clearTimeout(closetimersearchtypeoptionsheader);
151            closetimersearchtypeoptionsheader = null;
152        }
153    }
154
155    function toggleheaderoptions()
156    {
157        if(document.getElementById('headeroptionsdiv1').style.display != 'none')
158        {
159            document.getElementById('headeroptionsdiv1').style.display = 'none';
160            document.getElementById('headeroptionsdiv2').style.display = 'inline-block';
161        }
162        else
163        {
164            document.getElementById('headeroptionsdiv1').style.display = 'inline-block';
165            document.getElementById('headeroptionsdiv2').style.display = 'none';
166        }
167    }
168
169    function detectsaveddiv()
170    {
171        if(document.getElementById('saveddiv'))
172        {
173            fadecounter = 100;
174            setTimeout("fadeoutprogress()",2500);
175        }
176    }
177
178
179    function showheadercurrencydiv()
180    {
181        document.getElementById('currencydivselect').style.display = 'inline-block';
182        document.getElementById('currencydivlink').style.display = 'none';
183    }
184
185
186    function togglefootercurrency()
187    {
188        if(document.getElementById('currencylinkfooter').style.display == 'inline-block')
189        {
190            document.getElementById('currencylinkfooter').style.display = 'none';
191            document.getElementById('currencyselectfooter').style.display = 'inline-block';
192        }
193        else
194        {
195            document.getElementById('currencylinkfooter').style.display = 'inline-block';
196            document.getElementById('currencyselectfooter').style.display = 'none';
197        }
198    }
199
200
201    function togglefooterunits()
202    {
203        if(document.getElementById('unitslinkfooter').style.display == 'inline-block')
204        {
205            document.getElementById('unitslinkfooter').style.display = 'none';
206            document.getElementById('unitsselectfooter').style.display = 'inline-block';
207        }
208        else
209        {
210            document.getElementById('unitslinkfooter').style.display = 'inline-block';
211            document.getElementById('unitsselectfooter').style.display = 'none';
212        }
213    }
214
215
216    function fadeoutprogress()
217    {
218
219        var object = document.getElementById('saveddiv');
220
221        object.style.filter = "alpha(opacity = " + fadecounter*1 + ")";
222        object.style.opacity = fadecounter*0.01;
223
224        fadecounter -= 1;
225
226        if (fadecounter > 0)
227        {
228            t = setTimeout("fadeoutprogress()", 10);
229        }
230        else
231        {
232            object.parentNode.removeChild(object);
233        }
234    }
235
236
237    function clearmenubaroverrideflag()
238    {
239        menubaroverrideflag = 0;
240    }
241
242    function mtoggle(id)
243    {
244        // close old layer
245        if(dropDownMenuItem)
246        {
247            if(dropDownMenuItem.id != id)
248            {
249                dropDownMenuItem.style.visibility = 'hidden';
250            }
251        }
252
253        dropDownMenuItem = document.getElementById(id);
254        dropDownMenuItem.flagmobiledevice = 1;
255
256        if(dropDownMenuItem.style.visibility != 'visible')
257        {
258            dropDownMenuItem.style.visibility = 'visible';
259
260            if(id == 'mshop' && document.getElementById('headernavigationshoplink') && document.getElementById('headerarrow'))
261            {
262                var element = document.getElementById('headernavigationdiv');
263
264                var xposition0 = 0;
265                var yposition0 = 0;
266
267                while(element)
268                {
269                    xposition0 += (element.offsetLeft);
270                    yposition0 += (element.offsetTop);
271                    element = element.offsetParent;
272                }
273
274
275                var element = document.getElementById('headernavigationshoplink');
276
277                var xposition1 = 0;
278                var yposition1 = 0;
279
280                while(element)
281                {
282                    xposition1 += (element.offsetLeft);
283                    yposition1 += (element.offsetTop);
284                    element = element.offsetParent;
285                }
286
287                document.getElementById('headerarrow').style.left = (xposition1 - xposition0 + 8) + 'px';
288
289            }
290
291        }
292        else
293        {
294            dropDownMenuItem.style.visibility = 'hidden';
295        }
296    }
297
298
299    function userenteringkeyword()
300    {
301        flaguserenteringkeyword = 1;
302    }
303
304
305    // close shown layer
306    function mclose()
307    {
308        menubaroverrideflag = 0;
309
310        if(flaguserenteringkeyword == 1)
311        {
312            flaguserenteringkeyword = 0;
313            return;
314        }
315
316        if(dropDownMenuItem)
317        {
318            if(dropDownMenuItem.flagmobiledevice == 1)
319            {
320                return;
321            }
322
323            dropDownMenuItem.style.visibility = 'hidden';
324        }
325
326        if(dropDownMenuSourceItem)
327        {
328            dropDownMenuSourceItem.className = dropDownMenuSourceItem.className.replace(' linkHighlighted', '');
329        }
330
331        if(document.getElementById('headerarrow'))
332        {
333            document.getElementById('headerarrow').style.visibility = 'hidden';
334        }
335
336        if(document.getElementById('headerarrow2'))
337        {
338            document.getElementById('headerarrow2').style.visibility = 'hidden';
339        }
340    }
341
342    // go close timer
343    function mclosetime()
344    {
345        mcancelopentime();
346        closetimer = window.setTimeout(mclose, timeoutclose);
347    }
348
349    // cancel close timer
350    function mcancelclosetime()
351    {
352        if(closetimer)
353        {
354            window.clearTimeout(closetimer);
355            closetimer = null;
356        }
357    }
358
359    function mcancelopentime()
360    {
361        if(opentimer)
362        {
363            window.clearTimeout(opentimer);
364            opentimer = null;
365        }
366    }
367
368
369    function closeoverride(id)
370    {
371        if(document.getElementById(id))
372        {
373            document.getElementById(id).style.visibility = 'hidden';
374        }
375
376        if(document.getElementById('headerarrow'))
377        {
378            document.getElementById('headerarrow').style.visibility = 'hidden';
379        }
380
381        if(document.getElementById('headerarrow2'))
382        {
383            document.getElementById('headerarrow2').style.visibility = 'hidden';
384        }
385    }
386
387    // close layer when click-out
388    document.onclick = mclose;
389    document.onmousemove = clearmenubaroverrideflag();
390
391    function showsmartphonesearch()
392    {
393        if(document.getElementById('headersearchdivnew'))
394        {
395            if(document.getElementById('headersearchdivnew').style.display != 'inline-block')
396            {
397                document.getElementById('headersearchdivnew').style.display = 'inline-block';
398            }
399            else
400            {
401                document.getElementById('headersearchdivnew').style.display = 'none';
402            }
403        }
404
405        if(document.getElementById('headerartistwebsitesearchdiv'))
406        {
407            if(document.getElementById('headerartistwebsitesearchdiv').style.display != 'inline-block')
408            {
409                document.getElementById('headerartistwebsitesearchdiv').style.display = 'inline-block';
410            }
411            else
412            {
413                document.getElementById('headerartistwebsitesearchdiv').style.display = 'none';
414            }
415        }
416    }
417
418    function showwidgetsmartphonesearch()
419    {
420        if(document.getElementById('headerwidgetsearchdivnew'))
421        {
422            if(document.getElementById('headerwidgetsearchdivnew').style.display != 'inline-block')
423            {
424                document.getElementById('headerwidgetsearchdivnew').style.display = 'inline-block';
425            }
426            else
427            {
428                document.getElementById('headerwidgetsearchdivnew').style.display = 'none';
429            }
430        }
431
432        if(document.getElementById('headerWidgetSearchDiv'))
433        {
434            if(document.getElementById('headerWidgetSearchDiv').style.display != 'inline-block')
435            {
436                document.getElementById('headerWidgetSearchDiv').style.display = 'inline-block';
437            }
438            else
439            {
440                document.getElementById('headerWidgetSearchDiv').style.display = 'none';
441            }
442        }
443    }
444
445
446    // New Navigation Functions
447    function menuPreOpen2019(e)
448    {
449        e = e || window.event;
450        e.stopPropagation();
451
452        var eventSource = e.target || e.srcElement;
453        var sourceId = eventSource.id;
454
455        if(!sourceId)
456        {
457            sourceId = eventSource.parentNode.id;
458        }
459
460        if(document.getElementById(sourceId))
461        {
462            var targetId = document.getElementById(sourceId).getAttribute('data-targetMenuId');
463        }           
464
465        if(!targetId)
466        {
467            mcancelclosetime();
468            mcancelopentime();            
469            //console.log('menuPreOpen2019 NO TARGET - ' + targetId + ' - ' + sourceId);
470            return;
471        }
472        
473        //console.log('menuPreOpen2019 - ' + targetId + ' - ' + sourceId);
474
475        mcancelclosetime();
476        mcancelopentime();
477
478        if(dropDownMenuItem)
479        {
480            if(dropDownMenuItem.style.visibility != 'hidden')
481            {
482                menuOpen(targetId,sourceId);
483                return;
484            }
485        }
486
487        opentimer = window.setTimeout(function() {menuOpen(targetId,sourceId);}, timeoutopen);
488    }    
489    
490    
491
492    function menuOpen(targetId,sourceId)
493    {
494        var flagShowArrow = 0;
495
496        if(document.getElementById('headerarrow'))
497        {
498            document.getElementById('headerarrow').style.visibility = 'hidden';
499        }
500
501        if(document.getElementById('headerarrow2'))
502        {
503            document.getElementById('headerarrow2').style.visibility = 'hidden';
504        }        
505        
506        if(document.getElementById(sourceId))
507        {
508            flagShowArrow = document.getElementById(sourceId).getAttribute('data-showarrow');
509        }
510        
511        //console.log('targetId = ' + targetId + ' | sourceId = ' + sourceId + ' | flagShowArrow = ' + flagShowArrow);
512
513        if(true && menubaroverrideflag == 1)
514        {
515            return;
516        }
517        
518        // Cancel the close timer.
519        mcancelclosetime();
520
521        // Close the old menu.
522        if(dropDownMenuItem)
523        {
524            dropDownMenuItem.style.visibility = 'hidden';
525        }
526
527        if(dropDownMenuSourceItem)
528        {
529            dropDownMenuSourceItem.className = dropDownMenuSourceItem.className.replace(' linkHighlighted', '');
530        }
531
532        // Get the new menu and show it.
533        dropDownMenuItem = document.getElementById(targetId);
534        dropDownMenuItem.style.visibility = 'visible';
535
536        //console.log(dropDownMenuItem);
537
538        if(document.getElementById(sourceId))
539        {
540            dropDownMenuSourceItem = document.getElementById(sourceId);
541
542            var newClassName = dropDownMenuSourceItem.className + ' linkHighlighted';
543            dropDownMenuSourceItem.className = newClassName;
544
545            flagShowArrow = dropDownMenuSourceItem.getAttribute('data-showarrow');
546        }
547
548        if(flagShowArrow == 1 && document.getElementById('headerarrow'))
549        {
550            var element;
551
552            if(document.getElementById('headernavigationdiv'))
553            {
554                element = document.getElementById('headernavigationdiv');
555            }
556
557            // This is for custom white-label websites (double-row navigation).
558            if(document.getElementById('headerCustomNavigationMenuDiv'))
559            {
560                element = document.getElementById('headerCustomNavigationMenuDiv');
561            }
562
563            // This is for custom white-label websites (single-row navigation).
564            if(document.getElementById('headerCustomNavigationSingleRowMenuDiv'))
565            {
566                element = document.getElementById('headerCustomNavigationSingleRowMenuDiv');
567            }
568            
569            // This is for the new white-label websites for 2019.
570            if(document.getElementById('headerNavigationDiv2019'))
571            {
572                element = document.getElementById('headerNavigationDiv2019');
573            }            
574
575            var xposition0 = 0;
576            var yposition0 = 0;
577
578            while(element)
579            {
580                xposition0 += (element.offsetLeft);
581                yposition0 += (element.offsetTop);
582                element = element.offsetParent;
583            }
584
585
586            var sourceElement = document.getElementById(sourceId);
587            var width = sourceElement.offsetWidth;
588            var height = sourceElement.offsetHeight;
589
590            var arrowElement = document.getElementById('headerarrow');
591            var widthArrow = arrowElement.offsetWidth;
592            var heightArrow = arrowElement.offsetHeight;
593
594            var xposition1 = 0;
595            var yposition1 = 0;
596
597            while(sourceElement)
598            {
599                xposition1 += (sourceElement.offsetLeft);
600                yposition1 += (sourceElement.offsetTop);
601                sourceElement = sourceElement.offsetParent;
602            }
603
604            var targetX = xposition1 - xposition0 + (width - widthArrow)/2;
605            targetX = parseInt(targetX) + 'px';
606
607            document.getElementById('headerarrow').style.left = targetX;
608            document.getElementById('headerarrow').style.visibility = 'visible';
609        }
610    }
611
612    function menuToggle2019(e)
613    {
614        e = e || window.event;
615        //console.log(e);
616        
617        var eventSource = e.target || e.srcElement;
618        var sourceId = eventSource.id;
619
620        if(!sourceId)
621        {
622            sourceId = eventSource.parentNode.id;
623        }
624     
625        //console.log('menuToggle2019 - ' + sourceId);
626     
627        if(document.getElementById(sourceId))
628        {
629            var targetId = document.getElementById(sourceId).getAttribute('data-targetMenuId');
630            
631            if(targetId)
632            {
633                //console.log('menuToggle2019 - ' + sourceId + ' - ' + targetId);
634                e.preventDefault();
635                
636                mcancelclosetime();
637                mcancelopentime();
638
639                // Close old dropdown menu.
640                if(dropDownMenuItem)
641                {
642                    if(dropDownMenuItem.id != targetId)
643                    {
644                        dropDownMenuItem.style.visibility = 'hidden';
645                    }
646                }
647
648                dropDownMenuItem = document.getElementById(targetId);
649                //dropDownMenuItem.flagmobiledevice = 1;
650
651                if(dropDownMenuItem.style.visibility != 'visible')
652                {
653                    menuOpen(targetId,sourceId);
654                }
655                else
656                {
657                    dropDownMenuItem.style.visibility = 'hidden';
658
659                    if(document.getElementById('headerarrow'))
660                    {
661                        document.getElementById('headerarrow').style.visibility = 'hidden';
662                    }
663
664                    if(document.getElementById('headerarrow2'))
665                    {
666                        document.getElementById('headerarrow2').style.visibility = 'hidden';
667                    }
668                }               
669            }
670        }
671    }
672    
673
674    function menuKeyPress(e)
675    {
676        clearmenubaroverrideflag();
677        
678        e = e || window.event;
679
680        var eventSource = e.target || e.srcElement;
681        var sourceId = eventSource.id;
682
683        if(!sourceId)
684        {
685            sourceId = eventSource.parentNode.id;
686        }
687
688        if(document.getElementById(sourceId))
689        {
690            var targetId = document.getElementById(sourceId).getAttribute('data-targetMenuId');
691
692            if(e.keyCode === 13)
693            {
694                e.preventDefault();
695                e.stopImmediatePropagation();
696
697                mcancelclosetime();
698                mcancelopentime();
699
700                // Close old dropdown menu.
701                if(dropDownMenuItem)
702                {
703                    if(dropDownMenuItem.id != targetId)
704                    {
705                        dropDownMenuItem.style.visibility = 'hidden';
706                    }
707                }
708
709                dropDownMenuItem = document.getElementById(targetId);
710
711                if(dropDownMenuItem.style.visibility != 'visible')
712                {
713                    menuOpen(targetId,sourceId);
714
715                    dropDownMenuItem.dropDownLockFocus = focusTrap(dropDownMenuItem, {'onDeactivate': mclose, 'clickOutsideDeactivates': true,});
716                    dropDownMenuItem.dropDownLockFocus.activate();
717
718                }
719                else
720                {
721                    dropDownMenuItem.style.visibility = 'hidden';
722
723                    if(dropDownMenuItem.dropDownLockFocus)
724                    {
725                        dropDownMenuItem.dropDownLockFocus.deactivate();
726                    }
727
728                    if(document.getElementById('headerarrow'))
729                    {
730                        document.getElementById('headerarrow').style.visibility = 'hidden';
731                    }
732
733                    if(document.getElementById('headerarrow2'))
734                    {
735                        document.getElementById('headerarrow2').style.visibility = 'hidden';
736                    }
737                }
738
739            }
740    
741        }
742        
743    }
744
745
746    function toggleMobileNavigationDiv(targetAction)
747    {
748        var containers = document.getElementsByClassName('container');
749
750        if(document.getElementById('mobileNavigationDiv').style.display != 'inline-block')
751        {
752            var body = document.body;
753            var html = document.documentElement;
754
755            var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
756            height = height + 'px';
757
758            for(var i = 0; i < containers.length; i++)
759            {
760                containers[i].style.marginLeft = '290px';
761            }
762
763            document.getElementById('mobileNavigationDiv').style.display = 'inline-block';
764            document.getElementById('mobileNavigationDiv').style.width = '275px';
765            document.getElementById('mobileNavigationDiv').style.height = height;
766
767            document.getElementById('mobileNavigationBackgroundDiv').style.display = 'inline-block';
768            document.getElementById('mobileNavigationBackgroundDiv').style.width = '100%';
769            document.getElementById('mobileNavigationBackgroundDiv').style.height = '100%';
770            showMobileMenu('mobileNavigationMenuMain');
771
772            globalFocusTrap = focusTrap(document.getElementById('mobileNavigationDiv'),{'clickOutsideDeactivates': true, 'onDeactivate': toggleMobileNavigationDiv});
773            globalFocusTrap.activate();
774			
775			if(targetAction == 'showProducts')
776			{
777				showMobileMenuProducts();
778			}
779        }
780        else
781        {
782            for(var i = 0; i < containers.length; i++)
783            {
784                containers[i].style.marginLeft = 'auto';
785            }
786
787            document.getElementById('mobileNavigationDiv').style.width = '0px';
788            document.getElementById('mobileNavigationDiv').style.display = 'none';
789            document.getElementById('mobileNavigationBackgroundDiv').style.width = '0%';
790            document.getElementById('mobileNavigationBackgroundDiv').style.display = 'none';
791            
792            if(typeof globalFocusTrap === 'object' && globalFocusTrap.isActive())
793            {
794                globalFocusTrap.stopCallBack();
795                globalFocusTrap.deactivate();
796            }            
797            
798        }
799
800         window.scrollTo(0, 0);
801    }
802
803    function showMobileMenu(menuId)
804    {
805
806        var menus = document.getElementsByClassName('mobileNavigationListContainer');
807
808        for(var i = 0; i < menus.length; i++)
809        {
810            if(menus[i].id == menuId)
811            {
812                menus[i].style.display = 'inline-block';
813            }
814            else
815            {
816                menus[i].style.display = 'none';
817            }
818        }
819
820    }
821	
822	function showMobileMenuProducts()
823	{
824		var menus = document.getElementsByClassName('mobileNavigationListContainer');
825
826		for(var i = 0; i < menus.length; i++)
827		{
828			if(menus[i].id == 'mobileNavigationMenuShop')
829			{
830				menus[i].style.display = 'inline-block';
831			}
832			else
833			{
834				menus[i].style.display = 'none';
835			}
836		}	
837	}
838	
839
840    function showMobileMenu2023(e)
841    {
842		e = e || window.event;
843		
844		var targetElement = e.currentTarget;
845
846		if(targetElement.hasAttribute('target-mobile-menu'))
847		{
848			var targeMobileMenuId = targetElement.getAttribute('target-mobile-menu');
849		
850			var menus = document.getElementsByClassName('mobileNavigationListContainer');
851
852			for(var i = 0; i < menus.length; i++)
853			{
854				if(menus[i].id == targeMobileMenuId)
855				{
856					menus[i].style.display = 'inline-block';
857				}
858				else
859				{
860					menus[i].style.display = 'none';
861				}
862			}		
863		
864		}		
865    }
866
867    function toggleMobileSubMenu(menuId)
868    {
869        if(document.getElementById(menuId).style.display != 'inline-block')
870        {
871            var menus = document.getElementsByClassName('mobileNavigationMenuSubList');
872			var menuParent;
873			
874            for(var i = 0; i < menus.length; i++)
875            {
876                menus[i].style.display = 'none';
877				menuParent = menus[i].parentElement;
878				
879				if(menuParent)
880				{
881					menuParent.setAttribute('data-expanded', 0);
882				}
883            }
884
885            document.getElementById(menuId).style.display = 'inline-block';
886			
887			menuParent = document.getElementById(menuId).parentElement;
888			
889			if(menuParent)
890			{
891				menuParent.setAttribute('data-expanded', 1);
892			}			
893			
894        }
895        else
896        {
897			var menuParent;			
898			
899            document.getElementById(menuId).style.display = 'none';
900			
901			menuParent = document.getElementById(menuId).parentElement;
902			
903			if(menuParent)
904			{
905				menuParent.setAttribute('data-expanded', 0);
906			}			
907			
908        }
909    }
910
911    function toggleMobileSubMenu2023(e)
912    {
913		e = e || window.event;
914		
915		var targetElement = e.currentTarget;
916
917		if(targetElement.hasAttribute('target-mobile-sub-menu'))
918		{
919			var targeMobileSubMenuId = targetElement.getAttribute('target-mobile-sub-menu');
920		
921			if(document.getElementById(targeMobileSubMenuId).style.display != 'inline-block')
922			{
923				var menus = document.getElementsByClassName('mobileNavigationMenuSubList');
924
925				for(var i = 0; i < menus.length; i++)
926				{
927					menus[i].style.display = 'none';
928				}
929
930				var menus = document.getElementsByClassName('mobileNavigationLinkDownArrow');
931
932				for(var i = 0; i < menus.length; i++)
933				{
934					if(menus[i] !== targetElement)
935					{
936						menus[i].setAttribute('data-expanded', 0);
937					}
938				}
939
940				targetElement.setAttribute('data-expanded', 1);
941				document.getElementById(targeMobileSubMenuId).style.display = 'inline-block';
942			}
943			else
944			{
945				var menus = document.getElementsByClassName('mobileNavigationLinkDownArrow');
946
947				for(var i = 0; i < menus.length; i++)
948				{
949					menus[i].setAttribute('data-expanded', 0);
950				}				
951				
952				targetElement.setAttribute('data-expanded', 0);
953				document.getElementById(targeMobileSubMenuId).style.display = 'none';
954			}	
955		
956		}		
957    }
958
959    function selectSearchType(searchTypeId,searchTypeName)
960    {
961        var elements = document.getElementsByClassName('searchType');
962
963        for(var i = 0; i < elements.length; i ++)
964        {
965            elements[i].value = searchTypeId;
966        }
967
968        var elements = document.getElementsByClassName('searchTypeName');
969
970        for(var i = 0; i < elements.length; i ++)
971        {
972            elements[i].innerHTML = searchTypeName;
973        }
974
975        hidesearchtypeoptionsheader();
976    }
977	
978    function selectSearchType2023(e)
979    {
980		e = e || window.event;
981		
982		var targetElement = e.currentTarget;
983
984		var searchTypeId = targetElement.getAttribute('data-search-type');
985		var searchTypeName = targetElement.getAttribute('data-display-search-type');
986		
987        var elements = document.getElementsByClassName('searchType');
988
989        for(var i = 0; i < elements.length; i ++)
990        {
991            elements[i].value = searchTypeId;
992        }
993
994        var elements = document.getElementsByClassName('searchTypeName');
995
996        for(var i = 0; i < elements.length; i ++)
997        {
998            elements[i].innerHTML = searchTypeName;
999        }
1000
1001        hidesearchtypeoptionsheader();
1002    }	
1003	
1004
1005    function headerSearchFocus()
1006    {
1007        if(document.getElementById('searchFormHeader'))
1008        {
1009            var currentClassName = document.getElementById('searchFormHeader').className;
1010            if(currentClassName.indexOf('searchFormHeaderActivated') == -1)
1011            {
1012                var newClassName = currentClassName + ' searchFormHeaderActivated';
1013                document.getElementById('searchFormHeader').className = newClassName;
1014            }
1015        }
1016        
1017        if(document.getElementById('headerSearchTypeDiv'))
1018        {
1019            document.getElementById('headerSearchTypeDiv').style.display = 'inline-block';
1020        }
1021
1022        if(document.getElementById('headerCustomSearchTypeDiv'))
1023        {
1024            document.getElementById('headerCustomSearchTypeDiv').style.display = 'inline-block';
1025        }
1026    }
1027
1028    function customHeaderSearchFocus()
1029    {
1030        if(document.getElementById('headerCustomSearchForm'))
1031        {
1032            var currentClassName = document.getElementById('headerCustomSearchForm').className;
1033            if(currentClassName.indexOf('headerCustomSearchFormActivated') == -1)
1034            {
1035                var newClassName = currentClassName + ' headerCustomSearchFormActivated';
1036                document.getElementById('headerCustomSearchForm').className = newClassName;
1037            }
1038        }
1039        
1040        if(document.getElementById('headerCustomSearchTypeDiv'))
1041        {
1042            document.getElementById('headerCustomSearchTypeDiv').style.display = 'inline-block';
1043        }
1044    }    
1045    
1046    function createAddToCartForegroundAndBackgroundDiv()
1047    {
1048        var newdiv;
1049        var cssstyle;
1050
1051        if(!document.getElementById('addToCartBackgroundDiv'))
1052        {
1053            // Background Div
1054            newdiv = document.createElement('div');
1055            cssstyle = 'position: fixed; z-index: 5000; left: 0px; top: 0px; width: 10px; height: 10px; background-color: #000000; visibility: hidden; opacity: 0.50; filter: alpha(opacity=50);';
1056            newdiv.id = 'addToCartBackgroundDiv';
1057            newdiv.setAttribute('style',cssstyle);
1058            newdiv.style.cssText = cssstyle;
1059            document.body.appendChild(newdiv);
1060        }
1061
1062        if(!document.getElementById('addToCartForegroundDiv'))
1063        {
1064            // Foreground Div
1065            newdiv = document.createElement('div');
1066            cssstyle = 'position: fixed; z-index: 5001; left: 0px; top: 0px; overflow: auto; padding: 0px; border: 1px solid #666666; background-color: #FFFFFF; visibility: hidden; box-shadow: 0px 0px 50px #000000; text-align: center;';
1067            newdiv.id = 'addToCartForegroundDiv';
1068            newdiv.setAttribute('style',cssstyle);
1069            newdiv.style.cssText = cssstyle;
1070            document.body.appendChild(newdiv);
1071        }
1072
1073    }
1074
1075    function showAddToCartForegroundAndBackgroundDiv()
1076    {
1077        var backgroundObject = document.getElementById('addToCartBackgroundDiv');
1078        backgroundObject.style.width = '100%';
1079        backgroundObject.style.height = '100%';
1080        backgroundObject.style.visibility = 'visible';
1081
1082        var widthClient = parseInt(document.documentElement.clientWidth);
1083        var heightClient = parseInt(document.documentElement.clientHeight);
1084
1085        //alert(widthClient);
1086
1087        if(heightClient < 400)
1088        {
1089            var widthTarget = parseInt(widthClient*0.95);
1090            var heightTarget = parseInt(heightClient*0.95);
1091        }
1092        else
1093        {
1094            if(widthClient > heightClient)
1095            {
1096                var widthTarget = parseInt(widthClient*0.80);
1097                var heightTarget = parseInt(heightClient*0.80);
1098            }
1099            else
1100            {
1101                var widthTarget = parseInt(widthClient*0.80);
1102                var heightTarget = parseInt(heightClient*0.80);
1103            }
1104        }
1105
1106
1107
1108        var borderWidthTotal = 0;
1109
1110        if((widthTarget + borderWidthTotal) > widthClient)
1111        {
1112            widthTarget = widthClient - borderWidthTotal;
1113        }
1114
1115        if((heightTarget + borderWidthTotal) > heightClient)
1116        {
1117            heightTarget = heightClient - borderWidthTotal;
1118        }
1119
1120        if(widthTarget > 900)
1121        {
1122            widthTarget = 900;
1123        }
1124
1125        if(heightTarget > 800)
1126        {
1127            heightTarget = 800;
1128        }
1129
1130        var offsetLeft = 0;
1131        var offsetTop = 0;
1132
1133        var offsetX = 0;
1134        var offsetY = 0;
1135
1136        if(document.documentElement.scrollTop && !document.body.scrollTop)
1137        {
1138            //offsetLeft = document.documentElement.scrollLeft;
1139            //offsetTop = document.documentElement.scrollTop;
1140        }
1141        else
1142        {
1143            //offsetLeft = document.body.scrollLeft;
1144            //offsetTop = document.body.scrollTop;
1145        }
1146
1147        var addToCartForegroundDiv = document.getElementById('addToCartForegroundDiv');
1148        addToCartForegroundDiv.style.width = widthTarget + 'px';
1149        addToCartForegroundDiv.style.height = heightTarget + 'px';
1150        addToCartForegroundDiv.style.visibility = 'visible';
1151        addToCartForegroundDiv.innerHTML = "<img src='/assets/images/Searching.gif' style='display: inline-block; margin-top: 20px;'>";
1152
1153        addToCartForegroundDiv.style.left = (offsetX + offsetLeft + parseInt((widthClient - (widthTarget + 0)) / 2)) + 'px';
1154        addToCartForegroundDiv.style.top = (offsetY + offsetTop + parseInt((heightClient - (heightTarget + 0)) / 2)) + 'px';
1155
1156    }
1157
1158    function globalAddToCartCompleteProductSku()
1159    {
1160		// Facebook
1161        if(simpleEcommerceId && typeof fbq == 'function')
1162        {
1163            fbq('track', 'AddToCart', {content_type: 'product', content_ids: [simpleEcommerceId], value: simpleEcommercePrice, currency: 'USD'});
1164        }
1165		
1166		// Pinterest
1167		if(simpleEcommerceId && typeof pintrk == 'function')
1168		{
1169		  pintrk('track', 'AddToCart', {
1170			value: simpleEcommercePrice,
1171			order_quantity: 1,
1172			currency: 'USD',
1173				line_items: [
1174					{
1175						product_id: simpleEcommerceId,
1176					},
1177				],
1178		  });
1179		}		
1180
1181		// Vibe
1182		if(typeof vbpx == 'function')
1183		{
1184			vbpx('event', 'lead');
1185		}
1186
1187        createAddToCartForegroundAndBackgroundDiv();
1188        showAddToCartForegroundAndBackgroundDiv();
1189
1190        var widthTarget = document.getElementById('addToCartForegroundDiv').style.width;
1191        var heightTarget = document.getElementById('addToCartForegroundDiv').style.height;
1192
1193        widthTarget = widthTarget.replace('px','');
1194        heightTarget = heightTarget.replace('px','');
1195
1196        var localvalue = requestcount;
1197
1198        httpobject[localvalue] = newHttpReq();
1199        httpobject[localvalue].onreadystatechange = function(){
1200
1201            try
1202            {
1203                if(httpobject[localvalue].readyState == 4)
1204                {
1205                }
1206
1207                if(httpobject[localvalue].status == 200)
1208                {
1209                }
1210            }
1211            catch (e)
1212            {
1213                return;
1214            }
1215
1216            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
1217            {
1218                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
1219
1220                document.getElementById('addToCartForegroundDiv').innerHTML = response[0];
1221                globalFocusTrap = focusTrap(document.getElementById('addToCartForegroundDiv'),{'clickOutsideDeactivates': true, 'initialFocus': '#buttonCheckout', 'onDeactivate': function(){globalHideAddToCartPopUp()}});
1222                globalFocusTrap.activate();
1223
1224                if(response[1])
1225                {
1226                    var responseData = JSON.parse(response[1]);
1227
1228                    if(responseData.hasOwnProperty('redirectUrl'))
1229                    {
1230                        if(responseData.redirectUrl !== '')
1231                        {
1232                            window.location = responseData.redirectUrl;
1233                            return;
1234                        }
1235                    }
1236
1237                    if(false && responseData.hasOwnProperty('googleAnalyticsData'))
1238                    {
1239                        window.dataLayer = window.dataLayer || [];
1240                        window.dataLayer.push(responseData.googleAnalyticsData);
1241                    }
1242					
1243                    if(responseData && responseData.hasOwnProperty('ga4'))
1244                    {
1245                        window.dataLayer = window.dataLayer || [];
1246						window.dataLayer.push(responseData.ga4);
1247                    }					
1248									
1249                }
1250
1251                updateShoppingCartNumProducts();
1252
1253            }
1254
1255
1256        };
1257
1258        var postString = 'widthTarget=' + widthTarget + '&heightTarget=' + heightTarget;
1259
1260        // http://stackoverflow.com/questions/4116608/pass-unknown-number-of-arguments-into-javascript-function
1261        for (var i = 0; i < arguments.length; i++)
1262        {
1263            postString += '&completeProductSku[]=' + arguments[i];
1264        }
1265
1266        var url = "/queries/queryAddToCart.php";
1267
1268        httpobject[localvalue].open('post',url,true);
1269        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
1270        httpobject[localvalue].send(postString);
1271
1272        requestcount += 1;
1273
1274        return;
1275
1276    }
1277
1278    function globalAddToCartUniqueId(uniqueId, timeoutUrl, quantity)
1279    {
1280        createAddToCartForegroundAndBackgroundDiv();
1281        showAddToCartForegroundAndBackgroundDiv();
1282
1283        if (typeof quantity == 'undefined')
1284        {
1285            quantity = 1;
1286        }
1287
1288        var widthTarget = document.getElementById('addToCartForegroundDiv').style.width;
1289        var heightTarget = document.getElementById('addToCartForegroundDiv').style.height;
1290
1291        widthTarget = widthTarget.replace('px','');
1292        heightTarget = heightTarget.replace('px','');
1293
1294        var localvalue = requestcount;
1295
1296        httpobject[localvalue] = newHttpReq();
1297        httpobject[localvalue].onreadystatechange = function(){
1298
1299            try
1300            {
1301                if(httpobject[localvalue].readyState == 4)
1302                {
1303                }
1304
1305                if(httpobject[localvalue].status == 200)
1306                {
1307                }
1308            }
1309            catch (e)
1310            {
1311                return;
1312            }
1313
1314            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
1315            {
1316                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
1317
1318                document.getElementById('addToCartForegroundDiv').innerHTML = response[0];
1319                globalFocusTrap = focusTrap(document.getElementById('addToCartForegroundDiv'),{'clickOutsideDeactivates': true, 'initialFocus': '#buttonCheckout', 'onDeactivate': function(){globalHideAddToCartPopUp()}});
1320                globalFocusTrap.activate();
1321
1322                if(response[1])
1323                {
1324                    var responseData = JSON.parse(response[1]);
1325
1326                    if(responseData && responseData.hasOwnProperty('redirectUrl'))
1327                    {
1328                        if(responseData.redirectUrl !== '')
1329                        {
1330                            window.location = responseData.redirectUrl;
1331                            return;
1332                        }
1333                    }
1334
1335                    if(false && responseData && responseData.hasOwnProperty('googleAnalyticsData'))
1336                    {
1337                        window.dataLayer = window.dataLayer || [];
1338						window.dataLayer.push(responseData.googleAnalyticsData);
1339                    }
1340                    
1341                    if(responseData && responseData.hasOwnProperty('ga4'))
1342                    {
1343                        window.dataLayer = window.dataLayer || [];
1344						window.dataLayer.push(responseData.ga4);
1345                    }					
1346					
1347					// Facebook
1348                    if(simpleEcommerceId && typeof fbq == 'function')
1349                    {
1350                        fbq('track', 'AddToCart', {content_type: 'product', content_ids: [simpleEcommerceId], value: simpleEcommercePrice, currency: 'USD'});
1351                    }
1352					
1353					// Pinterest
1354                    if(simpleEcommerceId && typeof pintrk == 'function')
1355                    {
1356					  pintrk('track', 'AddToCart', {
1357						value: simpleEcommercePrice,
1358						order_quantity: quantity,
1359						currency: 'USD'
1360					  });
1361                    }					
1362					
1363					// Vibe
1364					if(typeof vbpx == 'function')
1365					{
1366						vbpx('event', 'lead');
1367					}
1368					
1369                }
1370
1371                updateShoppingCartNumProducts();
1372            }
1373        };
1374
1375        var postString = 'widthTarget=' + widthTarget + '&heightTarget=' + heightTarget + '&uniqueId=' + uniqueId + '&timeoutUrl=' + timeoutUrl + '&quantity=' + quantity;
1376
1377        var url = "/queries/queryAddToCart.php";
1378
1379        httpobject[localvalue].open('post',url,true);
1380        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
1381        httpobject[localvalue].send(postString);
1382
1383        requestcount += 1;
1384
1385        return;
1386
1387    }
1388
1389    function globalHideAddToCartPopUp()
1390    {
1391        document.getElementById('addToCartBackgroundDiv').style.visibility = 'hidden';
1392        document.getElementById('addToCartForegroundDiv').style.visibility = 'hidden';
1393        document.getElementById('addToCartForegroundDiv').innerHTML = '&nbsp;';
1394
1395        if(typeof globalFocusTrap === 'object' && globalFocusTrap.isActive())
1396        {
1397            globalFocusTrap.stopCallBack();
1398            globalFocusTrap.deactivate();
1399        }
1400    }
1401
1402    function checkForEnterSearchFormHeader(e)
1403    {
1404        if(e == null)
1405		{
1406            e = window.event;
1407        }
1408
1409        if(e.keyCode === 13)
1410		{
1411			e.preventDefault();
1412            document.getElementById('searchFormHeader').submit();
1413        }
1414    }
1415	
1416	function positionAutoPromptDiv()
1417	{		
1418		var sourceElement = document.getElementById(autoPromptContainerId);
1419	
1420        if(!document.getElementById('autoPromptDiv'))
1421        {
1422            // Create the auto-prompt div.
1423            var newDiv = document.createElement('div');
1424            //var cssStyle = 'position: fixed; box-sizing: border-box; z-index: 5000; left: 0px; top: 0px; width: 10px; height: 10px; background-color: #000000; visibility: hidden; opacity: 0.50; filter: alpha(opacity=50);';
1425            newDiv.id = 'autoPromptDiv';
1426            //newDiv.setAttribute('style',cssStyle);
1427            //newDiv.style.cssText = cssstyle;
1428			newDiv.setAttribute('data-container-id',autoPromptContainerId);
1429            sourceElement.appendChild(newDiv);
1430        }
1431		else
1432		{
1433			if(document.getElementById('autoPromptDiv').getAttribute('data-container-id') != autoPromptContainerId)
1434			{
1435				sourceElement.appendChild(document.getElementById('autoPromptDiv'));
1436			}
1437		}
1438	
1439		var targetElement = document.getElementById('autoPromptDiv');
1440
1441        var sourceWidth = document.defaultView.getComputedStyle(sourceElement,'').getPropertyValue('width');
1442        var sourceHeight = document.defaultView.getComputedStyle(sourceElement,'').getPropertyValue('height');		
1443
1444		targetElement.style.width = sourceWidth;
1445		targetElement.style.top = sourceHeight;
1446	}
1447	
1448	function hideAutoPromptDiv()
1449	{
1450		document.getElementById('autoPromptDiv').innerHTML = '';
1451		document.getElementById('autoPromptDiv').style.display = 'none';
1452		window.removeEventListener('click', checkAutoPromptClick);
1453	}
1454	
1455	function showAutoPromptDiv()
1456	{
1457		document.getElementById('autoPromptDiv').style.display = 'inline-block';
1458		window.addEventListener('click', checkAutoPromptClick);
1459	}	
1460	
1461	function checkAutoPromptClick()
1462	{
1463		var activeElementId = document.activeElement.id;
1464
1465		if(activeElementId == '')
1466		{
1467			hideAutoPromptDiv();
1468			return;
1469		}
1470		
1471		if(document.getElementById(activeElementId).getAttribute('data-flag-search-input') != 1)
1472		{
1473			hideAutoPromptDiv();
1474			return;
1475		}
1476	}
1477	
1478	function autoPromptSearchTerms(e)
1479	{
1480		if(e == null)
1481		{
1482			e = window.event;
1483		}		
1484		
1485		var eventSource = e.target;
1486		var eventSourceId = eventSource.id;
1487		
1488		autoPromptInputId = eventSourceId;
1489		autoPromptContainerId = document.getElementById(eventSourceId).getAttribute('data-container-id');
1490		
1491		//console.log(autoPromptInputId + ' - ' + autoPromptContainerId);		
1492
1493		if(document.getElementById('searchFormHeader'))
1494		{
1495			var flagArtistPage = document.getElementById('searchFormHeader').getAttribute('data-artist-page');
1496			
1497			if(flagArtistPage == 1)
1498			{
1499				return;
1500			}
1501		}
1502		
1503        if(autoPromptTimerId != -99)
1504        {
1505            clearTimeout(autoPromptTimerId);
1506        }		
1507	
1508		positionAutoPromptDiv();
1509	
1510        var searchTerm = document.getElementById(eventSourceId).value;
1511
1512        var stamp = new Date();
1513        var currentTimestamp = stamp.getTime();
1514
1515		var elapsedTime = (currentTimestamp - autoPromptPreviousTimestamp) / 1000;
1516        autoPromptPreviousTimestamp = currentTimestamp;         
1517
1518        if(searchTerm.length < 3)
1519        {
1520            hideAutoPromptDiv();
1521        }
1522        
1523        if(elapsedTime < 0.500)
1524        {       
1525            autoPromptTimerId = setTimeout(autoPromptSearchTerms,750,e);
1526            return;
1527        }		
1528		
1529		if(searchTerm.length >= 3)
1530		{
1531			if(document.getElementById('autoPromptDiv'))
1532			{
1533				var localvalue = requestcount;
1534
1535				httpobject[localvalue] = newHttpReq();          
1536				httpobject[localvalue].onreadystatechange = function(){
1537				
1538					try 
1539					{
1540						if(httpobject[localvalue].readyState == 4)
1541						{
1542						}
1543					
1544						if(httpobject[localvalue].status == 200)
1545						{
1546						}
1547					}
1548					catch (e)
1549					{
1550						return;
1551					}
1552					
1553					if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
1554					{
1555						if(false)
1556						{
1557							var response = JSON.parse(httpobject[localvalue].responseText);
1558							
1559							if(response.numResults == 0)
1560							{
1561								hideAutoPromptDiv();
1562								return;
1563							}
1564							
1565							var autoPromptResults = response.results;
1566							updateAutoPromptResults(autoPromptResults);
1567						}
1568						
1569						var response = httpobject[localvalue].responseText.split("<EXTRAINSTRUCTIONS>");
1570						var numResults = response[0];
1571						var responseData = response[1];
1572						
1573						if(numResults == 0)
1574						{
1575							hideAutoPromptDiv();
1576							return;
1577						}
1578						
1579						showAutoPromptDiv();
1580						document.getElementById('autoPromptDiv').innerHTML = responseData;
1581						
1582						if(true)
1583						{
1584							var elements = document.getElementsByClassName('autoPromptResultButton');
1585							
1586							for(var i = 0; i < elements.length; i ++)
1587							{
1588								elements[i].addEventListener('click', handleAutoPromptClick, true);
1589							}
1590						}
1591					}
1592				
1593				
1594				};      
1595
1596				var url = "/queries/querySearchAutoPrompt.php";
1597				var poststring = "searchTerm=" + encodeURIComponent(searchTerm);
1598
1599				httpobject[localvalue].open('post',url,true);
1600				httpobject[localvalue].setRequestHeader("content-type", "application/x-www-form-urlencoded");
1601				httpobject[localvalue].send(poststring);    
1602				
1603				requestcount += 1;
1604
1605			}
1606		}
1607		else
1608		{
1609			if(document.getElementById('autoPromptDiv'))
1610			{
1611				hideAutoPromptDiv();
1612			}
1613		}
1614	}
1615	
1616	// Update the auto-prompt results.
1617	function updateAutoPromptResults(autoPromptResults)
1618	{
1619		var autoPromptResultButtons = document.getElementById('autoPromptDiv').getElementsByTagName('button');
1620		
1621		for(var i = 0; i < autoPromptResultButtons.length; i ++)
1622		{
1623			autoPromptResultButtons[i].parentNode.removeChild(autoPromptResultButtons[i]);
1624			i --;
1625		}
1626
1627		for(var i = 0; i < autoPromptResults.length; i ++)
1628		{
1629			var newDiv = document.createElement('button');
1630			newDiv.type ='button';
1631			newDiv.id = 'autoPromptResultButton_' + i;
1632			newDiv.className = 'autoPromptResultButton';
1633			newDiv.innerHTML = autoPromptResults[i];
1634			newDiv.onclick = function() {alert('hello')};
1635
1636			document.getElementById('autoPromptDiv').appendChild(newDiv);
1637		}
1638
1639	}
1640	
1641	function setSearchTerm(searchTerm)
1642	{
1643		hideAutoPromptDiv();
1644		//document.getElementById('searchFormHeaderInput').value = searchTerm;
1645		//document.getElementById('searchFormHeader').submit();
1646		
1647		document.getElementById(autoPromptInputId).value = searchTerm;
1648		document.getElementById(autoPromptContainerId).submit();		
1649		
1650	}
1651	
1652	function handleAutoPromptClick(e)
1653	{
1654		e = e || window.event;
1655		
1656		var targetElement = e.currentTarget;
1657		
1658		if(targetElement.hasAttribute('data-search-term'))
1659		{
1660			var searchTerm = targetElement.getAttribute('data-search-term');
1661			document.getElementById(autoPromptInputId).value = searchTerm;
1662			document.getElementById(autoPromptContainerId).submit();				
1663		}
1664		
1665		if(targetElement.hasAttribute('data-target-url'))
1666		{
1667			var targetUrl = targetElement.getAttribute('data-target-url');
1668			goToUrl(targetUrl);				
1669		}		
1670	}
1671
1672    function checkForEnterHeaderCustomSearchForm(e)
1673    {
1674        if (e == null) {
1675            e = window.event;
1676        }
1677
1678        if (e.keyCode === 13) {
1679            document.getElementById('headerCustomSearchForm').submit();
1680        }
1681    }
1682
1683    function toggleMobileNavigation(parentDivId)
1684    {
1685        var currentClassName = document.getElementById(parentDivId).className;
1686        var newClassName = 'mobileNavigationElementContainer mobileNavigationElementContainerExpanded';
1687
1688        if(currentClassName === newClassName)
1689        {
1690            newClassName = 'mobileNavigationElementContainer';
1691        }
1692
1693        document.getElementById(parentDivId).className = newClassName;
1694
1695    }
1696
1697    function mobileNavigationSearchFocus()
1698    {
1699        var currentClassName = document.getElementById('mobileNavigationSearchForm').className;
1700        var additionalClassName = 'mobileNavigationSearchFormSelected';
1701
1702        if(currentClassName.indexOf(additionalClassName) == -1)
1703        {
1704            document.getElementById('mobileNavigationSearchForm').className += ' ' + additionalClassName;
1705        }
1706
1707        document.getElementById('mobileNavigationSearchTypeDiv').style.display = 'inline-block';
1708
1709    }
1710
1711    function selectMobileNavigationSearchType(searchType)
1712    {
1713        var newSearchType = searchType;
1714        var newSearchTypeName = document.getElementById('mobileNavigationSearchType-' + searchType).innerHTML;
1715
1716        document.getElementById('mobileNavigationSearchType').value = searchType;
1717        document.getElementById('mobileNavigationSearchTypeName').innerHTML = newSearchTypeName;
1718
1719        toggleMobileNavigation('mobileNavigationSearchTypeDiv');
1720    }
1721	
1722	function selectMobileNavigationSearchType2023(e)
1723	{
1724		e = e || window.event;
1725		
1726		var targetElement = e.currentTarget;
1727
1728		if(targetElement.hasAttribute('data-search-type'))
1729		{
1730			var newSearchType = targetElement.getAttribute('data-search-type');
1731			var newSearchTypeName = document.getElementById('mobileNavigationSearchType-' + newSearchType).innerHTML;
1732
1733			document.getElementById('mobileNavigationSearchType').value = newSearchType;
1734			document.getElementById('mobileNavigationSearchTypeName').innerHTML = newSearchTypeName;
1735
1736			toggleMobileNavigation('mobileNavigationSearchTypeDiv');	
1737		}			
1738		
1739	}
1740
1741    // Determine which elements within a parent element can be reached by pressing the tab key on the keyboard.
1742    function getTabbableNodes(el, options)
1743    {
1744        options = options || {};
1745
1746        var elementDocument = el.ownerDocument || el;
1747
1748        var basicTabbables = [];
1749        var orderedTabbables = [];
1750
1751
1752        // A node is "available" if
1753          // - it's computed style
1754        var isUnavailable = createIsUnavailable(elementDocument);
1755        
1756          var candidateSelectors = [
1757            'input',
1758            'select',
1759            'a[href]',
1760            'textarea',
1761            'button',
1762            '[tabindex]',
1763          ];
1764
1765          var candidates = el.querySelectorAll(candidateSelectors.join(','));
1766
1767          if (options.includeContainer) {
1768            var matches = Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1769
1770            if (
1771              candidateSelectors.some(function(candidateSelector) {
1772                return matches.call(el, candidateSelector);
1773              })
1774            ) {
1775              candidates = Array.prototype.slice.apply(candidates);
1776              candidates.unshift(el);
1777            }
1778          }
1779
1780          var candidate, candidateIndexAttr, candidateIndex;
1781          for (var i = 0, l = candidates.length; i < l; i++) {
1782            candidate = candidates[i];
1783
1784            candidateIndexAttr = parseInt(candidate.getAttribute('tabindex'), 10)
1785            candidateIndex = isNaN(candidateIndexAttr) ? candidate.tabIndex : candidateIndexAttr;
1786
1787            if (
1788              candidateIndex < 0
1789              || (candidate.tagName === 'INPUT' && candidate.type === 'hidden')
1790              || candidate.disabled
1791              || isUnavailable(candidate, elementDocument)
1792            ) {
1793              continue;
1794            }
1795
1796            if (candidateIndex === 0) {
1797              basicTabbables.push(candidate);
1798            } else {
1799              orderedTabbables.push({
1800                index: i,
1801                tabIndex: candidateIndex,
1802                node: candidate,
1803              });
1804            }
1805          }
1806
1807          var tabbableNodes = orderedTabbables
1808            .sort(function(a, b) {
1809              return a.tabIndex === b.tabIndex ? a.index - b.index : a.tabIndex - b.tabIndex;
1810            })
1811            .map(function(a) {
1812              return a.node
1813            });
1814
1815          Array.prototype.push.apply(tabbableNodes, basicTabbables);
1816
1817          return tabbableNodes;
1818
1819    }
1820
1821    function createIsUnavailable(elementDocument)
1822    {
1823        // Node cache must be refreshed on every check, in case
1824        // the content of the element has changed
1825        var isOffCache = [];
1826
1827        // "off" means `display: none;`, as opposed to "hidden",
1828        // which means `visibility: hidden;`. getComputedStyle
1829        // accurately reflects visiblity in context but not
1830        // "off" state, so we need to recursively check parents.
1831
1832        function isOff(node, nodeComputedStyle)
1833        {
1834            if (node === elementDocument.documentElement)
1835            {
1836                return false;
1837            }
1838
1839            // Find the cached node (Array.prototype.find not available in IE9)
1840            for (var i = 0, length = isOffCache.length; i < length; i++)
1841            {
1842                if (isOffCache[i][0] === node)
1843                {
1844                    return isOffCache[i][1];
1845                }
1846            }
1847
1848            nodeComputedStyle = nodeComputedStyle || elementDocument.defaultView.getComputedStyle(node);
1849
1850            var result = false;
1851
1852            if (nodeComputedStyle.display === 'none')
1853            {
1854                result = true;
1855            }
1856            else if (node.parentNode)
1857            {
1858                result = isOff(node.parentNode);
1859            }
1860
1861            isOffCache.push([node, result]);
1862
1863            return result;
1864        }
1865
1866        return function isUnavailable(node)
1867        {
1868            if (node === elementDocument.documentElement) return false;
1869
1870            var computedStyle = elementDocument.defaultView.getComputedStyle(node);
1871
1872            if (isOff(node, computedStyle)) return true;
1873
1874            return computedStyle.visibility === 'hidden';
1875        }
1876    }
1877
1878    var listeningFocusTrap = null;
1879
1880    // Create a focus trap on the supplied element.
1881    function focusTrap(element, userOptions)
1882    {
1883        var tabbableNodes = [];
1884        var firstTabbableNode = null;
1885        var lastTabbableNode = null;
1886        var nodeFocusedBeforeActivation = null;
1887        var active = false;
1888        var paused = false;
1889        var allowCallBackFunctions = true;
1890        var tabEvent = null;
1891
1892        // If the supplied element is a string, then get the document node from the string.
1893        // Otherwise, assume that the supplied element is a document node.
1894        var container = (typeof element === 'string')
1895            ? document.querySelector(element)
1896            : element;
1897
1898        // Set the config variable to the supplied userOptions or an empty object.
1899        var config = userOptions || {};
1900
1901        config.returnFocusOnDeactivate = (userOptions && userOptions.returnFocusOnDeactivate !== undefined)
1902            ? userOptions.returnFocusOnDeactivate
1903            : true;
1904
1905        config.escapeDeactivates = (userOptions && userOptions.escapeDeactivates !== undefined)
1906            ? userOptions.escapeDeactivates
1907            : true;
1908
1909        var trap = {
1910            'activate': activate,
1911            'deactivate': deactivate,
1912            'pause': pause,
1913            'unpause': unpause,
1914            'isActive': isActive,
1915            'stopCallBack': stopCallBack,
1916        };
1917
1918        return trap;
1919
1920        function isActive()
1921        {
1922            return active;
1923        }
1924
1925        function stopCallBack()
1926        {
1927            allowCallBackFunctions = false;
1928        }
1929
1930        function activate(activateOptions)
1931        {
1932            if (active) return;
1933
1934            var defaultedActivateOptions = {
1935                onActivate: (activateOptions && activateOptions.onActivate !== undefined)
1936                    ? activateOptions.onActivate
1937                    : config.onActivate,
1938            };
1939
1940            active = true;
1941            paused = false;
1942            nodeFocusedBeforeActivation = document.activeElement;
1943
1944            if (defaultedActivateOptions.onActivate)
1945            {
1946                defaultedActivateOptions.onActivate();
1947            }
1948
1949            addListeners();
1950            return trap;
1951        }
1952
1953        function deactivate(deactivateOptions)
1954        {
1955            if (!active) return;
1956
1957            var defaultedDeactivateOptions = {
1958
1959                returnFocus: (deactivateOptions && deactivateOptions.returnFocus !== undefined)
1960                    ? deactivateOptions.returnFocus
1961                    : config.returnFocusOnDeactivate,
1962
1963                onDeactivate: (deactivateOptions && deactivateOptions.onDeactivate !== undefined)
1964                    ? deactivateOptions.onDeactivate
1965                    : config.onDeactivate,
1966            };
1967
1968            removeListeners();
1969
1970            active = false;
1971            paused = false;
1972
1973            if (allowCallBackFunctions && defaultedDeactivateOptions.onDeactivate) {
1974                defaultedDeactivateOptions.onDeactivate();
1975            }
1976
1977            if (defaultedDeactivateOptions.returnFocus) {
1978                setTimeout(function () {
1979                tryFocus(nodeFocusedBeforeActivation);
1980                }, 0);
1981            }
1982
1983            return this;
1984        }
1985
1986        function pause()
1987        {
1988            if (paused || !active) return;
1989
1990            paused = true;
1991            removeListeners();
1992        }
1993
1994
1995        function unpause()
1996        {
1997            if (!paused || !active) return;
1998
1999            paused = false;
2000            addListeners();
2001        }
2002
2003        function addListeners()
2004        {
2005            if (!active) return;
2006
2007            // There can be only one listening focus trap at a time.
2008            if (listeningFocusTrap)
2009            {
2010                listeningFocusTrap.pause();
2011            }
2012
2013            listeningFocusTrap = trap;
2014
2015            updateTabbableNodes();
2016
2017            tryFocus(firstFocusNode());
2018
2019            document.addEventListener('focus', checkFocus, true);
2020            document.addEventListener('click', checkClick, true);
2021            document.addEventListener('mousedown', checkPointerDown, true);
2022            document.addEventListener('touchstart', checkPointerDown, true);
2023            document.addEventListener('keydown', checkKey, true);
2024
2025            return trap;
2026        }
2027
2028        function removeListeners()
2029        {
2030            if (!active || listeningFocusTrap !== trap) return;
2031
2032            document.removeEventListener('focus', checkFocus, true);
2033            document.removeEventListener('click', checkClick, true);
2034            document.removeEventListener('mousedown', checkPointerDown, true);
2035            document.removeEventListener('touchstart', checkPointerDown, true);
2036            document.removeEventListener('keydown', checkKey, true);
2037
2038            listeningFocusTrap = null;
2039
2040            return trap;
2041        }
2042
2043        function getNodeForOption(optionName)
2044        {
2045            var optionValue = config[optionName];
2046            var node = optionValue;
2047
2048            if (!optionValue)
2049            {
2050                return null;
2051            }
2052
2053            if (typeof optionValue === 'string')
2054            {
2055                node = document.querySelector(optionValue);
2056                if (!node)
2057                {
2058                    throw new Error('`' + optionName + '` refers to no known node');
2059                }
2060            }
2061
2062            if (typeof optionValue === 'function')
2063            {
2064                node = optionValue();
2065
2066                if (!node)
2067                {
2068                    throw new Error('`' + optionName + '` did not return a node');
2069                }
2070            }
2071
2072            return node;
2073        }
2074
2075        function firstFocusNode()
2076        {
2077            var node;
2078
2079            if (getNodeForOption('initialFocus') !== null)
2080            {
2081                node = getNodeForOption('initialFocus');
2082            }
2083            else if (container.contains(document.activeElement))
2084            {
2085                node = document.activeElement;
2086            }
2087            else
2088            {
2089                node = tabbableNodes[0] || getNodeForOption('fallbackFocus');
2090            }
2091
2092            if (!node)
2093            {
2094                throw new Error('You can\'t have a focus-trap without at least one focusable element.');
2095            }
2096
2097            return node;
2098        }
2099
2100
2101        // This needs to be done on mousedown and touchstart instead of click
2102        // so that it precedes the focus event
2103        function checkPointerDown(e)
2104        {
2105            if (config.clickOutsideDeactivates && !container.contains(e.target))
2106            {
2107                deactivate({ returnFocus: false });
2108            }
2109        }
2110
2111        function checkClick(e)
2112        {
2113            if (config.clickOutsideDeactivates) return;
2114            if (container.contains(e.target)) return;
2115            e.preventDefault();
2116            e.stopImmediatePropagation();
2117        }
2118
2119        function checkFocus(e)
2120        {
2121            if (container.contains(e.target)) return;
2122
2123            e.preventDefault();
2124            e.stopImmediatePropagation();
2125
2126            // Checking for a blur method here resolves a Firefox issue (#15)
2127            if (typeof e.target.blur === 'function') e.target.blur();
2128
2129            if (tabEvent)
2130            {
2131                readjustFocus(tabEvent);
2132            }
2133        }
2134
2135        function checkKey(e)
2136        {
2137            if (e.key === 'Tab' || e.keyCode === 9)
2138            {
2139                handleTab(e);
2140            }
2141
2142            if (config.escapeDeactivates !== false && isEscapeEvent(e))
2143            {
2144                deactivate();
2145            }
2146        }
2147
2148        function handleTab(e)
2149        {
2150            updateTabbableNodes();
2151
2152            if (e.target.hasAttribute('tabindex') && Number(e.target.getAttribute('tabindex')) < 0)
2153            {
2154                return tabEvent = e;
2155            }
2156
2157            e.preventDefault();
2158            var currentFocusIndex = tabbableNodes.indexOf(e.target);
2159
2160            if (e.shiftKey)
2161            {
2162                if (e.target === firstTabbableNode || tabbableNodes.indexOf(e.target) === -1)
2163                {
2164                    return tryFocus(lastTabbableNode);
2165                }
2166
2167                return tryFocus(tabbableNodes[currentFocusIndex - 1]);
2168            }
2169
2170            if (e.target === lastTabbableNode) return tryFocus(firstTabbableNode);
2171
2172            tryFocus(tabbableNodes[currentFocusIndex + 1]);
2173        }
2174
2175
2176        function updateTabbableNodes()
2177        {
2178            tabbableNodes = getTabbableNodes(container);
2179            firstTabbableNode = tabbableNodes[0];
2180            lastTabbableNode = tabbableNodes[tabbableNodes.length - 1];
2181        }
2182
2183        function readjustFocus(e)
2184        {
2185            if (e.shiftKey) return tryFocus(lastTabbableNode);
2186
2187            tryFocus(firstTabbableNode);
2188        }
2189    }
2190
2191    function isEscapeEvent(e)
2192    {
2193        return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
2194    }
2195
2196    function tryFocus(node)
2197    {
2198        if (!node || !node.focus) return;
2199
2200        if (node === document.activeElement)  return;
2201
2202        node.focus();
2203
2204        if (node.tagName.toLowerCase() === 'input')
2205        {
2206            node.select();
2207        }
2208    }
2209
2210    function updateShoppingCartNumProducts()
2211    {
2212        return;
2213        
2214        var localvalue = requestcount;
2215
2216        httpobject[localvalue] = newHttpReq();
2217        httpobject[localvalue].onreadystatechange = function(){
2218
2219            try
2220            {
2221                if(httpobject[localvalue].readyState == 4)
2222                {
2223                }
2224
2225                if(httpobject[localvalue].status == 200)
2226                {
2227                }
2228            }
2229            catch (e)
2230            {
2231                return;
2232            }
2233
2234            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
2235            {
2236                var response = JSON.parse(httpobject[localvalue].responseText);
2237
2238                if(document.getElementById('shoppingCartCounter'))
2239                {
2240                    document.getElementById('shoppingCartCounter').innerHTML = response.numProducts;
2241
2242                    if(response.numProducts > 0)
2243                    {
2244                        document.getElementById('shoppingCartCounter').style.display = 'inline-block';
2245                    }
2246                    else
2247                    {
2248                        document.getElementById('shoppingCartCounter').style.display = 'none';
2249                    }
2250                }
2251
2252            }
2253
2254
2255        };
2256
2257        var postString = '';
2258
2259        var url = "/queries/queryShoppingCartProductCount.php";
2260
2261        httpobject[localvalue].open('post',url,true);
2262        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
2263        httpobject[localvalue].send(postString);
2264
2265        requestcount += 1;
2266
2267        return;
2268    }
2269
2270    function createGlobalForegroundAndBackgroundDiv()
2271    {
2272        var newdiv;
2273        var cssstyle;
2274
2275        if(!document.getElementById('globalBackgroundDiv'))
2276        {
2277            // Background Div
2278            newdiv = document.createElement('div');
2279            cssstyle = 'position: fixed; box-sizing: border-box; z-index: 5000; left: 0px; top: 0px; width: 10px; height: 10px; background-color: #000000; visibility: hidden; opacity: 0.50; filter: alpha(opacity=50);';
2280            newdiv.id = 'globalBackgroundDiv';
2281            newdiv.setAttribute('style',cssstyle);
2282            newdiv.style.cssText = cssstyle;
2283            document.body.appendChild(newdiv);
2284        }
2285
2286        if(!document.getElementById('globalForegroundDiv'))
2287        {
2288            // Foreground Div
2289            newdiv = document.createElement('div');
2290            cssstyle = 'position: fixed; box-sizing: border-box; z-index: 5001; left: 0px; top: 0px; width: 10px; height: 10px; overflow: auto; padding: 0px; border: 1px solid #666666; background-color: #FFFFFF; visibility: hidden; box-shadow: 0px 0px 50px #000000; text-align: center;';
2291            newdiv.id = 'globalForegroundDiv';
2292            newdiv.setAttribute('style',cssstyle);
2293            newdiv.style.cssText = cssstyle;
2294            document.body.appendChild(newdiv);
2295
2296        }
2297
2298    }
2299
2300    function showGlobalForegroundAndBackgroundDiv()
2301    {
2302        var backgroundDiv = document.getElementById('globalBackgroundDiv');
2303        var foregroundDiv = document.getElementById('globalForegroundDiv');
2304
2305        backgroundDiv.style.width = '100%';
2306        backgroundDiv.style.height = '100%';
2307        backgroundDiv.style.visibility = 'visible';
2308
2309        var widthClient = parseInt(document.documentElement.clientWidth);
2310        var heightClient = parseInt(document.documentElement.clientHeight);
2311
2312        var widthTarget = Math.min(widthClient * 0.90, 1000);
2313        var heightTarget = Math.min(heightClient * 0.90, 1000 * heightClient / widthClient);
2314
2315        var offsetLeft = 0;
2316        var offsetTop = 0;
2317
2318        var offsetX = 0;
2319        var offsetY = 0;
2320
2321        foregroundDiv.style.width = widthTarget + 'px';
2322        foregroundDiv.style.height = heightTarget + 'px';
2323        foregroundDiv.style.visibility = 'visible';
2324        foregroundDiv.innerHTML = "<img src='/assets/images/Searching.gif' style='display: inline-block; margin-top: 20px;'>";
2325
2326        foregroundDiv.style.left = (offsetX + offsetLeft + parseInt((widthClient - widthTarget) / 2)) + 'px';
2327        foregroundDiv.style.top = (offsetY + offsetTop + parseInt((heightClient - heightTarget) / 2)) + 'px';
2328
2329    }
2330
2331
2332	function createGlobalForegroundAndBackgroundDiv2()
2333    {
2334        var newdiv;
2335        var cssstyle;
2336
2337        if(!document.getElementById('globalBackgroundDiv2'))
2338        {
2339            // Background Div
2340            newdiv = document.createElement('div');
2341            cssstyle = 'position: fixed; box-sizing: border-box; z-index: 5000; left: 0px; top: 0px; width: 10px; height: 10px; background-color: #000000; visibility: hidden; opacity: 0.50; filter: alpha(opacity=50);';
2342            newdiv.id = 'globalBackgroundDiv2';
2343            newdiv.setAttribute('style',cssstyle);
2344            newdiv.style.cssText = cssstyle;
2345            document.body.appendChild(newdiv);
2346        }
2347
2348        if(!document.getElementById('globalForegroundDiv2'))
2349        {
2350            // Foreground Div
2351            newdiv = document.createElement('div');
2352            cssstyle = 'position: fixed; box-sizing: border-box; z-index: 5001; left: 0px; top: 0px; width: 10px; height: 10px; overflow: auto; padding: 0px; border: 1px solid #666666; background-color: #FFFFFF; visibility: hidden; box-shadow: 0px 0px 50px #000000; text-align: center;';
2353            newdiv.id = 'globalForegroundDiv2';
2354            newdiv.setAttribute('style',cssstyle);
2355            newdiv.style.cssText = cssstyle;
2356            document.body.appendChild(newdiv);
2357
2358        }
2359
2360    }
2361
2362    function showGlobalForegroundAndBackgroundDiv2()
2363    {
2364        var backgroundDiv = document.getElementById('globalBackgroundDiv2');
2365        var foregroundDiv = document.getElementById('globalForegroundDiv2');
2366
2367        backgroundDiv.style.width = '100%';
2368        backgroundDiv.style.height = '100%';
2369        backgroundDiv.style.visibility = 'visible';
2370
2371        var widthClient = parseInt(document.documentElement.clientWidth);
2372        var heightClient = parseInt(document.documentElement.clientHeight);
2373
2374        var widthTarget = Math.min(widthClient * 0.90, 1000);
2375        var heightTarget = Math.min(heightClient * 0.90, 1000 * heightClient / widthClient);
2376
2377        var offsetLeft = 0;
2378        var offsetTop = 0;
2379
2380        var offsetX = 0;
2381        var offsetY = 0;
2382
2383        foregroundDiv.style.width = widthTarget + 'px';
2384        foregroundDiv.style.height = heightTarget + 'px';
2385        foregroundDiv.style.visibility = 'visible';
2386        foregroundDiv.innerHTML = "<img src='/assets/images/Searching.gif' style='display: inline-block; margin-top: 20px;'>";
2387
2388        foregroundDiv.style.left = (offsetX + offsetLeft + parseInt((widthClient - widthTarget) / 2)) + 'px';
2389        foregroundDiv.style.top = (offsetY + offsetTop + parseInt((heightClient - heightTarget) / 2)) + 'px';
2390
2391    }
2392	
2393
2394    function showGlobalEmailSubscriptionPopUp()
2395    {
2396        var widthClient = parseInt(document.documentElement.clientWidth);
2397        var heightClient = parseInt(document.documentElement.clientHeight);
2398
2399        var aspectRatio = widthClient / heightClient;
2400
2401        if(aspectRatio < 0.80)
2402        {
2403            showGlobalEmailSubscriptionScrollUp();
2404            return;
2405        }
2406        
2407        if(aspectRatio > 1.2 && heightClient < 600)
2408        {
2409            
2410            return;
2411        }        
2412        
2413        createGlobalForegroundAndBackgroundDiv();
2414        showGlobalForegroundAndBackgroundDiv();
2415
2416        var localvalue = requestcount;
2417
2418        httpobject[localvalue] = newHttpReq();
2419        httpobject[localvalue].onreadystatechange = function(){
2420
2421            try
2422            {
2423                if(httpobject[localvalue].readyState == 4)
2424                {
2425                }
2426
2427                if(httpobject[localvalue].status == 200)
2428                {
2429                }
2430            }
2431            catch (e)
2432            {
2433                return;
2434            }
2435
2436            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
2437            {
2438                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
2439
2440                document.getElementById('globalForegroundDiv').innerHTML = response[0];
2441                globalFocusTrap = focusTrap(document.getElementById('globalForegroundDiv'),{'clickOutsideDeactivates': true, 'initialFocus': '#subscriptionEmail', 'onDeactivate': function(){hideGlobalEmailSubscriptionPopUp()}});
2442                globalFocusTrap.activate();
2443                if(response[1])
2444                {
2445                    var responseData = JSON.parse(response[1]);
2446                }
2447            }
2448
2449
2450        };
2451
2452        var url = '/queries/queryGlobalEmailSubscriptionPopUp.php';
2453        var postString = 'action=refresh';
2454
2455        httpobject[localvalue].open('post',url,true);
2456        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
2457        httpobject[localvalue].send(postString);
2458
2459        requestcount += 1;
2460
2461        return;
2462    }
2463
2464
2465    function globalCheckForEnterEmailSubscription(e)
2466    {
2467        if(e.keyCode === 13)
2468        {
2469            e.preventDefault();
2470            e.stopImmediatePropagation();
2471
2472            globalSubmitEmailSubscription();
2473        }
2474    }
2475
2476
2477    function globalSubmitEmailSubscription()
2478    {
2479
2480        var localvalue = requestcount;
2481        var email = document.getElementById('subscriptionEmail').value;
2482
2483        if(email == '' || email == 'E-Mail Address')
2484        {
2485            alert('You must enter an e-mail address.');
2486            return;
2487        }
2488
2489        document.getElementById('submitsubscriptionDiv').innerHTML = "<img src='/assets/images/Searching.gif' style='display: inline-block; padding-top: 5px;'>";
2490
2491        httpobject[localvalue] = newHttpReq();
2492        httpobject[localvalue].onreadystatechange = function(){
2493
2494            try
2495            {
2496                if(httpobject[localvalue].readyState == 4)
2497                {
2498                }
2499
2500                if(httpobject[localvalue].status == 200)
2501                {
2502                }
2503            }
2504            catch (e)
2505            {
2506                return;
2507            }
2508
2509            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
2510            {
2511                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
2512
2513                document.getElementById('globalForegroundDiv').innerHTML = response[0];
2514
2515                if(response[1])
2516                {
2517                    var responseData = JSON.parse(response[1]);
2518                    if(responseData.hasOwnProperty('visitorData'))
2519                    {
2520                        window.dataLayer = window.dataLayer || [];
2521                        window.dataLayer.push({
2522                            'event': 'subscribe_to_email_list',
2523                            'eventCategory': 'newsletter',
2524                            'eventAction': 'subscribe',
2525                            'eventLabel': 'pop-up',
2526                            'eventValue': '',
2527                            'eventDescription': 'Subscribe to Newsletter',                            
2528                            'visitorEmail': email
2529                        });
2530                    }
2531                }
2532            }
2533        };
2534
2535        var url = '/queries/queryGlobalEmailSubscriptionPopUp.php';
2536        var postString = 'action=submit&email=' + email + '&sourcePage=' + window.location.pathname;
2537
2538        httpobject[localvalue].open('post',url,true);
2539        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
2540        httpobject[localvalue].send(postString);
2541
2542        requestcount += 1;
2543
2544        return;
2545
2546    }
2547
2548
2549    function showGlobalEmailSubscriptionScrollUp()
2550    {
2551        createGlobalForegroundAndBackgroundDiv();
2552        //showGlobalForegroundAndBackgroundDiv();
2553
2554        var foregroundDiv = document.getElementById('globalForegroundDiv');
2555
2556        var widthClient = parseInt(document.documentElement.clientWidth);
2557        var heightClient = parseInt(document.documentElement.clientHeight);
2558
2559        var aspectRatio = widthClient / heightClient;
2560
2561        if(aspectRatio > 1.2 && heightClient < 600)
2562        {
2563            return;
2564        }
2565
2566        var targetPercentage = 0.40;
2567
2568        if(aspectRatio < 0.80)
2569        {
2570            targetPercentage = 0.50;
2571        }
2572
2573        var heightTarget = parseInt(Math.min(heightClient * targetPercentage, 500));
2574
2575        foregroundDiv.style.setProperty('-webkit-transition', 'height 1.5s');
2576        foregroundDiv.style.backgroundColor = 'transparent';
2577        foregroundDiv.style.boxShadow = 'none';
2578        foregroundDiv.style.border = 'none';
2579        foregroundDiv.style.width = '100%';
2580        foregroundDiv.style.height = '0px';
2581        foregroundDiv.style.overflow = 'hidden';
2582        foregroundDiv.style.visibility = 'visible';
2583
2584        foregroundDiv.style.left = '0px';
2585        foregroundDiv.style.top = 'auto';
2586        foregroundDiv.style.bottom = '0px';
2587        foregroundDiv.style.height = heightTarget + 'px';
2588
2589        var localvalue = requestcount;
2590
2591        httpobject[localvalue] = newHttpReq();
2592        httpobject[localvalue].onreadystatechange = function(){
2593
2594            try
2595            {
2596                if(httpobject[localvalue].readyState == 4)
2597                {
2598                }
2599
2600                if(httpobject[localvalue].status == 200)
2601                {
2602                }
2603            }
2604            catch (e)
2605            {
2606                return;
2607            }
2608
2609            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
2610            {
2611                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
2612
2613                document.getElementById('globalForegroundDiv').innerHTML = response[0];
2614                //globalFocusTrap = focusTrap(document.getElementById('globalForegroundDiv'),{'clickOutsideDeactivates': true, 'initialFocus': '#subscriptionEmail', 'onDeactivate': function(){hideGlobalEmailSubscriptionPopUp()}});
2615                //globalFocusTrap.activate();
2616                if(response[1])
2617                {
2618                    var responseData = JSON.parse(response[1]);
2619                }
2620            }
2621
2622
2623        };
2624
2625        var url = '/queries/queryGlobalEmailSubscriptionScrollUp.php';
2626        var postString = 'action=refresh';
2627
2628        httpobject[localvalue].open('post',url,true);
2629        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
2630        httpobject[localvalue].send(postString);
2631
2632        requestcount += 1;
2633
2634        return;
2635    }
2636
2637
2638    function globalCheckForEnterEmailSubscriptionScrollUp(e)
2639    {
2640        if(e.keyCode === 13)
2641        {
2642            e.preventDefault();
2643            e.stopImmediatePropagation();
2644
2645            globalSubmitEmailSubscriptionScrollUp();
2646        }
2647    }
2648
2649
2650    function globalSubmitEmailSubscriptionScrollUp()
2651    {
2652
2653        var localvalue = requestcount;
2654        var email = document.getElementById('subscriptionEmail').value;
2655
2656        if(email == '' || email == 'E-Mail Address')
2657        {
2658            alert('You must enter an e-mail address.');
2659            return;
2660        }
2661
2662        document.getElementById('submitsubscriptionDiv').innerHTML = "<img src='/assets/images/Searching.gif' style='display: inline-block; padding-top: 5px;'>";
2663
2664        httpobject[localvalue] = newHttpReq();
2665        httpobject[localvalue].onreadystatechange = function(){
2666
2667            try
2668            {
2669                if(httpobject[localvalue].readyState == 4)
2670                {
2671                }
2672
2673                if(httpobject[localvalue].status == 200)
2674                {
2675                }
2676            }
2677            catch (e)
2678            {
2679                return;
2680            }
2681
2682            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
2683            {
2684                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
2685
2686                document.getElementById('globalForegroundDiv').innerHTML = response[0];
2687
2688                if(response[1])
2689                {
2690                    var responseData = JSON.parse(response[1]);
2691                    if(responseData.hasOwnProperty('visitorData'))
2692                    {
2693                        window.dataLayer = window.dataLayer || [];
2694                        window.dataLayer.push({
2695                            'event': 'subscribe_to_email_list',
2696                            'eventCategory': 'newsletter',
2697                            'eventAction': 'subscribe',
2698                            'eventLabel': 'scroll-up',
2699                            'eventValue': '',
2700                            'eventDescription': 'Subscribe to Newsletter',  
2701                            'visitorEmail': email
2702                        });
2703                    }
2704                }
2705            }
2706        };
2707
2708        var url = '/queries/queryGlobalEmailSubscriptionScrollUp.php';
2709        var postString = 'action=submit&email=' + email + '&sourcePage=' + window.location.pathname;
2710
2711        httpobject[localvalue].open('post',url,true);
2712        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
2713        httpobject[localvalue].send(postString);
2714
2715        requestcount += 1;
2716
2717        return;
2718
2719    }
2720
2721
2722	function showGlobalDiscountMessageScrollUp()
2723    {
2724		if(document.getElementById('globalForegroundDiv') && document.getElementById('globalForegroundDiv').style.visibility == 'visible')
2725		{
2726			return;
2727		}
2728		
2729		if(document.getElementById('buttonShowDiscountPopUp'))
2730		{
2731			document.getElementById('buttonShowDiscountPopUp').style.display = 'none';
2732		}
2733		
2734        createGlobalForegroundAndBackgroundDiv();
2735
2736		var backgroundDiv = document.getElementById('globalBackgroundDiv');
2737        var foregroundDiv = document.getElementById('globalForegroundDiv');
2738		
2739		backgroundDiv.style.zIndex = 100000;
2740		foregroundDiv.style.zIndex = 100001;
2741
2742        var widthClient = parseInt(document.documentElement.clientWidth);
2743        var heightClient = parseInt(document.documentElement.clientHeight);
2744
2745        var aspectRatio = widthClient / heightClient;
2746
2747        if(aspectRatio > 1.2 && heightClient < 600)
2748        {
2749            return;
2750        }
2751
2752		var entranceType = 'popup';
2753
2754		if(aspectRatio < 1)
2755		{
2756			entranceType = 'scroll';
2757		}
2758		
2759		//entranceType = 'scroll';
2760
2761		if(entranceType == 'scroll')
2762		{
2763            var cssStyle = 'position: fixed; box-sizing: border-box; left: 0px; top: 0px; width: 100%; height: 100%; background-color: #000000; z-index: 10000; opacity: 0.20; visibility: visible;';
2764            backgroundDiv.style.cssText = cssStyle;	
2765			backgroundDiv.onclick = function() {hideGlobalDiscountMessagePopUp()};
2766			
2767			var targetPercentage = 0.50;
2768
2769			if(aspectRatio < 0.80)
2770			{
2771				targetPercentage = 0.50;
2772			}
2773
2774			var heightTarget = parseInt(Math.min(heightClient * targetPercentage, 500)) + 'px';			
2775			
2776			foregroundDiv.style.backgroundColor = 'transparent';
2777			foregroundDiv.style.boxShadow = 'none';
2778			foregroundDiv.style.border = 'none';
2779			foregroundDiv.style.width = '100%';
2780			foregroundDiv.style.height = '0px';
2781			foregroundDiv.style.setProperty('-webkit-transition', 'height 1.5s');			
2782			foregroundDiv.style.overflow = 'hidden';
2783			foregroundDiv.style.visibility = 'visible';
2784			foregroundDiv.style.zIndex = 10001;
2785
2786			foregroundDiv.style.left = '0px';
2787			foregroundDiv.style.top = 'auto';
2788			foregroundDiv.style.bottom = '0px';
2789			foregroundDiv.style.height = heightTarget;			
2790        }
2791		
2792		if(entranceType == 'popup')
2793		{
2794			var backgroundDiv = document.getElementById('globalBackgroundDiv');
2795
2796            var cssStyle = 'position: fixed; box-sizing: border-box; left: 0px; top: 0px; width: 100%; height: 100%; background-color: #000000; z-index: 10000; opacity: 0.20;';
2797            backgroundDiv.style.cssText = cssStyle;			
2798			backgroundDiv.onclick = function() {hideGlobalDiscountMessagePopUp()};			
2799
2800			var cssStyle = "position: fixed; display: inline-flex; flex-direction: column; flex-wrap: nowrap; justify-content: center; align-items: center; box-sizing: border-box; z-index: 10001; top: 0px; left: 0px; width: 100%; height: 100%;";
2801			foregroundDiv.style.cssText = cssStyle;
2802			foregroundDiv.style.visibility = 'visible';
2803			foregroundDiv.onclick = function() {hideGlobalDiscountMessagePopUp()};		
2804
2805			
2806		}
2807		
2808
2809
2810        var localvalue = requestcount;
2811
2812        httpobject[localvalue] = newHttpReq();
2813        httpobject[localvalue].onreadystatechange = function(){
2814
2815            try
2816            {
2817                if(httpobject[localvalue].readyState == 4)
2818                {
2819                }
2820
2821                if(httpobject[localvalue].status == 200)
2822                {
2823                }
2824            }
2825            catch (e)
2826            {
2827                return;
2828            }
2829
2830            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
2831            {
2832                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
2833
2834                document.getElementById('globalForegroundDiv').innerHTML = response[0];
2835                //globalFocusTrap = focusTrap(document.getElementById('globalForegroundDiv'),{'clickOutsideDeactivates': true, 'initialFocus': '#subscriptionEmail', 'onDeactivate': function(){hideGlobalEmailSubscriptionPopUp()}});
2836                //globalFocusTrap.activate();
2837                if(response[1])
2838                {
2839                    var responseData = JSON.parse(response[1]);
2840                }
2841            }
2842
2843
2844        };
2845
2846        var url = '/queries/queryGlobalDiscountMessageScrollUp.php';
2847        var postString = 'action=refresh&entranceType=' + entranceType;
2848
2849        httpobject[localvalue].open('post',url,true);
2850        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
2851        httpobject[localvalue].send(postString);
2852
2853        requestcount += 1;
2854
2855        return;
2856    }
2857
2858
2859    function globalCheckForEnterDiscountMessageScrollUp(e)
2860    {
2861        if(e.keyCode === 13)
2862        {
2863            e.preventDefault();
2864            e.stopImmediatePropagation();
2865
2866            globalSubmitEmailDiscountMessageScrollUp();
2867        }
2868    }
2869
2870
2871    function globalSubmitEmailDiscountMessageScrollUp()
2872    {
2873
2874        var localvalue = requestcount;
2875        var email = document.getElementById('discountMessageEmail').value;
2876
2877        if(email == '' || email == 'E-Mail Address')
2878        {
2879            alert('You must enter an e-mail address.');
2880            return;
2881        }
2882		
2883		var widthClient = parseInt(document.documentElement.clientWidth);
2884        var heightClient = parseInt(document.documentElement.clientHeight);
2885
2886        var aspectRatio = widthClient / heightClient;
2887
2888		var entranceType = 'popup';
2889
2890		if(aspectRatio < 1)
2891		{
2892			entranceType = 'scroll';
2893		}		
2894		
2895		//entranceType = 'scroll';
2896
2897        document.getElementById('submitDiscountMessageEmailDiv').innerHTML = "<img src='/assets/images/Searching.gif' style='display: inline-block; padding-top: 5px;'>";
2898
2899        httpobject[localvalue] = newHttpReq();
2900        httpobject[localvalue].onreadystatechange = function(){
2901
2902            try
2903            {
2904                if(httpobject[localvalue].readyState == 4)
2905                {
2906                }
2907
2908                if(httpobject[localvalue].status == 200)
2909                {
2910                }
2911            }
2912            catch (e)
2913            {
2914                return;
2915            }
2916
2917            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
2918            {
2919                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
2920
2921                document.getElementById('globalForegroundDiv').innerHTML = response[0];
2922
2923                if(response[1])
2924                {
2925                    var responseData = JSON.parse(response[1]);
2926                    if(responseData.hasOwnProperty('visitorData'))
2927                    {
2928                        window.dataLayer = window.dataLayer || [];
2929                        window.dataLayer.push({
2930                            'event': 'subscribe_to_email_list',
2931                            'eventCategory': 'newsletter',
2932                            'eventAction': 'subscribe',
2933                            'eventLabel': 'scroll-up',
2934                            'eventValue': '',
2935                            'eventDescription': 'Subscribe to Newsletter',  
2936                            'visitorEmail': email
2937                        });
2938                    }
2939                }
2940            }
2941        };
2942
2943        var url = '/queries/queryGlobalDiscountMessageScrollUp.php';
2944        var postString = 'action=submit&email=' + email + '&sourcePage=' + encodeURIComponent(window.location.pathname + window.location.search) + '&entranceType=' + entranceType;
2945
2946        httpobject[localvalue].open('post',url,true);
2947        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
2948        httpobject[localvalue].send(postString);
2949
2950        requestcount += 1;
2951
2952        return;
2953
2954    }
2955
2956
2957    function hideGlobalDiscountMessagePopUp()
2958    {
2959		if(document.getElementById('popUpDiscountOuterDiv') && document.getElementById('popUpDiscountOuterDiv').getAttribute('data-email-sent') == 0 && document.getElementById('buttonShowDiscountPopUp'))
2960		{
2961			document.getElementById('buttonShowDiscountPopUp').style.display = 'inline-block';
2962			document.getElementById('buttonShowDiscountPopUp').style.width = '100px';
2963			document.getElementById('buttonShowDiscountPopUp').style.height = '100px';		
2964		
2965			// This forces the browser to recognize the element's initial size before changing it.
2966			void document.getElementById('buttonShowDiscountPopUp').offsetWidth;
2967		
2968			document.getElementById('buttonShowDiscountPopUp').style.width = '30px';
2969			document.getElementById('buttonShowDiscountPopUp').style.height = '30px';			
2970		
2971		}		
2972		
2973        hideGlobalForegroundAndBackgroundDiv();
2974
2975        document.getElementById('globalForegroundDiv').innerHTML = '&nbsp;';
2976
2977        if(typeof globalFocusTrap === 'object' && globalFocusTrap.isActive())
2978        {
2979            globalFocusTrap.stopCallBack();
2980            globalFocusTrap.deactivate();
2981        }
2982    }
2983	
2984
2985    function globalCheckForEnterEmailSubscriptionAddToCart(e)
2986    {
2987        if(e.keyCode === 13)
2988        {
2989            e.preventDefault();
2990            e.stopImmediatePropagation();
2991
2992            globalSubmitEmailSubscriptionAddToCart();
2993        }
2994    }
2995
2996
2997    function globalSubmitEmailSubscriptionAddToCart()
2998    {
2999        var localvalue = requestcount;
3000        var email = document.getElementById('addToCartEmail').value;
3001
3002        if(false && email == '')
3003        {
3004            alert('You must enter an e-mail address.');
3005            return;
3006        }
3007
3008        document.getElementById('submitSubscriptionDiv').innerHTML = "<img src='/assets/images/Searching.gif' style='display: inline-block; padding-top: 5px;'>";
3009
3010        httpobject[localvalue] = newHttpReq();
3011        httpobject[localvalue].onreadystatechange = function(){
3012
3013            try
3014            {
3015                if(httpobject[localvalue].readyState == 4)
3016                {
3017                }
3018
3019                if(httpobject[localvalue].status == 200)
3020                {
3021                }
3022            }
3023            catch (e)
3024            {
3025                return;
3026            }
3027
3028            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
3029            {
3030                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
3031
3032                document.getElementById('addToCartForegroundDiv').innerHTML = response[0];
3033
3034                if(response[1])
3035                {
3036                    var responseData = JSON.parse(response[1]);
3037
3038                    if(false && responseData.hasOwnProperty('visitorData'))
3039                    {
3040                        window.dataLayer = window.dataLayer || [];
3041                        window.dataLayer.push({
3042                            'event': 'subscribe_to_email_list',
3043                            'eventCategory': 'newsletter',
3044                            'eventAction': 'subscribe',
3045                            'eventLabel': 'add-to-cart',
3046                            'eventValue': '',
3047                            'eventDescription': 'Subscribe to Newsletter',
3048                            'visitorEmail': responseData.visitorData.email
3049                        });
3050                    }
3051
3052                    if(responseData && responseData.hasOwnProperty('ga4'))
3053                    {
3054                        window.dataLayer = window.dataLayer || [];
3055						window.dataLayer.push(responseData.ga4);
3056                    }
3057
3058                    if(true && responseData && responseData.hasOwnProperty('redirectUrl'))
3059                    {
3060                        if(responseData.redirectUrl !== '')
3061                        {
3062                            setTimeout(function(){window.location = responseData.redirectUrl}, 250);
3063                            return;
3064                        }
3065                    }
3066
3067                }
3068            }
3069        };
3070
3071        var url = '/queries/queryAddToCart.php';
3072        var postString = 'action=beginCheckoutWithEmail&email=' + email + '&sourcePage=' + window.location.pathname;
3073
3074        httpobject[localvalue].open('post',url,true);
3075        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
3076        httpobject[localvalue].send(postString);
3077
3078        requestcount += 1;
3079
3080        return;
3081
3082    }
3083
3084
3085    function hideGlobalForegroundAndBackgroundDiv()
3086    {
3087        document.getElementById('globalBackgroundDiv').style.visibility = 'hidden';
3088        document.getElementById('globalForegroundDiv').style.visibility = 'hidden';
3089    }
3090
3091    function hideGlobalForegroundAndBackgroundDiv2()
3092    {
3093        document.getElementById('globalBackgroundDiv2').style.visibility = 'hidden';
3094        document.getElementById('globalForegroundDiv2').style.visibility = 'hidden';
3095    }
3096
3097    function hideGlobalEmailSubscriptionPopUp()
3098    {
3099        hideGlobalForegroundAndBackgroundDiv();
3100
3101        document.getElementById('globalForegroundDiv').innerHTML = '&nbsp;';
3102
3103        if(typeof globalFocusTrap === 'object' && globalFocusTrap.isActive())
3104        {
3105            globalFocusTrap.stopCallBack();
3106            globalFocusTrap.deactivate();
3107        }
3108    }
3109
3110
3111    function showCookiePolicy()
3112    {
3113        if(!document.getElementById('globalForegroundCookieDiv'))
3114        {
3115            // Foreground Div
3116            newdiv = document.createElement('div');
3117            cssstyle = 'position: fixed; box-sizing: border-box; z-index: 5010; left: 0px; top: 0px; width: 10px; height: 10px; overflow: auto; padding: 0px; border: 1px solid #666666; background-color: #FFFFFF; visibility: hidden; box-shadow: 0px 0px 50px #000000; text-align: center;';
3118            newdiv.id = 'globalForegroundCookieDiv';
3119            newdiv.setAttribute('style',cssstyle);
3120            newdiv.style.cssText = cssstyle;
3121            document.body.appendChild(newdiv);
3122
3123        }
3124
3125        var foregroundDiv = document.getElementById('globalForegroundCookieDiv');
3126
3127        var widthClient = parseInt(document.documentElement.clientWidth);
3128        var heightClient = parseInt(document.documentElement.clientHeight);
3129
3130        var aspectRatio = widthClient / heightClient;
3131
3132        if(aspectRatio > 1.2 && heightClient < 600)
3133        {
3134            return;
3135        }
3136
3137        var targetPercentage = 0.40;
3138
3139        if(aspectRatio < 0.80)
3140        {
3141            targetPercentage = 0.50;
3142        }
3143
3144        var heightTarget = parseInt(Math.min(heightClient * targetPercentage, 500));
3145
3146        foregroundDiv.style.setProperty('-webkit-transition', 'height 1.5s');
3147        foregroundDiv.style.backgroundColor = 'transparent';
3148        foregroundDiv.style.boxShadow = 'none';
3149        foregroundDiv.style.border = 'none';
3150        foregroundDiv.style.width = '100%';
3151        foregroundDiv.style.height = 'auto';
3152        foregroundDiv.style.overflow = 'hidden';
3153        foregroundDiv.style.visibility = 'visible';
3154
3155        foregroundDiv.style.left = '0px';
3156        foregroundDiv.style.top = 'auto';
3157        foregroundDiv.style.bottom = '0px';
3158        //foregroundDiv.style.height = heightTarget + 'px';
3159
3160        //foregroundDiv.innerHTML = "<p style='color: #FFFFFF;'>This is a test.</p>\n";
3161        
3162        var localvalue = requestcount;
3163
3164        httpobject[localvalue] = newHttpReq();
3165        httpobject[localvalue].onreadystatechange = function(){
3166
3167            try
3168            {
3169                if(httpobject[localvalue].readyState == 4)
3170                {
3171                }
3172
3173                if(httpobject[localvalue].status == 200)
3174                {
3175                }
3176            }
3177            catch (e)
3178            {
3179                return;
3180            }
3181
3182            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
3183            {
3184                var response = httpobject[localvalue].responseText.split("--JSON_RESPONSE_DATA--");
3185
3186                document.getElementById('globalForegroundCookieDiv').innerHTML = response[0];
3187                //globalFocusTrap = focusTrap(document.getElementById('globalForegroundDiv'),{'clickOutsideDeactivates': true, 'initialFocus': '#subscriptionEmail', 'onDeactivate': function(){hideGlobalEmailSubscriptionPopUp()}});
3188                //globalFocusTrap.activate();
3189                if(response[1])
3190                {
3191                    var responseData = JSON.parse(response[1]);
3192                }
3193            }
3194
3195
3196        };
3197
3198        var url = '/queries/queryGlobalCookiePolicyScrollUp.php';
3199        var postString = 'action=refresh';
3200
3201        httpobject[localvalue].open('post',url,true);
3202        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
3203        httpobject[localvalue].send(postString);
3204
3205        requestcount += 1;
3206
3207        return;
3208    }    
3209    
3210
3211    function hideGlobalCookiePolicyPopUp()
3212    {
3213        document.getElementById('globalForegroundCookieDiv').style.visibility = 'hidden';
3214
3215        var localvalue = requestcount;
3216
3217        httpobject[localvalue] = newHttpReq();
3218        httpobject[localvalue].onreadystatechange = function(){
3219
3220            try
3221            {
3222                if(httpobject[localvalue].readyState == 4)
3223                {
3224                }
3225
3226                if(httpobject[localvalue].status == 200)
3227                {
3228                }
3229            }
3230            catch (e)
3231            {
3232                return;
3233            }
3234
3235            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
3236            {
3237
3238            }
3239
3240
3241        };
3242        
3243        var url = '/queries/queryGlobalCookiePolicyScrollUp.php';
3244        var postString = 'action=acceptCookies';
3245
3246        httpobject[localvalue].open('post',url,true);
3247        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
3248        httpobject[localvalue].send(postString);
3249
3250        requestcount += 1;        
3251        
3252    }    
3253    
3254    
3255    function updateCurrency()
3256    {
3257        var localvalue = requestcount;
3258        var currencyId = document.getElementById('currencyselectfooter').value;
3259
3260        httpobject[localvalue] = newHttpReq();
3261        httpobject[localvalue].onreadystatechange = function(){
3262
3263            try
3264            {
3265                if(httpobject[localvalue].readyState == 4)
3266                {
3267                }
3268
3269                if(httpobject[localvalue].status == 200)
3270                {
3271                }
3272            }
3273            catch (e)
3274            {
3275                return;
3276            }
3277
3278            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
3279            {
3280                var response = httpobject[localvalue].responseText;
3281                var responseData = JSON.parse(response);
3282
3283                if(responseData.hasOwnProperty('status'))
3284                {
3285                    if(responseData.status == 'success')
3286                    {
3287                        //window.scrollTo(0,0);
3288                        location.reload(true);
3289                    }
3290                    else
3291                    {
3292                        //console.log(responseData);
3293                    }                    
3294                }
3295                else
3296                {
3297                    //console.log(responseData);
3298                }               
3299            }
3300        };
3301
3302        var url = '/queries/queryUpdateCurrency.php';
3303        var postString = 'action=updateCurrency&currencyId=' + currencyId;
3304
3305        //alert(postString);
3306        
3307        httpobject[localvalue].open('post',url,true);
3308        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
3309        httpobject[localvalue].send(postString);
3310
3311        requestcount += 1;
3312
3313        return;
3314
3315    }
3316
3317    function updateMeasurementUnits()
3318    {
3319        var localvalue = requestcount;
3320        var measurementId = document.getElementById('unitsselectfooter').value;
3321
3322        httpobject[localvalue] = newHttpReq();
3323        httpobject[localvalue].onreadystatechange = function(){
3324
3325            try
3326            {
3327                if(httpobject[localvalue].readyState == 4)
3328                {
3329                }
3330
3331                if(httpobject[localvalue].status == 200)
3332                {
3333                }
3334            }
3335            catch (e)
3336            {
3337                return;
3338            }
3339
3340            if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
3341            {
3342                var response = httpobject[localvalue].responseText;
3343                var responseData = JSON.parse(response);
3344
3345                if(responseData.hasOwnProperty('status'))
3346                {
3347                    if(responseData.status == 'success')
3348                    {
3349                        //window.scrollTo(0,0);
3350                        location.reload(true);
3351                    }
3352                    else
3353                    {
3354                        //console.log(responseData);
3355                    }
3356                }
3357                else
3358                {
3359                    //console.log(responseData);
3360                }
3361            }
3362        };
3363
3364        var url = '/queries/queryUpdateMeasurementUnits.php';
3365        var postString = 'action=updateMeasurementUnits&measurementId=' + measurementId;
3366
3367        //alert(postString);
3368        
3369        httpobject[localvalue].open('post',url,true);
3370        httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
3371        httpobject[localvalue].send(postString);
3372
3373        requestcount += 1;
3374
3375        return;
3376
3377    }
3378    
3379    function goToUrl(url)
3380    {
3381		if(true)
3382		{
3383			var localvalue = requestcount;
3384			
3385			httpobject[localvalue] = newHttpReq();
3386			httpobject[localvalue].onreadystatechange = function(){
3387
3388				try
3389				{
3390					if(httpobject[localvalue].readyState == 4)
3391					{
3392					}
3393
3394					if(httpobject[localvalue].status == 200)
3395					{
3396					}
3397				}
3398				catch (e)
3399				{
3400					return;
3401				}
3402
3403				if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
3404				{
3405					var response = httpobject[localvalue].responseText;
3406					var responseData = JSON.parse(response);
3407
3408					if(responseData.hasOwnProperty('status'))
3409					{
3410						if(responseData.status == 'success')
3411						{
3412							window.location = responseData.url;
3413						}
3414						else
3415						{
3416							//console.log(responseData);
3417						}
3418					}
3419					else
3420					{
3421						//console.log(responseData);
3422					}
3423				}
3424			};
3425
3426			var targetUrl = '/queries/queryGoToUrl.php';
3427			var postString = 'url=' + encodeURIComponent(url);
3428
3429			httpobject[localvalue].open('post',targetUrl,true);
3430			httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
3431			httpobject[localvalue].send(postString);
3432
3433			requestcount += 1;
3434
3435			return;		
3436		}
3437		
3438        //window.location = url;
3439    }
3440	
3441	function goToUrl2023(e)
3442	{
3443		e = e || window.event;
3444		
3445		var targetElement = e.currentTarget;
3446
3447		if(targetElement.hasAttribute('data-target-url'))
3448		{
3449			var url = targetElement.getAttribute('data-target-url');
3450			
3451			if(true)
3452			{
3453				var localvalue = requestcount;
3454				
3455				httpobject[localvalue] = newHttpReq();
3456				httpobject[localvalue].onreadystatechange = function(){
3457
3458					try
3459					{
3460						if(httpobject[localvalue].readyState == 4)
3461						{
3462						}
3463
3464						if(httpobject[localvalue].status == 200)
3465						{
3466						}
3467					}
3468					catch (e)
3469					{
3470						return;
3471					}
3472
3473					if(httpobject[localvalue].readyState == 4 && httpobject[localvalue].status == 200)
3474					{
3475						var response = httpobject[localvalue].responseText;
3476						var responseData = JSON.parse(response);
3477
3478						if(responseData.hasOwnProperty('status'))
3479						{
3480							if(responseData.status == 'success')
3481							{
3482								window.location = responseData.url;
3483							}
3484							else
3485							{
3486								//console.log(responseData);
3487							}
3488						}
3489						else
3490						{
3491							//console.log(responseData);
3492						}
3493					}
3494				};
3495
3496				var targetUrl = '/queries/queryGoToUrl.php';
3497				var postString = 'url=' + encodeURIComponent(url);
3498
3499				httpobject[localvalue].open('post',targetUrl,true);
3500				httpobject[localvalue].setRequestHeader('content-type', 'application/x-www-form-urlencoded');
3501				httpobject[localvalue].send(postString);
3502
3503				requestcount += 1;
3504
3505				return;		
3506			}			
3507			
3508			//window.location = url;		
3509		}		
3510	}	
3511	
3512	//window.addEventListener('globalScriptLoaded', function(){alert('loaded')});
3513	
3514	
3515	var flagGlobalScriptLoaded = true;
3516	var newEvent = new Event('globalScriptLoaded');
3517	window.dispatchEvent(newEvent);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.