PageSourceSearch

https://www.carecredit.com/sites/cc/js/header.js?v=1585054553000

js carecredit.com collected 2026-10-01 10:12:06 UTC 35,466 bytes, 848 lines download raw bytes

1// for login iframe to call
2function closeLogin() {
3    header.closeHeader(true);
4    $(".syf_login_container, .syf_login_iframe_container").removeClass('active');
5    $('html').css('overflow', 'inherit');
6    $('.signin-button').removeClass('active');
7    $('#syf_login_iframe').attr('src','').attr('src', $('#syf_login_iframe').attr('data-src'));
8    // $('#syf_login_iframe').removeAttr('src');
9}
10
11// new consumer site header and nav scripts
12var header = {
13
14    // checks if mobile or desktop functions should be enabled
15    checkMobileWidth: function () {
16        header.isMobileWidth = $('#mobile-nav-toggle:visible').length;
17    },
18    formatCategoryTitles: function() {
19        $('.sub-menu .categories-tiles > li').each(function() {
20            var categoryTitle = $(this).find('a').find('p');
21
22            if($(categoryTitle).html().indexOf('/') !== -1) {
23                var oldName = $(categoryTitle).html().split('/').join('/​');
24                $(categoryTitle).html(oldName);
25            }
26
27        });
28    },
29
30    buildFindLocationMenu: function() {
31        if(header.isMobileWidth){
32            $('.find-location.desktop').hide();
33            $('.find-location.mobile').css('display', 'block');;
34        }else{
35            $('.find-location.mobile').hide();
36            $('.find-location.desktop').css('display', 'flex');;
37        }
38    },
39
40    init: function () {
41        $(document).on('ready', function() {
42            $('#syf_login_iframe').attr('src', $('#syf_login_iframe').attr('data-src'));
43            var sPageURL = window.location.search.substring(1);
44            if(sPageURL && sPageURL.indexOf('show_cc_login_frame=Y') > -1) {
45                $(".desktop-only .homepage.signin-button").trigger('click');
46            }
47            //iFrameResize({       //1711 fixes
48               // maxWidth: 330,
49               // maxHeight: 568, 
50                //resizeFrom: 'child',         
51							// onResized: function(messageData){ //earlier commented
52							//     var ogHeight = 458;
53							//     var heightChangeDifference = messageData.height - ogHeight;
54							//     if(messageData.height == 539) {
55							//         //set button to match warning message
56							//         $('#close-login-btn').css('top', heightChangeDifference + 19);
57							//     } else if(heightChangeDifference < 5) {
58							//         //reset button to original position
59							//         $('#close-login-btn').css('top', 19);
60							//     }
61							// },//earlier commented
62               // onMessage: function(messageData) {
63                   // if(messageData.message == 'close') {
64                      //  header.closeHeader(true);
65                      //  $('.signin-button').focus();
66                   // }
67              //  }
68           // }, '#syf_login_iframe') // 1711 fixes
69        });
70
71        // set css var used to compensate for URL bar on mobile
72        var innerVH = window.innerHeight - $('.urgent-msg').height() - $('.main-header').height();
73        document.documentElement.style.setProperty('--innerVH', innerVH + 'px');
74
75        $(window).resize(function () {
76
77            var innerVHold = innerVH;
78            innerVH = window.innerHeight - $('.urgent-msg').height() - $('.main-header').height();
79            if (innerVHold !== innerVH) {
80                document.documentElement.style.setProperty('--innerVH', innerVH + 'px');
81            }
82            
83            oldMobileWidth = header.isMobileWidth;
84
85            header.checkMobileWidth();
86            if (oldMobileWidth !== header.isMobileWidth) {
87                if (header.isMobileWidth) {
88                    header.closeHeader(true);
89                } else {
90                    header.closeMobileNav();
91                    $('.mobile-login.signin-button').removeClass('active');
92                    $(".syf_login_container, .syf_login_iframe_container").removeClass('active');
93                }
94
95                header.buildFindLocationMenu();
96            }
97        });
98//Commented for 6386
99        // $('#close-login-btn').on('click keydown', function(e) {
100        //     e.preventDefault();
101
102        //     if(e.type === 'click' || (e.type === 'keydown' && e.which === 13)) {
103        //         closeLogin();
104        //         if(header.isMobileWidth) {
105        //             $('.mobile-login.signin-button').focus();
106        //         } else {
107        //             $('.desktop-only .signin-button').focus();
108        //         }
109        //     } else {
110        //         if(e.type === 'keydown' && e.which === 9) {
111        //             setTimeout(function() {
112        //                 $('#syf_login_iframe').get(0).focus();
113        //             }, 0);
114        //         }
115        //     }
116
117        //     return false;
118        // })
119
120
121        $('#provider-log').focusout(function(){
122           header.closeHeader(true);
123        });
124
125        // desktop doctor locator copy values into actual form
126        $('.dl-mirrored').change(function () {
127            var mirrorElement = '#' + $(this).attr('id').replace('-mirror', '');
128            $(mirrorElement).val($(this).val());
129        });
130        $('button.dl-mirrored').click(function () {
131            var mirrorElement = '#' + $(this).attr('id').replace('-mirror', '');
132            $(mirrorElement).click();
133        });
134		
135        $('#header-name').change(function () {
136            $('#header-name-mirror').val() = $('#header-name').val();
137        });
138
139        // close all overlays when background clicked
140        // $('#header-overlay').click(function () {
141        //     header.closeHeader(true);
142        // });
143
144        var $desktopSearchBtn = $('#desktop-submit-search');
145
146        // switch between search targets in desktop header
147        $('.desktop-search-container select').change(function() {
148            switch($(this).val()) {
149                case 'site':
150                    $desktopSearchBtn.attr('data-type', 'search-the-site');
151                    break;
152                case 'locations':
153                    $desktopSearchBtn.attr('data-type', 'by-practice-name');
154                    break;
155            }
156            var newContainer = '#search-container-' + $(this).val();
157            $('.search-container').fadeOut('fast', function() {
158                setTimeout(function() {
159                    $(newContainer).fadeIn().find('input').focus();;
160                }, 250);
161            });
162        });
163
164        // desktop header submit search on enter
165        $('.find-location-search input').keypress(function (e) {
166            if (e.which == 13) {
167                $(this).change();
168                $('#dl-find-button-mirror').click();
169            }
170        });
171
172        // desktop search handler
173        $('#desktop-submit-search').click(function() {
174            if ($('.desktop-search-container select').val() === 'locations') {
175                header.search($('#search-locations-mirror').val());
176            } else {
177                window.location.href = '/search/?search=' + $('#search-site-mirror').val();
178            }
179        });
180
181
182        $('.submit-mobile-search').click(function() {
183            window.location.href = '/search/?search=' + $('#search-site-alt').val();
184        });
185
186        // open sub menu on desktop
187        $('.has-sub-menu > a').not('.signin-button').focusin(function () {
188            if (!header.isMobileWidth) {
189                header.openSubMenu($(this).parent());
190            }
191        });
192
193
194        $(".desktop-only .homepage.signin-button").on('click keydown',function(e) {
195            // e.preventDefault();
196            if(e.type === 'click' || (e.type === 'keydown' && e.which === 13)) {
197                header.openSubMenu($(this).parent(), true);
198                $('#syf_login_iframe').focus();
199            }
200            return false;
201        });
202
203        $(".main-header > .mobile-only > *").on('click', function(e) {
204            e.preventDefault();
205            if($(e.target).hasClass('signin-button')) {
206                header.closeMobileNav();
207                $(e.target).toggleClass('active');
208                $(".syf_login_container, .syf_login_iframe_container").toggleClass('active');
209                $(document).find('#close-login-btn').focus();
210                $('html').css('overflow', 'hidden');
211            } else {
212                $('.mobile-login.signin-button').removeClass('active');
213                $(".syf_login_container, .syf_login_iframe_container").removeClass('active');
214                $('html').css('overflow', 'inherit');
215            }
216        });
217
218        function toggleEscKeyExit(e) {
219            var keyCode = e.keyCode || e.which;
220            if(keyCode == 27) {
221                $('#close-login-btn').trigger('click');
222                $('.signin-button').focus();
223            }
224        }
225        // $('#close-login-btn').on('focusout', function(e) {
226        //     $('#syf_login_iframe').focus();
227        // })
228
229        $('#syf_login_iframe').on('blur', function(e) {
230            $('#close-login-btn').focus();
231        });
232
233        $('.login-overlay, #refocus-iframe').on('focus', function(e){
234            $('.iframe-container').focus();
235        })
236
237        // $(".syf_login_iframe_container").on('keydown keyup', '#close-login-btn', function(e) { 
238        //     var keyCode = e.keyCode || e.which; 
239        //     if(e.type === 'keydown' && (e.shiftKey && keyCode == 9)) {
240        //         e.preventDefault();
241        //         $('#syf_login_iframe').focus();
242        //         return false;
243        //     }
244        //     if (e.type === 'keydown' && keyCode == 9) { 
245        //       e.preventDefault();
246        //       $('#syf_login_iframe').focus();
247        //       return false;
248        //     } else if (keyCode == 13 || keyCode == 27) { 
249        //         e.preventDefault();
250        //         header.closeHeader(true);
251        //         // header.toggleLoginForm();
252        //         $('.signin-button').focus();
253        //     } 
254        //   });
255
256        $('.has-sub-menu').not('.login-navlink').mouseenter(function () {
257            if (!header.isMobileWidth) {
258                var menuTrigger = $(this);
259                header.hoverDelay(menuTrigger, function() {
260                    header.openSubMenu(menuTrigger);
261                    if(menuTrigger.hasClass('categories-menu-trigger')){
262                        header.resizeTileMargins($('.categories-tiles').width())
263                    }
264                });
265            }
266        });
267        $('.sub-menu').mouseenter(function (e) {
268            e.stopPropagation();
269        });
270
271
272        // close sub menu on desktop
273        $('.close-sub-menu button.desktop-only').click(function (e) {
274            header.closeHeader(true);
275        })
276
277        // 'Find a Location' search
278        $('button.find-location-category').add('a.find-location-category').click(function (event) {
279		    event.preventDefault();
280            // if (!header.isMobileWidth)
281            // {
282                var specialtyName, specialtyID;
283                var specialties = $(this).parent().find('.find-location-specialty');
284
285                if (specialties.length === 1 && specialties.data('id') === $(this).data('id'))
286                {
287                    specialtyName = specialties.html();
288                    specialtyID = [specialties.data('id')];
289                }
290
291                header.search('', $(this).parents('.find-location-container').data('name'), '', specialtyName, specialtyID);
292            // }
293        });
294        $('button.view-all-specialties').click(function () {
295            header.search('', $(this).parents('.find-location-container').data('name'));
296        });
297        $('button.find-location-specialty').click(function () {
298            header.search('', $(this).parents('.find-location-container').data('name'), '', $(this).html(), [$(this).data('id')]);
299        });
300        $('a.find-location-specialty').click(function (event) {
301		    event.preventDefault();
302            header.search('find-location-specialty', $(this).parents('.find-location-container').data('name'), '', $(this).html(), [$(this).data('id')]);
303        });		
304        $('button.find-locations-all').click(function () {
305            header.search($(this).data('name'));
306        });
307
308        $('button.find-partner').click(function () {
309            if($(this).data('name')){
310                window.location = window.location.protocol +"//" + window.location.host + "/" + $(this).data('name') + "/";
311            }else{
312                window.location = window.location.protocol +"//" + window.location.host + "/about/#our-partners";
313            }
314        });
315
316
317						// show/hide mobile navi menu
318						//comment for mobile issue CC-1711
319      //$('#mobile-nav-toggle').click(function () { //comment for mobile issue CC-1711
320            //if ($(this).hasClass('active')) {
321								// if($('#maincontent .hero').hasClass('home')){
322								//     $('.urgent-container').css('display', 'block');
323								//     $('#maincontent').css('margin-top', '70px')
324								// }
325                //header.closeMobileNav();
326                //$('#mobile-nav-toggle').attr('aria-expanded', 'false');
327           // } else {
328									// if($('#maincontent .hero').hasClass('home')){
329									//     $('.urgent-container').css('display', 'none');
330									//     $('#maincontent').css('margin-top', '0px')
331									// }
332                //header.openMobileNav();
333               // $('#mobile-nav-toggle').attr('aria-expanded', 'true');
334           // }
335        //});
336	//comment for mobile issue CC-1711
337        // mobile focus trap
338        $('#mobile-focus-trap').focus(function () {
339            var tabbable = $('header .main-navi *:tabbable');
340            var lastTabbable = tabbable[tabbable.length - 2];
341            lastTabbable.focus();
342        });
343
344        // toggles dropdowns in mobile doctor search
345        $('header .mobile-search-options .toggle, #mobile-menu .mobile-search-options .toggle').click(function () {
346            if(!$(this).hasClass('inactive-option')) {
347                $(this).toggleClass('active');
348                $(this).siblings('.content').slideToggle('fast');
349            } else {
350                $(this).siblings('.content').slideUp('fast');
351            }
352        });
353
354        $('header #doctor-locator-form .input-container input').keyup(function () {
355            header.toggleLabel($(this));
356        });
357
358
359
360        $('header #doctor-locator-form .input-container select').change(function () {
361            header.toggleLabel($(this));
362        });
363        $('header #doctor-locator-form .input-container input, header #doctor-locator-form .input-container select').each(function () {
364            header.toggleLabel($(this));
365        });
366        $('#mobile-menu #doctor-locator-form-mobile .input-container input').keyup(function () {
367            header.toggleLabel($(this));
368        });
369        $('#mobile-menu #doctor-locator-form-mobile .input-container select').change(function () {
370            header.toggleLabel($(this));
371        });
372        $('#mobile-menu #doctor-locator-form-mobile .input-container input, #mobile-menu #doctor-locator-form-mobile .input-container select').each(function () {
373            header.toggleLabel($(this));
374        });
375        // interact with clickable menus using enter key
376        // $('.click-on-enter').keypress(function (e) {
377        //     if (e.which == 13) {
378        //         $(this).click();
379
380        //     }
381        // });
382
383        $('.mobile-search-options .click-on-enter').on('click', function(){
384            $(this).attr("aria-expanded", $(this).attr("aria-expanded")!='true');      
385        });
386
387        $('.mobile-search-options ul li').keypress(function (e) {
388            if (e.which == 13) {
389                $(this).children('input').click();
390            }
391        });
392
393
394        // first layer of mobile menus
395         $('.has-sub-menu > a, .mobile-search-icon').click(function (e) {
396            if (header.isMobileWidth) {
397                e.preventDefault();
398                if($(this).hasClass("mobile-search-icon")){
399                    $(".mobile-search-icon.blocker").css('display', 'block');
400                    header.openMobileNav();
401                    $(".mobile-search-icon.mobile-only").css('display', 'block');
402                }
403                header.openMobileMenu($(this));
404            }
405        });
406
407       $('.close-sub-menu .mobile-only').not('.mobile-search-icon').on('click', function () {
408            header.closeMobileMenu();
409        });
410        $('.mobile-search-buttons .cancel-search').on('click touchstart', function () {
411            header.closeMobileMenu();
412        });
413
414        // second layer of mobile menus
415        $('.open-mobile-sub-sub-menu').click(function () {
416            if (header.isMobileWidth) {
417                header.openMobileSubMenu($(this).siblings('.mobile-sub-sub-menu'));
418            }
419        });
420        $('.mobile-sub-sub-menu .back-button').click(function () {
421            header.closeMobileSubMenu();
422        });
423
424        $('#dl-profession').change(function () {
425            var specialties = $('ul.choose-specialties li');
426            var category = $(this).val();
427            specialties.find('input').prop('checked', false);
428            if (category === 'Any-Profession') {
429                specialties.slideDown('fast');
430            } else {
431                var newSpecialties = '[data-category="' + category + '"]';
432                specialties.not(newSpecialties).slideUp('fast');
433                specialties.filter(newSpecialties).slideDown('fast');
434            }
435        });
436
437        $('#dl-find-button').on('click touchstart', function () {
438            var locationName = '';
439            var params = {
440                Radius: $('#dl-radius').val(),
441                Sort: $('input[name=Sort]:checked').val(),
442                Spanish: $('#languages-spanish:checked').length,
443            };
444
445            if ($('#header-location').val()) {
446                if ($('#header-location').val().match(/^[0-9]+$/) !== null) {
447                    params.Zip = $('#doctor-locator-form .dl-input-zip').val();
448                    locationName = params.Zip;
449                } else {
450                    params.City  = $('#doctor-locator-form .dl-input-city').val();
451                    params.State = $('#doctor-locator-form .dl-input-state').val();
452                    locationName = (params.City + '-' + params.State).replace(' ', '-');
453                }
454                params.Lat  = $('#doctor-locator-form .dl-input-lat').val();
455                params.Long = $('#doctor-locator-form .dl-input-long').val();
456            }
457
458            if ($('#header-name-mirror').val()) {
459                header.search($('#header-name-mirror').val(), '', '', '', '', locationName, params);
460            } else {
461                header.search(
462                    $('#header-name').val(),
463                    $('#dl-profession option:selected').html(),
464                    $('#dl-profession').val(),
465                    $('.choose-specialties input:checked').first().data('name'),
466                    $('input[name=Specialty]:checked').map(function () { return $(this).val(); }).get(),
467                    locationName,
468                    params
469                );
470            }
471        });
472
473        $('.dynamic-label-trigger, #search-site, #search-site-alt').keyup(function () {
474            var element = $(this).attr('id');
475            var display = $(this).val() !== '';
476
477            $(this).toggleClass('show', display);
478            $('label[for=' + element + ']').toggleClass('show', display);
479        }).keyup();
480
481        $('#find-location-menu input').keyup(function () {
482            var element = $(this).attr('id');
483            var display = $(this).val() !== '';
484
485            $(this).toggleClass('active', display);
486            $('label[for=' + element + ']').toggleClass('active', display);
487        }).keyup();
488    },
489
490    // require the mouse to be hovering over ${hoverElement} for 250ms before activating ${callback}
491    hoverDelay: function (hoverElement, callback) {
492        setTimeout(function() {
493            if (hoverElement.is(":hover")) {
494                callback();
495            }
496        }, 250);
497    },
498
499    // search for doctor or provider (all arguements optional)
500    // ${keyword} = string to search for,  ${specialtyName} = name of main specialty (string), ${specialties} = array of specialty IDs
501    // ${categoryName} = string, ${categoryID} = (string) required to search with keyword + category,
502    // ${location} = object - contains extra parameters like lat/long/radius/spanish etc.
503    search: function (keyword, categoryName, categoryID, specialtyName, specialties, locationName, params) {
504        params = params || {};
505		if (typeof locationName === 'undefined') {
506		    if ( typeof $('#header-location').val() !== 'undefined' && $('#header-location').val().match(/^[0-9]+$/) !== null) {
507                params.Zip = getCookie('dl-zip') || $('#doctor-locator-form .dl-input-zip').val();
508				locationName = params.Zip;
509				
510            } else if(typeof $('#header-location-mirror').val() !== 'undefined' && $('#header-location-mirror').val().match(/^[0-9]+$/) !== null){
511				params.Zip = getCookie('dl-zip');
512				locationName = params.Zip;   
513				
514            }else{
515				params.City  = $('#doctor-locator-form .dl-input-city').val();
516                params.State = $('#doctor-locator-form .dl-input-state').val();
517                locationName = (params.City + '-' + params.State).replace(' ', '-');				
518			}			
519        }
520		locationName = locationName.replace(/undefined/g,"").replace(/ /g,"-");
521		
522        specialtyName = specialtyName || 'Any-Specialty';
523        // locationName = locationName || getCookie('dl-zip') || $('#find-location-menu').data('zip');
524        params.Radius = params.Radius || '5';
525        params.Sort = params.Sort || 'D';
526        params.Lat = params.Lat || getCookie('dl-lat');
527        params.Long = params.Long || getCookie('dl-long');
528        if (!categoryName || categoryName === 'Profession') {
529            categoryName = 'Any-Profession';
530        }
531
532        var url = '/doctor-locator/results/';
533
534        if (keyword === 'find-location-specialty'){
535			//logic for 
536			url += header.formatForSearch(categoryName) + '/' + header.formatForSearch(specialtyName) + '/?';
537		} else if (keyword) {
538        	keyword = keyword.replace(/ /g,"-");
539			url += keyword.replace(/\/|\?/g, '') + '/?';
540            if(locationName.match(/^[0-9]+$/) !== null) {
541                url += 'Zip=' + locationName + '&';
542            }
543            if (categoryID) url += 'Profession=' + categoryID + '&';
544        } else {
545            url += header.formatForSearch(categoryName) + '/' + header.formatForSearch(specialtyName) + '/' + locationName + '/?';
546        }
547
548        if (specialties) {
549            specialties.forEach(function(specialty) {
550                url += 'Specialty[]=' + specialty + '&';
551            });
552        }
553
554        Object.keys(params).forEach(function(param) {
555            if (params[param]) {
556                url += param + '=' + params[param] + '&';
557            }
558        })
559
560        if(categoryName === "Health Systems"){
561            url = "/health-systems";
562            if(specialtyName === "ABC Health Systems"){
563                url = "/abc";
564            }
565        }
566        
567        window.location.href = encodeURI(url);
568    },
569
570    // formats categories and specialties for use in search URL
571    // ${string} = name for formatting
572    formatForSearch: function (string) {
573        return string.replace(/[\W_]+(amp;)?[\W_]*/g, '-');
574    },
575
576    // toggles labels being shown above inputs
577    // ${element} = jQuery object of the input or select with correlating label
578    toggleLabel: function (element) {
579
580
581        var label = '#doctor-locator-form .input-container label[for="' + element.attr('id') + '"], #doctor-locator-form-mobile .input-container label[for="' + element.attr('id') + '"]';
582
583        $(label).add(element).toggleClass('show', !!element.val());
584    },
585    toggleLoginForm: function() {
586        if($('.login-navlink').hasClass('active')) {
587            // $('#syf_login_iframe').removeAttr('src').attr('src', $('#syf_login_iframe').attr('data-src'));
588            $(".syf_login_container, .syf_login_iframe_container").addClass('active');
589            //$('html').css('overflow', 'hidden');
590            $('.signin-button').attr('aria-expanded', 'true')
591            $('.syf_login_iframe_container').attr('aria-hidden', 'false');
592            //$('html').css('overflow', 'hidden');
593            //$('#header-overlay').addClass('login-overlay');
594            //$('body').addClass('modalOpen');
595            
596            $('html').css('overflow', 'inherit');
597            $('#header-overlay').removeClass('login-overlay');
598            $('body').removeClass('modalOpen');
599        } else {
600            $('.mobile-login.signin-button').removeClass('active');
601            $(".syf_login_container, .syf_login_iframe_container").removeClass('active');
602            //$('html').css('overflow', 'inherit');
603            $('.signin-button').attr('aria-expanded', 'false')
604            $('.syf_login_iframe_container').attr('aria-hidden', 'true');
605            //$('html').css('overflow', 'inherit');
606            //$('#header-overlay').removeClass('login-overlay');
607            //$('body').removeClass('modalOpen');
608            $('#syf_login_iframe').attr('src','').attr('src', $('#syf_login_iframe').attr('data-src'));
609        }
610    },
611
612    // opens sub menus for desktop nav
613    // ${subMenu} = jQuery object of the main nav link element
614    openSubMenu: function (subMenu, signUp) {
615        if (!subMenu.hasClass('active')) {
616            header.closeHeader();
617            $('#header-overlay').removeClass('login-overlay');
618            $('body').removeClass('modalOpen');
619            if(!signUp){
620               header.headerModal();
621               }
622            
623            $('#maincontent').attr('aria-hidden', 'true');
624            subMenu.addClass('active');
625            $('html').css('overflow', 'hidden');
626            if(!signUp) {
627                subMenu.find('.sub-menu').slideDown('fast');
628                subMenu.find('.sub-menu-container').css('top', header.subMenuOffset);
629            } else {
630                // $(".syf_login_container, .syf_login_iframe_container").toggleClass('active');
631                // $('#header-overlay').toggleClass('login-overlay');
632                // $('body').toggleClass('modalOpen');
633                // header.toggleLoginForm();
634            }
635            header.initalScroll = $(window).scrollTop();
636            $(window).scroll(header.scrollSubMenu);
637            subMenu.attr('aria-expanded', 'true');
638            header.toggleLoginForm();
639        }
640    },
641
642    scrollSubMenu: function (e) {
643        if(!$('.login-navlink').hasClass('active')){
644            var scrollAmount = header.initalScroll - $(window).scrollTop();
645
646            if (scrollAmount > 0) {
647                scrollAmount = 0;
648                header.initalScroll = $(window).scrollTop();
649            }
650
651            var subMenu = $('.sub-menu:visible');
652
653            subMenu.parent().css('top', scrollAmount + header.subMenuOffset );
654        }
655    },
656
657    // adjusts position of dropdown menu if emergency banner is present
658    emergencyBannerAdjust: function(){
659        var emergencyBannerOffset = 120;
660
661        if ($('.urgent-header').is(':visible')) {
662            emergencyBannerOffset += $('.urgent-header').height();
663
664            $('header .sub-menu-container').css('top', emergencyBannerOffset);
665        }
666
667        header.subMenuOffset = emergencyBannerOffset;
668
669        // var bannerTop = $('.urgent-header').length ? $('.urgent-header').height() : 0;
670        // bannerTop = bannerTop + 120;
671        // bannerTop = bannerTop.toString() + 'px';
672        // if($(window).width() > 1024){
673        //   $('.main-navi').find('.sub-menu').css('top', bannerTop);
674        // }else{
675        //   $('.main-navi').find('.sub-menu').css('top', "0px");
676        // }
677    },
678
679    resizeTileMargins: function(tileBoxWidth){
680        //204 size of one tile at 196px plus 8px of right margin (minimum right margin desired)
681        // var tilesPerRowDecimal  = tileBoxWidth / 204;
682        // var tilesPerRowWhole    = Math.floor(tilesPerRowDecimal);
683        // var remainingPixels     = tileBoxWidth - (196 * tilesPerRowWhole);
684        // //right margin would just be number from below equation but we need to account for the fact that end of row must be flush (so no right margin)
685        // var marginRight         = remainingPixels / tilesPerRowWhole;
686
687        // //divides margin that would have been used for final tile among other remaining tiles
688        // marginRight             = marginRight + (marginRight / (tilesPerRowWhole - 1));
689
690        // $('.categories-tiles li').css('margin-right', marginRight.toString() + 'px');
691        // //end of row should have 0 right margin for center
692        // $('.categories-tiles li:nth-child(' + tilesPerRowWhole + 'n )').css('margin-right', "0px");
693    },
694
695    // opens primary sub menus for mobile nav
696    // ${mobileMenu} = jQuery object of the main nav link element
697    openMobileMenu: function (mobileMenu) {
698        var subMenu = mobileMenu.hasClass("mobile-search-icon") ? $(".mobile-search-icon.sub-menu") : mobileMenu.siblings('.sub-menu-container').find('.sub-menu');
699        subMenu.show(0, function () {
700            $('.main-navi').addClass('sub-menu-open');
701            setTimeout(function () {
702                mobileMenu.parent('.has-sub-menu').siblings().hide();
703            }, 150);
704        });
705    },
706
707    // closes primary sub menus for mobile nav
708    closeMobileMenu: function () {
709        var parentLink = $(document.activeElement).parents('li').children('a');
710        $('.main-navi > ul > li').show(0, function () {
711            $('.main-navi').removeClass('sub-menu-open');
712            setTimeout(function () {
713                $('.sub-menu').hide();
714                parentLink.focus();
715            }, 150);
716        }).css('display', 'block');
717        $(".mobile-search-icon.mobile-only").css('display', 'none');
718        $(".mobile-search-icon.blocker").css('display', 'none');
719    },
720
721    // opens secondary menus for mobile nav
722    // ${mobileSubMenu} = jQuery object of the mobile submenu to open
723    openMobileSubMenu: function (mobileSubMenu) {
724        mobileSubMenu.show(0, function () {
725            $('.main-navi').addClass('sub-sub-menu-open');
726            setTimeout(function () {
727                mobileSubMenu.closest('li').siblings().hide();
728            }, 150);
729        });
730    },
731
732    // closes secondary menus for mobile nav
733    closeMobileSubMenu: function () {
734        $('.has-mobile-sub-sub-menu').children().show(0, function () {
735            $('.main-navi').removeClass('sub-sub-menu-open');
736            setTimeout(function () {
737                $('.mobile-sub-sub-menu').hide();
738            }, 150);
739        }).css('display', 'block');;
740    },
741
742    openMobileNav: function () {
743        $('#mobile-nav-toggle').addClass('active');
744        $('#maincontent').css('position', 'fixed');
745        $('#header-overlay, .main-navi').slideDown('fast');
746    },
747
748    // closes entire mobile nav
749    closeMobileNav: function () {
750        $('#mobile-nav-toggle').removeClass('active');
751        $('#maincontent').css('position', 'relative');
752        $('body').css('overflow', 'initial');
753        var visibleNav = '#header-overlay, ';
754        if ($('.mobile-partners:visible').length) {
755            visibleNav += '.mobile-partners:visible';
756        } else if ($('.sub-menu:visible').length) {
757            visibleNav += '.sub-menu:visible';
758        } else {
759            visibleNav += '.main-navi';
760        }
761        $(visibleNav).slideUp('fast', function () {
762            $('.main-navi, .sub-menu').hide();
763            header.closeMobileSubMenu();
764            header.closeMobileMenu();
765        });
766    },
767
768    // dims the background content when opening header menus
769    // ${closeOnFocus} = true/false (optional) - close menu when overlay recieves focus (eg. when tabbing)
770    headerModal: function () {
771        $('#header-overlay').fadeIn('fast');
772        $('#maincontent').attr('aria-hidden', 'true');
773    },
774
775    // closes desktop header menus
776    // ${removeOverlay} = true/false (optional) - removes dark overlay
777    closeHeader: function (removeOverlay) {
778        $('.desktop-search, .sub-menu').slideUp('fast');
779        $('.has-sub-menu').attr('aria-expanded','false');
780        $('.has-sub-menu').removeClass('active');
781        $('.main-header, .main-navi').attr('aria-hidden', 'false');
782        $('html').css('overflow', 'inherit');
783        if(!$('.login-navlink').hasClass('active')){
784            $(".syf_login_container, .syf_login_iframe_container").removeClass('active');
785            $('#header-overlay').removeClass('login-overlay');
786            $('body').removeClass('modalOpen');
787        }
788
789        $(window).off('scroll', header.scrollSubMenu);
790        if (removeOverlay) {
791            $('#header-overlay').fadeOut('fast');
792            $('#maincontent').attr('aria-hidden', 'false');
793            $('#header-overlay').off('focus');
794            // $('#syf_login_iframe').removeAttr('src');
795        }
796    }
797};
798
799$(function () {
800    header.emergencyBannerAdjust();
801    header.checkMobileWidth();
802    header.formatCategoryTitles();
803    header.buildFindLocationMenu();
804    header.init();
805	mobileMenuScaler();
806});
807
808function mobileMenuScaler(){
809    if(window.innerHeight == window.outerHeight){
810        $(".main-navi.container.desktop-force-block").removeClass("sub-height");
811    } else {
812        $(".main-navi.container.desktop-force-block").addClass("sub-height");
813    }
814}
815
816$(window).on('resize', function(){
817    if($('.categories-menu-trigger').hasClass('active')){
818        header.resizeTileMargins($('.categories-tiles').width());
819    }
820	mobileMenuScaler();
821    // header.emergencyBannerAdjust();
822});
823
824$(document).ready(function(){
825    $('[data-searchsection]').on('click',function(){
826        var dataSearchSection = $(this).data("searchsection");
827        sessionStorage.setItem("searchSection",dataSearchSection);
828    });
829	
830	//Urgent message
831
832	 $(".urgent-msg-open").click(function(){
833
834	 	if (!$(".urgent-popup").hasClass('active')){
835	 		$(".urgent-popup").addClass('active');
836	 		$(".urgent-popup").attr('aria-hidden','false');
837	 		$('body').css('overflow','hidden');
838	 		$(".urgent-popup-contents").css('marginTop',$(window).height()*0.2);
839	 	}
840	 })
841	 $(".urgent-closer").click(function(){
842	 	if ($(".urgent-popup").hasClass('active')){
843	 		$(".urgent-popup").removeClass('active');
844	 		$(".urgent-popup").attr('aria-hidden','true');
845	 		$('body').css('overflow','auto');
846	 	}
847	 })
848});

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.