document.addEventListener('DOMContentLoaded', function () { jQuery('.navbar-toggler-switch').on('click', function () { jQuery(this).toggleClass('is-active'); jQuery('body').toggleClass('stop-scrolling'); jQuery('header.relaunch, body').toggleClass('menu-active'); if (jQuery('#subnavi-M-location, #subnavi-M-search').hasClass('show')) { jQuery('#subnavi-M-location, #subnavi-M-search').removeClass('show') } }); }); var horNavigation = {}; document.addEventListener('DOMContentLoaded', function () { // used for level-1 horNavigation = { saveScrollY: 0, saveScrollYLastTime: 0, ignoreMouse: false, timeoutWithinMenu: 5, timeoutFromOutside: 500, timeoutClose: 250, timeoutSaveScrollY: 500, // timeoutSaveScrollY should always be higher than timeoutRestoreScrollpos timeoutRestoreScrollpos: 250, activateRow: function (row) { if (true === horNavigation.ignoreMouse) { return; } if (false === horNavigation.isDesktop()) { return; } $(row).find('.dropdown-menu').first().addClass('show'); }, deactivateRow: function (row) { if (true === horNavigation.ignoreMouse) { return; } if (false === horNavigation.isDesktop()) { return; } $(row).find('.dropdown-menu').first().removeClass('show'); }, enableMenu: function() { horNavigation.ignoreMouse = false; }, disableMenu: function() { horNavigation.ignoreMouse = true; }, saveCurrentScrollpos: function() { var scrollTimeout = horNavigation.timeoutSaveScrollY; var currentTimestamp = new Date().getTime(); if (currentTimestamp - horNavigation.saveScrollYLastTime < scrollTimeout) { return; } horNavigation.saveScrollYLastTime = currentTimestamp; if ('pageYOffset' in window) { horNavigation.saveScrollY = window.pageYOffset; } }, restoreScrollpos: function() { setTimeout(function() { window.scrollTo(0, horNavigation.saveScrollY); setTimeout(function() { $('header.relaunch').removeClass('navbar-scroll'); }, 150); }, horNavigation.timeoutRestoreScrollpos); }, initialize: function () { horNavigation.saveScrollYLastTime = new Date().getTime(); $('header.relaunch').bind('mouseenter', function() { horNavigation.saveCurrentScrollpos(); }); // follow link in first level item but don't use item as toggle $(".level-1 > a.nav-link").click(function(e) { var href = $(this).attr('href'); if ('#' !== href) { if (false === $(this).hasClass('with-target-blank')) { window.location.href = href; } } else { e.preventDefault(); e.stopPropagation(); } }); // do not toggle show class on desktop in first level menu $(".level-1 > .dropdown").click(function(e) { if (true === horNavigation.isDesktop()) { e.preventDefault(); } }); // no toggling for nav-links that are no link $(".level-2 .nav-link").click(function(e) { if (false === $(this).is('a')) { e.preventDefault(); e.stopPropagation(); } }); // mobile $(".level-2 .dropdown-toggle").click(function(e) { if (false === horNavigation.isDesktop()) { e.preventDefault(); e.stopPropagation(); $(this).siblings('.dropdown-menu').toggleClass('show') $(this).toggleClass('show'); } }); var subMenus = $(".dropdown-menu.level-2 ul"); subMenus.menuAim({ tolerance: 250, activate: horNavigation.activateRow, deactivate: horNavigation.deactivateRow }); var navItems = jQuery('#navbarSupportedContent > ul').first().children('li'); closeDelayTimer = []; openTimer = null; navItems.each(function (index, elem) { var $elem = $(elem); $elem.on('mouseenter', function () { if (false === horNavigation.isDesktop()) { return; } if (true === horNavigation.ignoreMouse) { return; } window.clearTimeout(openTimer); // special case for level-1 menu items without submenu if (true === $elem.hasClass('level-1') && false === $elem.hasClass('has-subpages')) { $('#navbarSupportedContent').find('.level-2').removeClass('show'); } var timeoutOpen = jQuery('#navbarSupportedContent > ul').children('li').hasClass('hover') ? horNavigation.timeoutWithinMenu : horNavigation.timeoutFromOutside; //horNavigation.closeSubmenus(); if (closeDelayTimer[index]) { window.clearTimeout(closeDelayTimer[index]); closeDelayTimer[index] = false; } $elem.addClass('hover mouseover'); openTimer = setTimeout(function() { window.clearTimeout(openTimer); if ($elem.hasClass('dropdown')) { $('#menu-background').addClass('show') } else { $('#menu-background').removeClass('show') } $('body').addClass('stop-scrolling'); if ($(this).hasClass('hover')) { $(this).children('.dropdown-menu').addClass('show'); } }.bind(elem), timeoutOpen); //$elem.children('.dropdown-menu').addClass('show') }); $elem.on('mouseleave', function () { if (false === horNavigation.isDesktop()) { return; } if (true === horNavigation.ignoreMouse) { return; } window.clearTimeout(openTimer); $elem.removeClass('mouseover'); if ($elem.hasClass('hover')) { closeDelayTimer[index] = window.setTimeout( function () { var $currentMouseover = $elem .siblings('.mouseover') .first(); $elem.removeClass('hover'); $elem.children('.dropdown-menu').removeClass('show'); if ($currentMouseover.length > 0) { $currentMouseover.addClass('hover'); } else { horNavigation.closeSubmenus(); } }, horNavigation.timeoutClose ); } }); }); // remove all show classes when button close is clicked jQuery('#navbarSupportedContent button.close').on('click', function () { horNavigation.closeSubmenus(); horNavigation.closeMenuBackground(); }) }, closeMenuBackground: function() { $('#menu-background').removeClass('show'); $('body').removeClass('stop-scrolling'); horNavigation.restoreScrollpos(); }, closeSubmenus: function () { jQuery('#navbarSupportedContent .level-1 .dropdown-menu').removeClass('show'); if (jQuery('#navbarSupportedContent .level-1').hasClass('hover') || jQuery('#navbarSupportedContent .level-1').hasClass('mouseover')) { // leave menu background open } else { horNavigation.closeMenuBackground(); } }, isDesktop: function () { return $('body').hasClass('is-desktop'); } }; horNavigation.initialize(); }); !(function (window, $, hor) { horHeader = { timeout: 0, resizing: false, initialize: function () { $(window).on('resize', function() { if (false === horHeader.resizing) { horHeader.resizing = true; setTimeout(function() { horHeader.resizing = false; horHeader.initialize(); },350); } }); $(window).off('scroll.horiba'); $(document).ready(function () { var c, currentScrollTop = 0, navbar = $('nav'); $(window).on('scroll.horiba', function () { var header = nav = $('header.relaunch'); var a = $(window).scrollTop(); var b = navbar.height(); currentScrollTop = a; if (!header.hasClass('navbar-blocker')) { if (c < currentScrollTop && a > b + b) { header.addClass('navbar-scroll'); //nav.addClass('navbar-opacity'); } else if (c > currentScrollTop && !(a <= b)) { header.removeClass('navbar-scroll'); //nav.removeClass('navbar-opacity'); } if (a === 0) { //nav.addClass('navbar-opacity'); } } c = currentScrollTop; }); }); } }; horHeader.initialize(); })(window, jQuery); jQuery(document).ready(function () { horHeader.initialize(); }); $(document).ready(function () { let processLangFromCookie = function(countrySelect) { let currentLang = horCountrySwitcher.getCookie(horCountrySwitcher.cookieNameCountry); if ('string' === typeof currentLang && $('[data-isocode="' + currentLang.toUpperCase() + '"]').val()) { country_id = $('[data-isocode="' + currentLang.toUpperCase() + '"]').val(); countrySelect.val(country_id).change(); } } $.exists = function (selector) { return (selector.length > 0); } $countrySelect = $('.request_for_information-country'); if ($.exists($countrySelect)) { //Get browser language var language = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage); if (language.length === 5) { var country_code = language.substring(3, 6), fallback_country_code = language.substring(0, 2).toUpperCase(); } else { country_code = language.toUpperCase(); } var country_id = $('[data-isocode="' + country_code + '"]').val() || $('[data-isocode="' + fallback_country_code + '"]').val(); // additional check for country from akamai if ('object' === typeof horCountrySwitcher) { let currentLang = horCountrySwitcher.getCookie(horCountrySwitcher.cookieNameCountry); if ('string' === typeof currentLang && $('[data-isocode="' + currentLang.toUpperCase() + '"]').val()) { country_id = $('[data-isocode="' + currentLang.toUpperCase() + '"]').val(); } if (null === currentLang) { // language wasn't resolved up to now. Try again with a delay setTimeout(function() { processLangFromCookie($countrySelect); }, 1000); } } if ((typeof country_id !== 'undefined')) { $countrySelect.val(country_id).change(); } } });