const IRPHeaderControls={bindHeaderControlEvents:function(){$(".header-container .mobile-menu-link").off("click").on("click",function(n){return n.preventDefault(),$(document).trigger("mobile-menu-toggled"),!1});$(".header-container .mobile-search").off("click").on("click",function(n){n.preventDefault();var t=$($(this).attr("data-search-element-selector"));t.hasClass("always-visible")||t.addClass("always-visible");t.is(":visible")?t.addClass("sliding").slideUp({progress:function(){$(document).trigger("mobile-height-adjusted")},complete:function(){t.removeClass("sliding");$(document).trigger("mobile-height-adjusted")}}):t.addClass("sliding").slideDown({progress:function(){$(document).trigger("mobile-height-adjusted")},complete:function(){t.removeClass("sliding");$(document).trigger("mobile-height-adjusted")}})});$(".header-container .site-settings-header-icon").each(function(){$(this).siteSettingsIcon()});$(".header-container .site-settings-container").each(function(){$(this).siteSettings()});$(".header-container .header-search-textbox").each(function(){$(this).searchTextBox()});$(window).on("scroll",function(){$(window).scrollTop()>=100?$(".header-logo").addClass("scrolling-logo"):$(".header-logo").removeClass("scrolling-logo");clearTimeout($.data(this,"scrollTimer"));$.data(this,"scrollTimer",setTimeout(function(){var n=$($(".header-container .mobile-search").attr("data-search-element-selector"));$(window).scrollTop()>=100?n.not(".always-visible, .sliding").slideUp({progress:function(){$(document).trigger("mobile-height-adjusted")},complete:function(){$(document).trigger("mobile-height-adjusted")}}):$(window).scrollTop()==0&&n.not(".always-visible, .sliding").slideDown({progress:function(){$(document).trigger("mobile-height-adjusted")},complete:function(){$(document).trigger("mobile-height-adjusted")}})},250))})},updateWishlistIcon:function(n){var t=$(".standard-component-container .wishlist-icon"),i,r;n>0?t.hasClass("has-items")||t.addClass("has-items"):t.removeClass("has-items");t.addClass("updated");i=0;r=t.css("animation-duration");r!==undefined&&(i=parseFloat(r.replace("s",""))*1e3);setTimeout(function(){t.removeClass("updated")},i)},updateBasketIcon:function(n){var u=parseInt($(".standard-component-container .header-container").find(".basket-count-updatable").eq(0).text()),t=$(".standard-component-container .header-container").find(".basket-icon"),i,r;n.BasketCount>0?t.hasClass("has-items")||t.addClass("has-items"):t.removeClass("has-items");parseInt(n.BasketCount)!=parseInt(u)&&(t.addClass("updated"),i=0,r=t.css("animation-duration"),r!==undefined&&(i=parseFloat(r.replace("s",""))*1e3),setTimeout(function(){t.removeClass("updated")},i))}};executeWhenjQueryAvailable(function(){$(document).ready(function(){IRPHeaderControls.bindHeaderControlEvents();$(document).on(IRPDocumentEvents.BasketUpdated,function(n,t){IRPHeaderControls.updateBasketIcon(t)});$(document).on("wishlist-updated",function(n,t){IRPHeaderControls.updateWishlistIcon(t)})})}),function(n){n.siteSettings=function(t){var u=this,i=n(t),f=i.find(".site-settings-currency"),r=f.find("select"),e=i.find(".site-settings-country input, .site-settings-country select"),o=i.find(".site-settings-language select"),s=i.find(".site-settings-vat-status select"),h=i.find(".site-settings-update");u.init=function(){u.bindControlEvents()};u.bindControlEvents=function(){e.on("change",function(){var t="",i;r!==undefined&&(t=r.val());t!==""&&(i={shippingCountryID:parseInt(n(this).val()),currencyISO:t},n.ajax({type:"POST",url:"/AjaxScripts/SiteSettings.aspx/GetCurrenciesDropDownForShippingCountry",data:JSON.stringify(i),contentType:"application/json; charset=utf-8",dataType:"json",cache:!1,async:!0,success:function(n){n.d!==undefined&&n.d!==null&&n.d!=""&&(f.html(n.d),r=f.find("select"),IRPStandardControls.bindChildStandardControls(f))}}))});h.on("click",function(t){var h,u;t.preventDefault();h=e.val();u="";r!==undefined&&(u=r.val());var l=o.val(),c=s.val(),f=n(this).attr("data-return-url"),i="/SetProperty.aspx?languageiso="+l;return u!==""&&(i+="&currencyiso="+u),i+="&shippingcountryid="+h,f!=""&&f!==null&&f!==undefined&&(i+="&returnurl="+escape(f)),c!==undefined&&(i+="&vatfree="+c),window.location.href=i,!1})};u.init()};n.fn.siteSettings=function(){return this.each(function(){if(undefined==n(this).data("siteSettings")){var t=new n.siteSettings(this);n(this).data("siteSettings",t)}})}}(jQuery),function(n){n.siteSettingsIcon=function(t){var i=this,r=n(t),u=r.data("ajax-refresh-url");i.init=function(){i.bindControlEvents()};i.bindControlEvents=function(){r.find(".site-settings-popup-link").off("click").on("click",function(t){var r,i,f;return t.preventDefault(),t.stopPropagation(),r=n(".site-settings-dialog"),i=n(this),r.length==0&&(f={targetControlID:i.attr("id"),isMobile:isMobile},n.ajax({type:"POST",url:u,data:JSON.stringify(f),contentType:"application/json; charset=utf-8",dataType:"json",cache:!1,async:!0,success:function(t){t.d!==undefined&&t.d!==null&&t.d!=""&&(i.after(t.d),IRPStandardControls.bindModalDialogs(),IRPStandardControls.bindChildStandardControls(n(".site-settings-dialog")),i.click(),n(".site-settings-container").each(function(){n(this).siteSettings()}))}})),!1})};i.init()};n.fn.siteSettingsIcon=function(){return this.each(function(){if(undefined==n(this).data("siteSettingsIcon")){var t=new n.siteSettingsIcon(this);n(this).data("siteSettingsIcon",t)}})}}(jQuery),function(n){n.searchTextBox=function(t){function v(n){if(n==null)return null;while(n.substring(0,1)==" ")n=n.substring(1,n.length);while(n.substring(n.length-1,n.length)==" ")n=n.substring(0,n.length-1);return n}function y(){return parseInt(v(f.val()).length)<o?(alert(s),!1):(u[0].submit(),!0)}var r=this,i=n(t),u=i.find(".search-form"),f=i.find(".search-textbox"),e=i.find(".search-button"),o=i.data("minimum-search-term-length"),s=i.data("minimum-search-error-message"),h=i.data("enable-predictive-search"),c=i.data("action-url"),l=i.data("language-iso"),a=i.data("number-of-results-to-cache");r.init=function(){r.bindControlEvents()};r.bindControlEvents=function(){if(o>0){f.on("keyup",function(n){if(n.keyCode==13)return n.returnValue=!1,!1});e.on("click",function(){return y()})}else{f.on("keyup",function(n){submitFormOnEnter(n,u.attr("name"))});e.on("click",function(){return u[0].submit(),!1})}h&&n.enableAutoComplete(f.attr("id"),i.attr("class"),u.attr("name"),c,l,a)};r.init()};n.fn.searchTextBox=function(){return this.each(function(){if(undefined==n(this).data("searchTextBox")){var t=new n.searchTextBox(this);n(this).data("searchTextBox",t)}})}}(jQuery)