$(document).ready(function(e) { if($(window).width() <= 990){ $("#kv").addClass("container-fulid"); $("#kv").removeClass("container"); } if($(window).width() <= 767){ } if($(window).width() <= 999){ } $('#urlpolicy').on('click', function () { $('#myModal').toggle(); }); $('#myModal').on('click', function () { var target = $( event.target ); if ( target.is( "#myModal" ) ) { $('#myModal').hide(); } }); $(".modal-content .close").on('click', function () { $('#myModal').hide(); }); $('#tnctri').on('click', function () { event.preventDefault(); $('#tnc').slideToggle(); }); $('.subtabbtn').on('click', function () { $('.subtabbtn').find('a').removeClass('active'); $(this).find('a').toggleClass('active'); }); }); $(window).on('resize', function(){ if($(window).width() <= 990){ $("#kv").addClass("container-fulid"); $("#kv").removeClass("container"); }else if($(window).width() >= 991){ $("#kv").addClass("container"); $("#kv").removeClass("container-fulid"); } if($(window).width() <= 999){ } if($(window).width() <= 767){ }else{ } if($(window).width() <= 999){ }else{ } }); function closeFancy(){ $.fancybox.close(); } // Batch 2 START HW.HeaderLogin = { config:{ idLogin:"jsHeaderLogin", classLogin:"jsHeaderLogin", classButton:"jsHeaderLoginButton", classSelected:"jsHeaderLoginSelected" }, hideMenu:function(params){ var config = this.config; var login = params.login || []; var menu = params.menu || []; // no progress if login or menu does not exist if(!login.length || !menu.length) return; login.removeClass(config.classSelected); menu.hide(); }, showMenu:function(params){ var config = this.config; var login = params.login || []; var menu = params.menu || []; // no progress if login or menu does not exist if(!login.length || !menu.length) return; login.addClass(config.classSelected); menu.show(); }, init:function(){ var self = this; var config = self.config; var login = $("#"+config.idLogin); // check if header login exists if(!login.length) return; login.addClass(config.classLogin); var button = login.find("."+config.classButton); var menu = login.find("ul"); // check if the login submenu exists if(!menu.length || !button.length) return; // hide the menu initially menu.hide(); button.click(function(e){ e.preventDefault(); // stop propagation so the body click event will not be triggered e.stopPropagation(); if(login.hasClass(config.classSelected)){ self.hideMenu({login:login,menu:menu}); }else{ self.showMenu({login:login,menu:menu}); } }); var $body = $("body"); login.focusin(function(e){ // close menu when the user no longer focus on the header login $body.one("click",function(e){ self.hideMenu({login:login,menu:menu}); }); var closeMenu = function(e){ e.stopPropagation(); var target = $(e.target).closest("#"+config.idLogin); if(target.length == 0){ killEvent(); self.hideMenu({login:login,menu:menu}); } }; var killEvent = function(e){ // $body.die("focusin",closeMenu); $body.off("focusin",closeMenu); } // $body.live("focusin",closeMenu); $body.on("focusin",closeMenu); }); } }; $(document).ready(function(){ // scripts for all pages HW.HeaderLogin.init(); }); HW.MainNavigation = { config:{ idMainNav:"jsMainNav", idSubNav:"jsSubNav", classMenu:"jsMenu", classMenuContainer:"jsMenuContainer", classHighlight:"jsHighlight", classCurrent:"current" }, removeHighlight:function(params){ var collection = params.collection || []; var config = this.config; collection.each(function(){ $(this).removeClass(config.classHighlight); }); }, init:function(){ var self = this; var config = self.config; var mainNav = $("#"+config.idMainNav); var subNav = $("#"+config.idSubNav); // check if any of main navigation or sub navigation does not exist if(!mainNav.length || !subNav.length) return; var mainMenus = mainNav.find("."+config.classMenu); var subMenus = subNav.find("."+config.classMenu); var menuContainer = mainNav.find("."+config.classMenuContainer); // does not progress further if there is no sub navigation or no menu container if(!subMenus.length || !menuContainer.length) return; // check if the browser is IE7 or under var isTargetIE = (navigator.userAgent.toLowerCase().indexOf("msie")!=-1 && navigator.userAgent.toLowerCase().match(/msie (\d+)/)[1] < 8) // add decor to the last sub menu subMenus.filter(":last").find(".content").append($('')); // move non-current sub menus as corresponding sub menus of the main navigation subMenus.each(function(){ var subMenuItem = $(this); if(!subMenuItem.hasClass(config.classCurrent)){ // find the identifier by pattern matching var itemIdentifier = subMenuItem.attr("class").match(/menu[1-9]/); // get the target container and move the subment to the target var target = menuContainer.filter("."+ itemIdentifier); var contentToAdd; if(target.length){ contentToAdd = $(''); if(isTargetIE){ contentToAdd = $(''); } // set the width to avoid IE display inproperly contentToAdd.find("ul").css({ width:subMenuItem.innerWidth() }); if(isTargetIE){ contentToAdd.find("iframe").css({width:subMenuItem.innerWidth()+20, height:subMenuItem.innerHeight()+24}); } target.append(contentToAdd); subMenuItem.remove(); } } }); // setup highlight on main nav mainMenus.each(function(){ var mainMenuItem = $(this); mainMenuItem.bind("mouseenter", function(e){ mainMenuItem.addClass(config.classHighlight); if(isTargetIE){ mainMenuItem.find("iframe").css({height:mainMenuItem.find(".subMenu").height()-18}); } }); mainMenuItem.bind("mouseleave", function(e){ mainMenuItem.removeClass(config.classHighlight); }); mainMenuItem.bind("focusin", function(e){ if(!mainMenuItem.hasClass(config.classHighlight)){ self.removeHighlight({collection:mainMenus}); mainMenuItem.addClass(config.classHighlight); if(isTargetIE){ mainMenuItem.find("iframe").css({height:mainMenuItem.find(".subMenu").height()-18}); } } }); mainMenuItem.bind("focusout", function(e){ // prevent main menu receiving focusout e.stopPropagation(); }); }); // clear highlight when the user is no longer focus on the main nav mainMenus.focusout(function(e){ self.removeHighlight({collection:mainMenus}); }); } }; $(document).ready(function(){ // scripts for all pages HW.HeaderLogin.init(); HW.MainNavigation.init(); }); // Batch 2 END