1/*************************************************************** 2* 3* ActinicCore.js - core utility functions 4* 5* Copyright (c) 2014 SellerDeck Limited 6* 7****************************************************************/ 8var bPageIsLoaded=!1;function setCookie(e,t,r){var i=e+"="+escape(t)+"; path=/";return r&&(i+="; expires="+r.toGMTString()),i+="; SameSite=Lax",document.cookie=i,null}function getCookie(e){for(var t=document.cookie.split("; "),r,i=0;i<t.length;i++)if(r=t[i].split("="),r[0]==e)return unescape(r[1]);return null}function saveReferrer(){if("ActPopup"!=window.name){var e=!1;if(0==parent.frames.length)e=!0;else{for(var t=!1,r=parent.frames.length;r>0;r--)if("CatalogBody"==parent.frames[r-1].name){t=!0;break}t?"CatalogBody"==window.name&&(e=!0):e=!0}if(e){var i=document.URL,n=i.lastIndexOf("#"),a=i.lastIndexOf("#SID=");n>0&&-1==a&&(i=i.substring(0,n)),setCookie("ACTINIC_REFERRER",i)}return null}}function CreateArray(e){this.length=e;for(var t=1;t<=e;t++)this[t]=new Section;return this}function Section(){this.sURL=null,this.sName=null,this.sImage=null,this.nImageWidth=null,this.nImageHeight=null,this.nSectionId=null,this.pChild=null}function SwapImage(e,t){var r=0;document.aSource=new Array,null!=document[e]&&(document.aSource[r++]=document[e],null==document[e].sOldSrc&&(document[e].sOldSrc=document[e].src),document[e].src=t)}function RestoreImage(){var e,t=document.aSource;if(null!=t)for(e=0;e<t.length;e++)null!=t[e]&&null!=t[e].sOldSrc&&(t[e].src=t[e].sOldSrc)}function PreloadImages(){if(bPageIsLoaded=!0,document.images){document.Preloaded||(document.Preloaded=new Array);var e,t=document.Preloaded.length,r=PreloadImages.arguments;for(e=0;e<r.length;e++)document.Preloaded[t]=new Image,document.Preloaded[t++].src=r[e]}}function ShowPopUp(e,t,r){if(0!=e.indexOf("http")&&0!=e.indexOf("/")){e=GetDocumentBaseHref()+e}return window.open(e,"ActPopup","width="+t+",height="+r+",scrollbars, resizable"),bPageIsLoaded||window.location.reload(!0),!1}function GetDocumentBaseHref(){var e=document.getElementsByTagName("base");if(e&&e[0]){var t=e[0];if(t.href)return t.href}return""}function DecodeMail(){for(var e=0;e<document.links.length;e++)if("contactus"==document.links[e].name){for(var t=document.links[e].href;-1!=t.indexOf(" [dot] ");)t=t.replace(" [dot] ",".");for(;-1!=t.indexOf(" [at] ");)t=t.replace(" [at] ","@");document.links[e].href=t}}function HtmlInclude(){var e;if("undefined"==typeof XMLHttpRequest)try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return}}else e=new XMLHttpRequest;var t=document.getElementsByTagName("A"),r;for(r=0;r<t.length;r++)if("fragment"==t[r].getAttribute("rel"))try{if(e.open("GET",t[r].getAttribute("href"),!1),document.characterSet&&e.overrideMimeType("text/html; charset="+document.characterSet),e.send(null),200==e.status){var i=document.createElement("SPAN");i.innerHTML=e.responseText,t[r].parentNode.replaceChild(i,t[r])}}catch(e){return}}function AddEvent(e,t,r){e.attachEvent?(e["e"+t+r]=r,e[t+r]=function(){e["e"+t+r](window.event)},e.attachEvent("on"+t,e[t+r])):e.addEventListener(t,r,!1)}AddEvent(window,"load",HtmlInclude),window.SDStorage={isSupported:function(){try{var e=(new Date).valueOf();window.SDStorage.write(e,e,!0);var t=window.SDStorage.read(e,!0);return window.SDStorage.remove(e,!0),e==t}catch(e){return!1}},writePage:function(e,t){try{window.SDStorage.write(e+"|"+window.location.href,t,!0)}catch(e){}},readPage:function(e){return window.SDStorage.read(e+"|"+window.location.href,!0)},writeGlobal:function(e,t){window.SDStorage.write(e+"|global",t,!0)},readGlobal:function(e){return window.SDStorage.read(e+"|global",!0)},write:function(e,t,r){"object"==typeof t&&(t=JSON.stringify(t)),r?sessionStorage.setItem(e,t):localStorage.setItem(e,t)},read:function(e,t){if(t)var r=sessionStorage.getItem(e);else var r=localStorage.getItem(e);try{var i=JSON.parse(r)}catch(e){return r}return i},remove:function(e,t){t?sessionStorage.removeItem(e):localStorage.removeItem(e)}};/*************************************************************** 9* 10* ActinicExtras.js - additional utility functions 11* 12* Copyright (c) 2014 SellerDeck Limited 13* 14****************************************************************/ 15var bDebug=!1,bShowErrors=!0,g_arrAJAX=[],g_mapAJAXArgs={},g_mapAJAXResults={},g_mapDynPrices={},g_mapStockByRef={},g_bStockUpdateInProgress=!1,g_bDynamicPriceUpdatePending=!1,g_bChoicesUpdatePending=!1,g_mapAJAXActions={GetBreadcrumbTrail:SetBreadcrumbTrail},PRICING_MODEL_COMPONENTS_SUM=1;function AddAJAXCall(){var e=arguments[0];g_arrAJAX.push(e);for(var t=1;t<arguments.length;t++)g_mapAJAXArgs[arguments[t]]||(g_mapAJAXArgs[arguments[t]]=1)}function AJAXCall(){if(0!=g_arrAJAX.length){var e=new ajaxObject(g_sAJAXScriptURL);e.callback=function(e){bDebug&&alert(e),g_mapAJAXResults=e.parseJSON(),g_mapAJAXResults.Error?bDebug&&alert("Programming Error:"+g_mapAJAXResults.Error):ProcessAJAXResults(g_mapAJAXResults)};var t="ACTIONS="+g_arrAJAX.join(",");for(var r in g_mapAJAXArgs)r&&(t+="&"+r);e.update(t,"GET")}}function ProcessAJAXResults(e){for(var t in e)g_mapAJAXActions[t]&&g_mapAJAXActions[t](e[t])}function AddAJAXBreadcrumbTrail(e){var t=document.getElementById("idBreadcrumbsTop"),r=
15document.getElementById("idBreadcrumbsBottom");if(t||r){var i=t||r,n=i.getElementsByTagName("a");if(0!=n.length){AdjustPageFileNameSIDAnchor();var a=[];if(document.location.href.match(/\bSID=(\d+)\b/)){a.push("SID="+RegExp.$1),t&&(t.style.visibility="hidden"),r&&(r.style.visibility="hidden");var o=n[0];o.className.match(/\bajs-bc-home\b/)&&a.push("ROOTCLASS="+o.className);for(var l=GetAllElements(i),s=0;s<l.length;s++)if(l[s].className.match(/\bajs-bc-prod\b/)){a.push("PRODCLASS="+l[s].className);break}AddAJAXCall("GetBreadcrumbTrail","REF="+encodeURIComponent(e),a.join("&"))}}}}function SetBreadcrumbTrail(e){if(e.HTML){var t=document.getElementById("idBreadcrumbsTop"),r=document.getElementById("idBreadcrumbsBottom"),i=decodeURIComponent(e.HTML);t&&(t.innerHTML=i,t.style.visibility="visible"),r&&(r.innerHTML=i,r.style.visibility="visible")}bDebug&&alert("Breadcrumb Trail:"+(e.HTML||e.Error)),bShowErrors&&e.Error&&alert("Breadcrumb Trail:"+e.Error)}function AdjustPageFileNameSIDAnchor(){var e=GetInputElement(document,"PAGEFILENAME");if(e){var t=GetSIDAnchor();if(t){e.value=e.value.replace(/#SID=\d+/,"#SID="+t);var r=GetInputElement(e.form,"SID");r&&(r.value=t)}}}function GetSIDAnchor(){var e=document.location.href.split("#SID=");return 2==e.length?e[1]:""}function AppendParentSection(e,t){if(1==arguments.length){var r=GetInputElement(document,"PAGE");if(!r||"PRODUCT"!=r.value)return;var i=GetInputElement(r.form,"SID");return i&&(t=i.value),void(e.href.indexOf("?")>-1&&(e.href+="&SID="+t))}e.href+="#SID="+t}var PASSWORD_MATCH_ERROR="Passwords do not match.";function getCartItem(e){var t=getCookie("CART_CONTENT"),r=null!=t?r=t.split("\t"):0;return r.length>0?r[e]:0}function GotoAnchor(e){window.location.hash=e}!function(s){s.parseJSON=function(filter){try{if("object"==typeof JSON)return JSON.parse(this,filter);var j;function walk(e,t){var r,i,n=e[t];if(n&&"object"==typeof n)for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(i=walk(n,r),void 0!==i?n[r]=i:delete n[r]);return reviver.call(e,t,n)}var text=String(this),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j}catch(e){}throw new SyntaxError("parseJSON")}}(String.prototype);function ajaxObject(e,t){if(e.match(/^https?:/)){var r=document.location.protocol,i=e.split("//")[0];i!=r&&(e=e.replace(new RegExp("^"+i),r));var n=e.split("//")[1].split("/")[0];n!=document.location.host&&(e=e.replace(n,document.location.host))}var a=this;this.updating=!1,this.abort=function(){a.updating&&(a.updating=!1,a.AJAX.abort(),a.AJAX=null)},this.update=function(e,t,r){if(r=void 0===r||r,a.updating)return!1;if(a.AJAX=null,window.XMLHttpRequest?a.AJAX=new XMLHttpRequest:a.AJAX=new ActiveXObject("Microsoft.XMLHTTP"),null==a.AJAX)return!1;if(a.AJAX.onreadystatechange=function(){4==a.AJAX.readyState&&(a.updating=!1,a.callback(a.AJAX.responseText,a.AJAX.status,a.AJAX.responseXML),a.AJAX=null)},a.updating=new Date,/post/i.test(t)){var i=o;a.AJAX.open("POST",i,r),a.AJAX.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.AJAX.send(e)}else{var i=o+"?"+(""==e?"":e+"&")+"timestamp="+a.updating.getTime();a.AJAX.open("GET",i,r),a.AJAX.send(null)}return!0};var o=e;this.callback=t||function(){}}function getStockNodes(){return $(".ActinicRTS").toArray()}function getProductStock(e,t,r,i){return getStock(e,null,t,r,i)}function getSectionStock(e,t,r,i,n){if($(".ActinicRTS").length||!$.isEmptyObject(g_mapProds))return getStock(e,t,r,i,n)}function getStock(e,t,r,i,n){if(0==e.indexOf("file://")){for(var a=r.split("|"),o=i.split("|"),l=0;l<a.length;l++){var s=a[l].split("!"),c=s[s.length-1];g_mapStockByRef[c]=o[l]}updateStockDisplay(g_mapStockByRef,!0)}else{g_bStockUpdateInProgress=!0;var d=new ajaxObject(e);d.callback=function(i){if(i.match(/^-?\d+$/)?g_mapStockByRef[r]=i:i&&(g_mapStockByRef=i.parseJSON()),updateStockDisplay(g_mapStockByRef,!0),g_bStockUpdateInProgress=!1,g_bDynamicPriceUpdatePending&&""!==g_sDynamicPriceURL)if(void 0==t){var a=GetSIDAnchor();if(""==a){var o=GetInputElement(document,"PAGE");if(o&&"PRODUCT"==o.value){var l=GetInputElement(o.form,"SID");l&&(a=l.value)}}a&&getAllDynamicPrices(g_sDynamicPriceURL,a,n)}else getAllDynamicPrices(g_sDynamicPriceURL,t,n);
15else g_bChoicesUpdatePending&&(SetupChoicesAllProducts(e,t,n),g_bChoicesUpdatePending=!1)};var u=null!=t?"ACTION=GETSECTIONSTOCK&SID="+t:"ACTION=GETSTOCK&REF="+encodeURIComponent(r);null==t&&nAssocProdRefSID>0&&(u+="&SID="+nAssocProdRefSID),n&&(u+="&SHOP="+n),d.update(u,"GET")}}function updateStockDisplay(e,t){for(var r={},i=/\brts_([^_]+)_/,n=/\bchk_(v_[^_]+_\d+)_/,a=document.getElementsByTagName("SELECT"),o=0;o<a.length;o++){var l=a[o];if(0==l.name.indexOf("v_")){var s=null,c=l.className.match(n);c&&(s=document.getElementsByName(c[1])[0]);for(var d=0,u=!1,p=!1,g=0;g<l.options.length;g++){var m=l.options[g];""!=m.value&&-1!=m.value||(s=m,u=!s.selected);var f=m.className,c=f.match(i);if(c){var v=c[1];void 0!=e[v]&&e[v]<=0?(m.disabled=!0,m.selected&&(m.selected=!1,p=!0)):(m.disabled=!1,1==++d&&(p||t)&&(m.selected=!0))}else m.value>0&&1==++d&&t&&(m.selected=!0)}if(0==d||s&&!u)if(!s||"INPUT"!=s.tagName&&-1!=s.value)if(s&&""==s.value&&d>0)"OPTION"==s.tagName&&t&&(s.selected=!0);else{var S=l.name.match(/^v_([^_]+)_/)[1];r[S]=1,0==d&&l.options.length>0&&void 0!==l.options[0]&&"OPTION"==l.options[0].tagName&&(l.options[0].selected=!0)}else"OPTION"==s.tagName?t&&(s.selected=!0):0==d&&(s.checked=!1,s.disabled=!0)}}for(var h={},P={},C=document.getElementsByTagName("INPUT"),o=0;o<C.length;o++){var u=!1,_=C[o];if("checkbox"==_.type){var I=_.name.match(/^v_([^_]+)/);I&&(P["_"+I[1]]=_),u=_.checked}var c=_.className.match(i);if(c){var A=_.name;if(!h[A]){var s="checkbox"==_.type?_:null;c=_.className.match(n),c&&(s=document.getElementsByName(c[1])[0]),!s&&P[A]&&(s=P[A]);for(var d=0,T=document.getElementsByName(A),y=0;y<T.length;y++){var b=T[y];if(-1==b.value&&(s=b),c=b.className.match(i)){var v=c[1];void 0!=e[v]&&e[v]<=0?(b.disabled=!0,"submit"==b.type&&(b.parentNode.style.display="none")):(b.disabled=!1,1==++d&&t&&u&&(b.checked=!0))}else("submit"==b.type||b.value>0)&&(b.disabled=!1,1==++d&&t&&(b.checked=!0))}if(!d)if(s)"radio"==s.type?t&&(s.checked=!0):(t&&(s.checked=!1),s.disabled=!0);else{var S=0==A.indexOf("_")?A.substr(1):A.match(/^v_([^_]+)_/)[1];r[S]=1}h[A]=1}}}for(var R=getStockNodes(),E=0;E<R.length;E++){var D=R[E].id.split("_"),L=D[D.length-1],M=GetProductFromMap(L),F=-1;if(M&&M.bAssemblyProduct){if(M.arrComps)for(var o=0;o<M.arrComps.length;o++){var N=M.arrComps[o],O=N.nQ?N.nQ:1;if(null!=e[N.sAsscProdRef]&&!N.bOpt){!r[L]&&!N.bOpt&&null!=N.sAsscProdRef&&O>e[N.sAsscProdRef]&&(r[L]=1);var w=Math.floor(e[N.sAsscProdRef]/O);F=-1==F?w:Math.min(F,w)}}-1==F&&(r[L]=1)}var k=D[0];if(null!=e[L]){var B=IsInStock(L,e,r);"StockLevel"==k&&(M&&M.bAssemblyProduct&&F>-1?R[E].innerHTML=F:R[E].innerHTML=e[L]);var G=$(R[E]);if(G.filter("[data-message]").html(G.attr("data-message")).removeAttr("data-message"),"EnableIfOutOfStock"==k)if(B)R[E].style.visibility="hidden",R[E].style.display="none";else{R[E].style.visibility="visible",R[E].style.display="inline";var H=GetElementByName("Q_"+L);H&&(H.value=0,H.disabled=!0)}"RemoveIfOutOfStock"==k&&(B||(R[E].innerHTML="")),"EnableIfInStock"==k&&(B?(R[E].style.visibility="visible",R[E].style.display="inline"):(R[E].style.visibility="hidden",R[E].style.display="none")),"RemoveIfInStock"==k&&B&&(R[E].innerHTML=""),"EnableIfStockOk"==k&&(R[E].style.visibility="visible",R[E].style.display="inline")}}}function DisableOOSComponents(e,t){for(var r=document.getElementsByName(e),i=0;i<r.length;i++){var n=r[i];"SELECT"==n.tagName?0==n.options.length?HandleAllChoicesOutOfStock(e,t):1==n.options.length&&(-1==n.options[0].value?n.options[0].selected=!0:n.options[0].value||(n.options[0].selected=!1,HandleAllChoicesOutOfStock(e,t))):1==r.length&&(-1==n.value?n.checked=!0:n.value||(n.disabled=!0,HandleAllChoicesOutOfStock(e,t)))}0==r.length&&HandleAllChoicesOutOfStock(e,t)}function HandleAllChoicesOutOfStock(e,t){if(t){var r=GetElementByName(t);r.checked=!1,r.disabled=!0}else DisableAddToCart(e)}function DisableAddToCart(e){var t=e.match(/v_([^_]+)_/);if(t){var r=t[1],i=GetElementByName("Q_"+r);i&&(i.value=0,i.disabled=!0);var n=document.getElementById("EnableIfOutOfStock_"+r);n&&(n.style.visibility="visible",n.style.display="inline"),n=document.getElementById("RemoveIfOutOfStock_"+r),n&&(n.innerHTML=""),n=document.getElementById("EnableIfInStock_"+r),n&&(n.style.visibility="hidden",n.style.display="")}}function GetElementByName(e){var t=document.getElementsByName(e);return 0==t.length?null:t[0]}
15function AttachEvent(e,t,r){e&&("on"==t.substring(0,2)&&(t=t.substring(2,t.length)),e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent&&e.attachEvent("on"+t,r))}function ValidateCartNameDetails(){if(document.location.href.indexOf("SID=")>-1){document.location.href.match(/\bSID=(\d+)/);var e=RegExp.$1,t=GetInputElement(document,"ACTION_BUYNOW"),r=t.form,i=GetInputElement(r,"SID");i||(i=document.createElement("INPUT"),i.type="hidden",i.name="SID",r.appendChild(i)),i.value=e}var n=document.getElementById("idRowCartNamePassword");if(!n)return!0;if("none"==n.style.display)return n.style.display="",!1;var a=document.getElementById("idCartName");return""==a.value?(alert("Username must be filled in"),!1):(a=document.getElementById("idCartPassword"),""!=a.value||(alert("Password must be filled in"),!1))}function DeliveryCountryChanged(){CountryChanged("Delivery")}function InvoiceCountryChanged(){CountryChanged("Invoice")}function CountryChanged(e){var t=document.getElementById("lst"+e+"Country"),r=document.getElementById("lst"+e+"Region");if(!t)return void(r&&(r.style.display="none"));if(SetCountryTextFieldDisplay(e,""),r&&r.options){var i=document.getElementById("id"+e+"RegionEdit"),n=i?i.value:"",a=r.value;if(r.options.length=1,"UndefinedRegion"==t.value)return r.style.display="none",void(i&&(i.style.display=""));var o=document.getElementById("idSEPARATESHIP"),l=o&&o.checked,s="Delivery"==e?g_mapDeliveryCountryStateMap:g_mapInvoiceCountryStateMap,c=s[t.value];if(c||"Invoice"!=e||l||!g_mapDeliveryCountryStateMap[t.value]||(c=g_mapDeliveryCountryStateMap[t.value]),!c)return r.style.display="none",void(i&&(i.style.display=""));r.style.display="",i&&(i.style.display="none");for(var d=!1,u=0;u<c.length;u+=2){var p=document.createElement("OPTION");p.text=c[u+1],p.value=c[u],p.value!=a&&p.text!=n||(d=!0,a=p.value,p.selected=!0),r.options.add(p)}d&&(r.value=a)}}function SetCountryTextFieldDisplay(e,t){var r="Delivery"==e?"idDELIVERCOUNTRYText":"idINVOICECOUNTRYText",i=document.getElementById(r);if(i){var n=document.getElementById("lst"+e+"Country");i.style.display=n&&"---"==n.value?t:"none"}}function SetDeliveryAddressVisibility(){if(document.getElementById("idInvoiceRule")||document.getElementById("idDeliveryRule"))return void SetAccountAddressVisibility();var e=SD.Responsive.getResponsiveDeliveryFields();SetInvoiceCountries();var t=IsElementChecked("idSEPARATESHIP");e?($("#idBothAddressesTable #idDeliverHeader").toggle(t),$("#idBothAddressesTable > > .DeliverField:not(#idSeparateShipRow)").toggle(t),$("#idBothAddressesTable > > .InvoiceField:not(#idSeparateShipRow)").toggleClass("wideInput",!t)):($("#idSeparateShipCell").attr("colSpan",$("#idDeliverHeader").length&&t?2:1),$("#idBothAddressesTable > > tr > td.DeliverField").toggle(t)),$("#idINVOICERESIDENTIAL").toggle(!t),InvoiceCountryChanged()}function SetAccountAddressVisibility(){var e=SD.Responsive.getResponsiveDeliveryFields(),t=function(t,r,i){e?$("#idBothAddressesTable >").children("."+t).filter("div:not(#idInvoiceAccountAddresses, #idDeliverAccountAddresses, #idSeparateShipRow)").toggle(r).toggleClass("wideInput",r&&!i):$("#idBothAddressesTable tr:not(.ShowAlways) ."+t).children().filter(":not([id^='pcaDiv'])").toggle(r)},r=IsElementChecked("idINVOICEADDRESSSELECT_0"),i=IsElementChecked("idDELIVERADDRESSSELECT_0"),n=r||i,a;if(a=e?$("#idBothAddressesTable >").children("div:not(#idInvoiceAccountAddresses, #idDeliverAccountAddresses), label, input"):$("#idBothAddressesTable > > tr:not(.ShowAlways)"),a.toggle(n),n){var o=!1;i&&(r&&!IsElementChecked("idSEPARATESHIP")||(o=!0));var l=r&&o;t("InvoiceField",r,l),r&&InvoiceCountryChanged(),t("DeliverField",o,l),o&&DeliveryCountryChanged(),$("#idSeparateShipRow").toggle(r&&i)}}function IsElementChecked(e){var t=document.getElementById(e);return!(!t||!t.checked)}function SetShoppingCartVisibility(){var e=document.getElementById("idShowHide");if(e){var t=document.getElementById("idShoppingCartGrid");if(t){var r=document.getElementById("idCartHeadingTotal"),i=document.getElementById("idCartChangeCell");"none"==t.style.display?(setCookie("cartDisplayPreference","show"),t.style.display="",e.innerHTML="hide",r.style.display="none",i&&(document.getElementById("idCartChangeCell").style.display="")):(setCookie("cartDisplayPreference","hide"),t.style.display="none",e.innerHTML="show",r.style.display="",i&&(document.getElementById("idCartChangeCell").style.display="none"))}}}function HideCartDetailsOnCheckoutPages(){"show"!==getCookie("cartDisplayPreference")&&SetShoppingCartVisibility()}function SetCreditCardFieldsVisibility(){var e=GetPaymentMethod();if($("#idPaymentMethodTable .CreditCardField").toggle("10005"==e),$("#idPSPinput90").toggle("90"==e),$("#idPSPinput10005").toggle("10005"==e),$("#idPSPinput200").toggle("200"==e),$("#idPSPinput500").toggle("500"==e),$("#idPSPinput501").toggle("501"==e),$("#idBtnConfirm").toggle("500"!=e),"90"!==e)return $("#idPaymentMethodTable .v12FinanceFields").hide(),void("200"==e&&doPspSelected200());GetAvailableFinanceProducts()}function CheckForm(e){for(var t=e.parentElement?e.parentElement:e.parentNode;t&&"FORM"!=t.tagName;)t=t.parentElement?t.parentElement:t.parentNode;if(!t)return!0;$("#idCheckoutForm").append('<input type="hidden" name="JS" value="1" />'),AddHiddenShipClass(e);var r=document.getElementsByName("INVOICEADDRESSSELECT").length>0,i=!1;r&&(i=!IsElementChecked("idINVOICEADDRESSSELECT_0"));var n=document.getElementById("idSEPARATESHIP"),a=!1;
15if(r&&(a=!IsElementChecked("idDELIVERADDRESSSELECT_0")),a||(a=n&&!n.checked),i&&a)return!0;for(var o=GetAllElements(t),l=0;l<o.length;l++){var s=o[l];if("idINVOICEEMAIL_CONFIRM"==s.id&&!i||"idDELIVEREMAIL_CONFIRM"==s.id&&!a){var c=document.getElementById(s.id.replace(/_CONFIRM$/,""));if("none"!=c.style.display&&c.value!=s.value){var d=GetLabelText(s)+"\n\n";return d+="'"+s.value+"' does not match '"+c.value+"'",alert(d),s.focus(),!1}}if("idNEWCUSTOMERPASSWORD2"==s.id&&(IsElementChecked("idCREATEANACCOUNT")||null==document.getElementById("idCREATEANACCOUNT"))){var u=document.getElementById("idNEWCUSTOMERPASSWORD");if("none"!=u.style.display&&u.value!=s.value){var d=PASSWORD_MATCH_ERROR;return alert(d),s.focus(),!1}}}return i&&!a&&(n.checked=!0),!0}function AddHiddenShipClass(e){try{$("#idPickupSelect").length&&$("#lstClass").length&&$("#lstClass").prop("disabled")&&$(e).append('<input type="hidden" name="ShippingClass" value="'+$("#lstClass").val()+'" />')}catch(e){alert("A problem occurred while submitting this page. Error: "+e.message)}}function GetAllElements(e){return e.all?e.all:e.getElementsByTagName?e.getElementsByTagName("*"):void 0}var g_sConfirmOrderInitText="";function SubmitPSPForm(e){if("90"===GetPaymentMethod()){var t=CheckMinMaxDeposit();if(""!==t)return $("#idFinanceDepositError").html(t),$("#idFinanceDepositError").show(),$("#idFinanceDeposit").focus(),!1}var r=GetPaymentMethod();if(-1==r)return!0;var i=document.getElementById("idSpanPSPForm");return i&&(i.innerHTML='<div id="pspwait" style="display:none;">Saving your order... Please wait</div>
15',ShowPSPWait("pspwait"),ShowPSPForm()),r>=1e4&&r<3e4||(GetPSPFormAndSubmit(r,e),!1)}var g_bConfirmOrderDone=!1;function SubmitPPEForm(e){return g_bConfirmOrderDone?(alert("Your order is being completed"),!1):(g_bConfirmOrderDone=!0,AddHiddenShipClass(e),e.submit(),!1)}function GetPaymentMethod(){var e=document.getElementById("idPAYMENTMETHOD");if(e)return e.value;var t=document.getElementsByName("PAYMENTMETHOD");if(!t)return-1;if(1==t.length)return t[0].value;for(var r=0;r<t.length;r++)if(t[r].checked)return t[r].value;return-1}function GetPSPFormAndSubmit(e,t){var r=new ajaxObject(document.location.href.split("?")[0]);r.callback=function(t,r){if(200!=r||"Error:"==t.substring(0,6))return alert(t),void ShowPSPForm(!1);var i=document.getElementById("idSpanPSPForm");if(i){i.innerHTML=t;var n=document.getElementById("idPSPForm");if(n)return void n.submit();RequireScript("psplib"+e+".htm.js",function(){GetPSPHelper()})}};var i="ACTION=GETPSPFORM&PAYMENTMETHOD="+e;t&&(i+="&SHOP="+t);var n=document.getElementsByName("PAYMENTPONO");n.length&&(i+="&PAYMENTPONO="+escape(n[0].value));var a=document.getElementsByName("PAYMENTUSERDEFINED");a.length&&(i+="&PAYMENTUSERDEFINED="+escape(a[0].value)),"90"===e&&(i+=GetParams()),r.update(i,"GET")}function CloseForm(){ShowPSPForm(!1)}function RequireScript(e,t){var r=document.createElement("script"),i=document.getElementsByTagName("script")[0];r.onerror=function(){alert("Error loading ["+e+"]. Please try another payment method."),ShowPSPForm(!1)},void 0!=t&&(r.onreadystatechange=function(){"loaded"!==r.readyState&&"complete"!==r.readyState||t()},r.onload=function(){t()}),r.src=e,i.parentNode.insertBefore(r,i)}function ShowPSPForm(e){var t=document.getElementById("idDivPSPForm");t&&(t.style.display=null==e||e?"inline":"none")}function ShowPSPWait(e,t){null==t||t?(document.getElementById(e).style.display="inline",document.getElementById("pspwait").style.display="inline"):(document.getElementById("pspwait").style.display="none",document.getElementById(e).style.display="none")}function SFDropDownMenu(e){for(var t=document.getElementById(e).getElementsByTagName("LI"),r=0;r<t.length;r++)t[r].onmouseover=function(){this.className+=" sfhover"},t[r].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}function ShowHideHelp(e,t){var r=document.getElementById(e.id+"help");r&&(r.style.display=t)}function ShowHideHelpDiv(e,t){var r=document.getElementById(e.id+"help");if(r){var i=document.getElementById("idCheckoutHelp");if(i){var n=r.innerHTML,a=document.getElementById(e.id+"label");a&&"actrequired"==a.className&&(n+=" This is a required field."),i.innerHTML=""==t?n:""}}}function GetLabelText(e){var t=document.getElementById(e.id+"label");if(t||(t=document.getElementById(e.id.replace(/DELIVER/,"INVOICE")+"label")),t){var r=t.innerHTML;return r=r.replace(/(\n|\t)/," "),r=r.replace(/<.*?>/g,""),r=r.replace(/\s*\*$/,"")}return""}function SetFocusToID(e){var t=document.getElementById(e);t&&"none"!=t.style.display&&t.focus()}var g_sInvoiceCountryCode="";function SetInvoiceCountries(){var e=document.getElementById("lstInvoiceCountry");if(e&&e.options){var t=document.getElementById("idINVOICECOUNTRYText"),r=document.getElementById("idSEPARATESHIP"),i=!(!r||!r.checked),n=e.value?e.value:g_sInvoiceCountryCode,a=""!=n&&"---"!=n||!t?"":t.value;e.options.length=1;var o="",l="";for(var s in g_arrCountries){var c=g_arrCountries[s],d=!0;if(d=g_bInvoiceLocationRestrictive?!i&&g_bDeliveryLocationRestrictive?c[2]&&c[3]:c[2]:g_bDeliveryLocationRestrictive&&!i?c[3]:c[2]||c[3]){var u=document.createElement("OPTION");u.value=c[0],u.text=c[1],n&&u.value==n&&(o=u.value),"---"!=n&&u.text==a&&(l=u.value),e.options.add(u)}}o&&(e.value=o),l&&(e.value=l),e.value&&(g_sInvoiceCountryCode=e.value)}}function StateDropdownChanged(e){var t=-1!=e.id.indexOf("Invoice")?"idInvoiceRegionEdit":"idDeliveryRegionEdit",r=document.getElementById(t);if(!r||"UndefinedRegion"==e.value)return void GetShippingClassesSelectHtml(e);var i=e.selectedIndex;r.value=e.options[i].text,GetShippingClassesSelectHtml(e)}function LoadXMLDoc(e,t){return window.XMLHttpRequest?xhttp=new XMLHttpRequest:xhttp=new ActiveXObject("Microsoft.XMLHTTP"),xhttp.open("GET",e,!1),xhttp.send(null),t?xhttp.responseXML:xhttp.responseText}function DOMDocFromXML(e){var t=null;if(window.ActiveXObject)t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e);else if(window.DOMParser){var r=new DOMParser;t=r.parseFromString(e,"text/xml")}return t}
15function DisplayFeefoFeedback(e,t,r,i,n,a){var o=escape("?logon="+i),l="FeefoFeedback";""!=n&&(o+=escape("&vendorref="+n),l+="_"+n),o+=escape("&limit="+e),o+=escape("&mozillahack=true");var s=r+"?ACTION=FEEFOXML&FEEFOPARAM="+o;a&&(s+="&SHOP="+escape(a));var c=LoadXMLDoc(s,!0);if(null!=c&&""!=c.xml){var d=LoadXMLDoc(t+"feedback.xsl",!1),u=/(feefo\.css|plus\.gif|minus\.gif)/gi;d=d.replace(u,t+"$1");var p=DOMDocFromXML(d);window.ActiveXObject?(ex=c.transformNode(p),document.getElementById(l).innerHTML=ex):document.implementation&&document.implementation.createDocument&&(xsltProcessor=new XSLTProcessor,xsltProcessor.importStylesheet(p),resultDocument=xsltProcessor.transformToFragment(c,document),document.getElementById(l).appendChild(resultDocument))}}function ShowBackLink(){var e=getCookie("LAST_SECTION_URL");if(e){var t=document.getElementById("idSPPBackLink");t&&(t.href=e,t.style.display="")}}function CheckPassword(e,t){if(!e.value||!t.value||e.value!=t.value){var r=PASSWORD_MATCH_ERROR,i=e;return e.value?t.value||(r="Please enter a value for "+GetLabelText(t),i=t):r="Please enter a value for "+GetLabelText(e),alert(r),i.focus(),!1}return!0}function GetScriptURL(){return document.location.href.split("?")[0]}function IsLoggedIn(){var e=getCookie("ACTINIC_BUSINESS");if(!e)return!1;for(var t=e.split(/\n/),r=0;r<t.length;r++){var i=t[r].split(/\t/);if("USERNAME"==i[0]&&""!=i[1])return!0}return!1}function GetScriptPrefix(){var e=location.pathname.lastIndexOf("/");if(-1!=e){return location.pathname.substr(e+1).substr(0,2)}}function SetBusinessCookies(e,t){e||(setCookie("CART_CONTENT","CART_TOTAL\t0\tCART_COUNT\t0"),setCookie("ACTINIC_BUSINESS","BASEFILE"),document.location.replace(document.location.href.replace(/#logout$/,"")))}function OnKeyDownForm(){if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){if(new Number(RegExp.$1)>=9&&13==window.event.keyCode){var e=window.event.srcElement;if("INPUT"==e.tagName&&("submit"==e.type||"button"==e.type))return;for(var t=0;t<e.form.all.length;t++){var r=e.form.all[t];if("INPUT"==r.tagName&&"submit"==r.type)return r.click(),window.event.cancelBubble=!0,void(window.event.returnValue=!1)}}}}function Sprintf(e){for(var t=e,r=1;r<arguments.length;r++)t=t.replace(/%s/,arguments[r]);return t}var g_mm_nMenuCloseTimeout=500,g_mm_nMenuHoverOpenTimeout=300,g_mm_closeTimer=null,g_mm_menuParent=null,g_mm_menuItem=null,g_mm_NO_MENU_ITEM=-1,g_mm_nIDRecentMouseOver=g_mm_NO_MENU_ITEM,g_mm_nIDCurrentMouseOver=g_mm_NO_MENU_ITEM,g_mm_timerRecentMouseOver=null,g_mm_timerDelayMouseOver=null,g_mm_nIDForMouseUp=g_mm_NO_MENU_ITEM,g_mm_nWindowsTouchOn=g_mm_NO_MENU_ITEM,g_mm_mapListenersAdded={},$ge=function(e){return document.getElementById(e)};function mmClick(e,t){if(g_mm_nIDRecentMouseOver==t)return e.preventDefault&&e.preventDefault(),!1}function mmClose(){g_mm_menuItem&&(g_mm_menuItem.style.display="none",g_mm_menuItem=null),g_mm_menuParent&&(g_mm_menuParent.className="",g_mm_menuParent=null)}function mmCloseTime(){g_mm_nIDForMouseUp==g_mm_NO_MENU_ITEM?(g_mm_timerDelayMouseOver&&(window.clearTimeout(g_mm_timerDelayMouseOver),g_mm_timerDelayMouseOver=null),g_mm_closeTimer&&(window.clearTimeout(g_mm_closeTimer),g_mm_closeTimer=null),g_mm_closeTimer=window.setTimeout(mmClose,g_mm_nMenuCloseTimeout)):g_mm_nWindowsTouchOn=g_mm_nIDForMouseUp}function mmCancelCloseTime(){g_mm_closeTimer&&(window.clearTimeout(g_mm_closeTimer),g_mm_closeTimer=null),g_mm_menuParent&&(g_mm_menuParent.className="sel")}function mmOpen(e){if($("div.miniNav").is(":visible")&&"#"!=$("#main-link"+e).attr("href"))return void(g_mm_nIDRecentMouseOver=g_mm_NO_MENU_ITEM);g_mm_nWindowsTouchOn!=e&&(g_mm_nIDRecentMouseOver=e,g_mm_timerRecentMouseOver&&window.clearTimeout(g_mm_timerRecentMouseOver),g_mm_timerRecentMouseOver=window.setTimeout(function(){g_mm_nIDRecentMouseOver=g_mm_NO_MENU_ITEM,g_mm_timerRecentMouseOver=null},g_mm_nMenuHoverOpenTimeout),g_mm_nIDCurrentMouseOver&&g_mm_nIDCurrentMouseOver!=g_mm_NO_MENU_ITEM?mmOpenCore(e):g_mm_timerDelayMouseOver=setTimeout(mmOpenCore.bind(null,e),g_mm_nMenuHoverOpenTimeout))}function mmOpenCore(e){g_mm_nIDCurrentMouseOver=e,mmCancelCloseTime(),mmClose(),menuDiv=$ge("mega-menu"),g_mm_menuParent=$ge("main-link"+e),g_mm_mapListenersAdded["mouseup"+e]||(AddEvent(g_mm_menuParent,"mouseup",mmMouseUpHandler(e)),g_mm_mapListenersAdded["mouseup"+e]=!0),g_mm_menuItem=$ge("tc"+e),g_mm_menuItem.style.display="block";var t=menuDiv.offsetWidth,r=g_mm_menuItem.offsetWidth,i=findLeftPos(menuDiv),n=findLeftPos(g_mm_menuParent),a=t-n;if(t<r){var o=r-t;g_mm_menuItem.style.left=-1*(n+Math.floor(o/2)-i)+"px"}else g_mm_menuItem.style.left=t<n-i+r?-1*(n-i+r-t)+"px":"0px"}function mmMouseUpHandler(e){var t=e;return function(){g_mm_nIDForMouseUp=t,window.setTimeout(function(){g_mm_nIDForMouseUp=g_mm_NO_MENU_ITEM},0)}}$(document).ready(function(){$("#mega-menu > ul").mouseleave(function(e){0==$(e.relatedTarget).parents().filter(e.currentTarget).length&&(g_mm_nIDCurrentMouseOver=g_mm_NO_MENU_ITEM)})});function findLeftPos(e){var t=0;if(e.offsetParent){do{t+=e.offsetLeft}while(e=e.offsetParent);return t}}function findPosX(e){var t=0;if(e.offsetParent)for(;;){if(t+=e.offsetLeft,!e.offsetParent)break;e=e.offsetParent}else e.x&&(t+=e.x);return t}function findPosY(e){var t=0;if(e.offsetParent)for(;;){if(t+=e.offsetTop,!e.offsetParent)break;e=e.offsetParent}else e.y&&(t+=e.y);return t}
15function getDynamicAccPrice(e,t,r,i){var n=0==e.indexOf("file://"),a=r.sProdRef,o="";if(!n){var l="v_"+a+"_",s=document.getElementById("idVars"+a);if(s){if(r.arrComps)for(var c=r.arrComps,d=c.length,u=0;u<d;u++){var p=c[u],g=l+p.nUI,m=document.getElementsByName(g)[0];"checkbox"==m.type?o+="&"+g+"="+(m.checked?"on":"off"):o+="&"+g+"="+m.value,p.elemHTML=m}var f=GetAttributes(s),v=f[a];if(v)for(var S=parseInt(v[0].name.match(/_(\d+)$/)[1]),h=v.length,u=0;u<h;u++){var P=v[u];if(S=parseInt(P.name.match(/_(\d+)$/)[1]),r.arrComps){var C=GetAttrFromSuffix(r,S);C.elem||(C.elem=new CSelect(P))}if("radio"==document.getElementsByName(P.name)[0].type)for(var _=document.getElementsByName(P.name)[0],I=0;null!=_;){if(_.checked){o+="&"+P.name+"="+_.value;break}_=document.getElementsByName(P.name)[++I]}else o+="&"+P.name+"="+P.value}}var A="sPushBtnGridVariants_"+a;void 0!==window[A]&&(o+="&"+window[A]);var T="Q_"+a;o+="&"+T+"="+document.getElementsByName(T)[0].value;var y=new ajaxObject(e);y.callback=function(e,t){if(200!=t){var i=document.getElementById("id"+r.sProdRef+"DynamicPrice"),n=document.getElementById("id"+r.sProdRef+"StaticPrice");return r.bOvrStaticPrice&&n&&!r.bQuantityBreak&&(n.style.visibility="visible",n.style.display=""),void(i&&(i.style.display="none",i.style.visibility="hidden"))}var o=document.getElementById("id"+a+"TaxExcPrice"),l=document.getElementById("id"+a+"TaxIncPrice"),s=document.getElementById("id"+r.sProdRef+"VATMsg");if(null!=e)try{var c=e.parseJSON();if(c.ErrorMsg){if(s&&(s.style.visibility="hidden",s.style.display="none"),o?o.innerHTML=c.ErrorMsg:l&&(l.innerHTML=c.ErrorMsg),IsPayPalPayLaterEnabled()){var d=0,u=document.getElementById("id"+r.sProdRef+"PayLaterMessage");if(!u)return void 0!==IsFilterAsDefaultView||IsFilterAsDefaultView(),void UpdatePayPalPayLaterMessages(0);u.setAttribute("data-pp-amount",d),paypal.Messages().render(".pp-pay-later-message")}return}s&&(s.style.visibility="visible",s.style.display="");var p=c.Total,g=c.Total+c.Tax1+c.Tax2,m;if(o&&(o.innerHTML=FormatPrices(p),m=o.innerHTML),l&&(l.innerHTML=FormatPrices(g),m=l.innerHTML),IsPayPalPayLaterEnabled()&&m){var d=Number(m.match(/[0-9,]+\.[0-9][0-9]/)[0].replace(",","")),u=document.getElementById("id"+r.sProdRef+"PayLaterMessage");if(!u)return void(void 0===IsFilterAsDefaultView&&IsFilterAsDefaultView()||UpdatePayPalPayLaterMessages(d));u.setAttribute("data-pp-amount",d),paypal.Messages().render(".pp-pay-later-message")}}catch(e){}};var b="ACTION=GETACCPRICE&PRODREF="+a+"&SID="+t;b+=o,i&&(b+="&SHOP="+i),y.update(b,"GET")}}function SetupChoicesAllProducts(e,t,r){for(var i in g_mapProds){var n=g_mapProds[i];if(n){var a="v_"+i+"_",o=document.getElementById("idVars"+i);if(o){if(n.arrComps){for(var l=n.arrComps,s=l.length,c=0;c<s;c++){var d=l[c],u=a+d.nUI,p=document.getElementsByName(u)[0];d.elemHTML=p}var g=GetAttributes(o),m=g[i];if(m){for(var f=parseInt(m[0].name.match(/_(\d+)$/)[1]),v=m.length,c=0;c<v;c++){var S=m[c];f=parseInt(S.name.match(/_(\d+)$/)[1]);var h=GetAttrFromSuffix(n,f);h.elem||(h.elem=new CSelect(S))}UpdateChoices(n,!0)}}(!n.bOvrStaticPrice||n.nPricingModel!=PRICING_MODEL_COMPONENTS_SUM||g_mapDynPrices[n.sProdRef]&&g_mapDynPrices[n.sProdRef].Total>0)&&UpdatePrice(n,e,t,r)}}}g_mapDynPrices={}}function getAllDynamicPrices(e,t,r){if($.isEmptyObject(g_mapProds))return"";if(0==e.indexOf("file://"))return SetupVariants(!0),"";if(g_bStockUpdateInProgress)return g_bDynamicPriceUpdatePending=!0,"";var i=new ajaxObject(e);i.callback=function(i,n){if(null!=i){if(200==n)try{g_mapDynPrices=i.parseJSON()}catch(e){}SetupChoicesAllProducts(e,t,r)}};var n="ACTION=GETALLPRICES&SID="+t,a="";a=SetupVariants(!0),n+=a,r&&(n+="&SHOP="+r),i.update(n,"GET"),g_bDynamicPriceUpdatePending=!1}function SetupVariantsForProduct(e,t){var r="",i=g_mapProds[e];if(i){var n="v_"+e+"_",a=document.getElementById("idVars"+e);if(a&&i.arrComps){for(var o=i.arrComps,l=o.length,s=0;s<l;s++){var c=o[s],d=n+c.nUI,u=document.getElementsByName(d)[0];t&&("checkbox"==u.type?r+="&"+d+"="+(u.checked?"on":"off"):r+="&"+d+"="+u.value),c.elemHTML=u}var p=GetAttributes(a),g=p[e];if(g)for(var m=parseInt(g[0].name.match(/_(\d+)$/)[1]),f=g.length,s=0;s<f;s++){var v=g[s];m=parseInt(v.name.match(/_(\d+)$/)[1]);var S=GetAttrFromSuffix(i,m);if(S.elem||(S.elem=new CSelect(v)),t)if("radio"==document.getElementsByName(v.name)[0].type)for(var h=document.getElementsByName(v.name)[0],P=0;null!=h;){if(h.checked){r+="&"+v.name+"="+h.value;break}h=document.getElementsByName(v.name)[++P]}else r+="&"+v.name+"="+v.value}}if(t){var C="sPushBtnGridVariants_"+e;void 0!==window[C]&&(r+="&"+window[C])}}return r}function SetupVariants(e){var t="";for(var r in g_mapProds)t+=SetupVariantsForProduct(r,e);return t}function GetInputElement(e,t){for(var r=e.getElementsByTagName("INPUT"),i=0;i<r.length;i++){var n=r[i];if(n.name==t)return n}}function GetOriginalRef(e){var t=e.split("!");return t[t.length-1]}function GetProductFromMap(e){if(g_mapProds[e])return g_mapProds[e] 16;for(var t in g_mapProds)if(GetOriginalRef(t)==e)return g_mapProds[t]}function SetupDPDPickupOptions(e){if(null!=e.Error)return alert("There was an error in initializing the Collection Point Pickup service. Please select another shipping option"),$("#idDPDShippingType3").attr("disabled",!0),HideLoadingDialog(),void $("#idDPDShippingType1").click();$("#map").css("left","0"),$("#map").css("position","relative"),$("#map").css("width","100%"),$("#map").show(),g_mapPickupLocationsJSON=e;var t=e.data.results,r=[];r.forEach(function(e){e.setMap(null)}),r=[];var i=new google.maps.LatLngBounds;t.forEach(function(e){var t=e.pickupLocation.addressPoint.latitude,n=e.pickupLocation.addressPoint.longitude,a=new google.maps.LatLng(t,n),o={organisation:e.pickupLocation.address.organisation,postcode:e.pickupLocation.address.postcode,locality:e.pickupLocation.address.locality,property:e.pickupLocation.address.property,street:e.pickupLocation.address.street,town:e.pickupLocation.address.town,county:e.pickupLocation.address.county,distance:Math.round(100*e.distance)/100,disabledaccess:e.pickupLocation.disabledAccess,parking:e.pickupLocation.parkingAvailable,openlate:e.pickupLocation.openLate,shortname:e.pickupLocation.short
16Name,openhours:e.pickupLocation.pickupLocationAvailability.pickupLocationOpenWindow,directions:e.pickupLocation.pickupLocationDirections},l=new google.maps.Marker({map:map,title:e.pickupLocation.address.organisation,position:a,pickupLocationCode:e.pickupLocation.pickupLocationCode,pickupLocationDetails:o});r.push(l),i.contains(a)||i.extend(a),l.addListener("click",function(){infowindow.open(map,l),infowindow.setContent(SetupInfoWindow(l))});var s=(""!=e.pickupLocation.address.organisation?e.pickupLocation.address.organisation+",":"")+(""!=e.pickupLocation.address.property?e.pickupLocation.address.property+",":"")+(""!=e.pickupLocation.address.street?e.pickupLocation.address.street+",":"")+(""!=e.pickupLocation.address.locality?e.pickupLocation.address.locality+",":"")+(""!=e.pickupLocation.address.postcode?e.pickupLocation.address.postcode+",":"")+(""!=e.pickupLocation.address.county?e.pickupLocation.address.county+",":"")+e.pickupLocation.address.town;g_mapCodeToDetail[e.pickupLocation.pickupLocationCode]=s,g_mapCodeToMarker[e.pickupLocation.pickupLocationCode]=l;var c="<option value='"+e.pickupLocation.pickupLocationCode+"'"+($("#idDPDPickupDefault").val()===e.pickupLocation.pickupLocationCode?" selected":"")+">"+s+"</option>";$("#idPickupSelect").append(c)}),google.maps.event.trigger(map,"resize"),map.fitBounds(i),$("#idPickupSelect").show(),SelChangePickupLocations(),HideLoadingDialog()}function SelectPickupLocation(e){e.preventDefault();var t=g_SelectedMarker;t&&($("#idPickupSelect").val(t.pickupLocationCode),$("input#idDPDPickupLocation").val(g_mapCodeToDetail[t.pickupLocationCode]+g_sDPD_Delimiter+t.pickupLocationCode),$("#idMapBtn").text("Selected"),$("#idMapBtn").prop("disabled",!0))}function SelChangePickupLocations(){var e=$("#idPickupSelect").val(),t=g_mapCodeToMarker[e];t&&($("input#idDPDPickupLocation").val(g_mapCodeToDetail[t.pickupLocationCode]+g_sDPD_Delimiter+t.pickupLocationCode),google.maps.event.trigger(t,"click"),$("#idMapBtn").text("Selected"),$("#idMapBtn").prop("disabled",!0))}function ShippingTypeChanged(e){switch(e){case"1":$("#map").hide(),$("#idPickupSelect").hide(),$("#idDeliveryDateFields").hide(),$("#lstClass").prop("disabled",!1),$("#lstClass > option").each(function(){$(this).attr("data-ship2shop")?$(this).prop("disabled",!0):$(this).prop("disabled",!1)}),$("#idSelectPickupLabel").hide(),$("#lstClass").children("option:enabled").eq(0).prop("selected",!0);break;case"2":$("#map").hide(),$("#idPickupSelect").hide(),$("#lstClass").prop("disabled",!1),SetupDeliveryDateList(),FilterClassList(),$("#idDeliveryDateFields").show(),$("#idSelectPickupLabel").hide();break;case"3":$("#idDeliveryDateFields").hide(),void 0===g_mapPickupLocationsJSON.data&&void 0===g_mapPickupLocationsJSON.error?(ShowLoadingDialog(),g_mapAJAXActions.GetDPDPickupLocations=SetupDPDPickupOptions,AddAJAXCall("GetDPDPickupLocations"),AJAXCall()):($("#map").show(),$("#idPickupSelect").show(),SelChangePickupLocations()),$("#lstClass > option").each(function(){if($(this).attr("data-ship2shop"))return $(this).prop("disabled",!1),$("#lstClass").val(this.value),$("#lstClass").prop("disabled",!0),!1}),$("#idSelectPickupLabel").show()}}function SetupDeliveryDateList(){var e=new Date,t,r,i,n,a,o,l=6==e.getDay()||0==e.getDay(),s=5==e.getDay(),c=e.getHours()<12;if($("#idDeliveryDate").empty(),l||s&&!c){var d=1;switch(e.getDay()){case 0:d=2;break;case 6:d=3;break;case 5:d=4}e.setDate(e.getDate()+d)}else c?e.setDate(e.getDate()+1):e.setDate(e.getDate()+2);for(var u=0;u<g_nMaxDays;u++)r=aDaysOfWeek[e.getDay()],i=aMonths[e.getMonth()],n=e.getFullYear(),a=e.getDate(),o=a+" "+i+" "+n,t="<option value='"+o+"'"+($("#idDPDDateDefault").val()===o?" selected":"")+">"+r+" "+a+" "+i+", "+n+"</option>",$("#idDeliveryDate").append(t),e.setDate(e.getDate()+1)}function FilterClassList(){var e=new Date($("#idDeliveryDate").val());console.log(e.getDay());var t=new Date,r=t.getHours()<12,i=e.getDay()<6&&e.getDay()>0;$("#lstClass > option").each(function(){var t=!1;switch($(this).attr("data-filter")){case"w":$(this).prop("disabled",!i);break;case"st":$(this).prop("disabled",6!=e.getDay());break;case"sn":$(this).prop("disabled",0!=e.getDay());break;default:$(this).prop("disabled",!0)}return!0}),$("#lstClass").children("option:enabled").eq(0).prop("selected",!0)}
16function SetupInfoWindow(e){var t=e.pickupLocationDetails,r=Array(7),n="";for(i=0;i<t.openhours.length;i++){if(n="",void 0!=r[t.openhours[i].pickupLocationOpenWindowDay]){var a=r[t.openhours[i].pickupLocationOpenWindowDay],o=a.substr(6);n=t.openhours[i].pickupLocationOpenWindowStartTime===o?a.substr(0,5)+"-"+t.openhours[i].pickupLocationOpenWindowEndTime:r[t.openhours[i].pickupLocationOpenWindowDay]+"|"+t.openhours[i].pickupLocationOpenWindowStartTime+"-"+t.openhours[i].pickupLocationOpenWindowEndTime}else n=t.openhours[i].pickupLocationOpenWindowStartTime+"-"+t.openhours[i].pickupLocationOpenWindowEndTime;r[t.openhours[i].pickupLocationOpenWindowDay]=n}var l='<div id="locationInfo"><table style="line-height:1.3"><tr><td><strong>'+t.shortname+"</strong><br>"+(""!=t.property?t.property+"<br>":"")+(""!=t.street?t.street+"<br>":"")+(""!=t.locality?t.locality+"<br>":"")+(""!=t.town?t.town+"<br>":"")+(""!=t.county?t.county+"<br>":"")+t.postcode+"<br>";return l+="Distance:"+t.distance+" miles<br>Car Parking:"+(t.parking?"Yes":"No")+"<br>Disabled Access:"+(t.disabledaccess?"Yes":"No")+"<br>",""!=t.directions&&(l+="Additional directions:"+t.directions+"<br>"),l+="</td><td>",l+="<strong>Normal opening hours: </strong><br>Mon: "+(void 0!=r[1]?r[1]:"Closed")+"<br>Tue: "+(void 0!=r[2]?r[2]:"Closed")+"<br>Wed: "+(void 0!=r[3]?r[3]:"Closed")+"<br>Thu: "+(void 0!=r[4]?r[4]:"Closed")+"<br>Fri: "+(void 0!=r[5]?r[5]:"Closed")+"<br>",void 0!=r[6]&&(l+="Sat: "+r[6]+"<br>"),void 0!=r[7]&&(l+="Sun: "+r[7]+"<br>"),l+="</td></tr></table>",l+="<strong>Latitude:</strong>"+e.position.lat().toFixed(5)+" | <strong>Longitude:</strong>"+e.position.lng().toFixed(5)+"<br>",l+='<div align="center"><button class="btn btn-primary" id="idMapBtn" onclick="SelectPickupLocation(event)">Select</button></div></div>',g_SelectedMarker=e,l}function SetDefaultShippingType(){ShippingTypeChanged($("input[name=DPDShippingType]:checked").val())}function GetUsedCoupons(e){if(0==e.indexOf("file://"));else{var t=new ajaxObject(e);t.callback=function(e,t){if(null!=e&&200==t)try{document.getElementById("used-coupons").innerHTML=e}catch(e){}};t.update("ACTION=GETUSEDCOUPONS","GET")}}function RemoveCouponAtIndex(e,t){if(0==e.indexOf("file://"));else{var r=new ajaxObject(e);r.callback=function(e,t){if(null!=e&&200==t)try{document.getElementById("used-coupons").innerHTML=e}catch(e){}};var i="ACTION=REMOVECOUPON&COUPONINDEX="+t+"&SHOWNOCART=1";r.update(i,"GET")}}function checkFetchStatus(e){return e.status>=200&&e.status<300?Promise.resolve(e):Promise.reject(new Error(e.statusText))}function IsInternetExplorer(){return!!/(MSIE|Trident)/.test(navigator.userAgent)}function GetShippingClassesSelectHtml(e){if(-1!=e.id.indexOf("Delivery")){ShowLoadingDialog();var t=new ajaxObject(pg_sCheckoutURL);t.callback=function(e,t){if(HideLoadingDialog(),bDebug&&console.info("Status: "+t+" Response: "+e),200!=t||"Error:"==e.substring(0,6))return void alert(e);var r=document.getElementById("idShippingSelect");r&&(r.innerHTML=e)};var r="ACTION=GETSHIPPINGSELECT&LocationDeliveryRegion="+encodeURIComponent(e.value);t.update(r,"GET")}}function IsInStock(e,t,r){var i=GetProductFromMap(e);return!!(t[e]>0&&(!i||!i.bAssemblyProduct)||i&&i.bAssemblyProduct&&!r[e])}function UpdatePayPalPayLaterMessages(e){var t=Array.from(document.querySelectorAll(".product-details, #product-page-body, .std-product-details"));$.each(t,function(t,r){var i=r.querySelector(".pp-pay-later-message");if(i){if(void 0!==e)return i.setAttribute("data-pp-amount",e),void i.setAttribute("data-pp-placement","product");var n=r.querySelector("span.product-price");if(n||(n=r.querySelector("p.product-price")),n&&-1<n.innerText.search(/[0-9,]+\.[0-9][0-9]/)){var a=Number(n.innerText.match(/[0-9,]+\.[0-9][0-9]/)[0].replace(",",""));i.setAttribute("data-pp-amount",a),i.setAttribute("data-pp-placement","product")}}})}function RenderPayPalPayLaterMessages(){paypal.Messages({style:{layout:"text",logo:{type:"alternative"},text:{size:16}}}).render(".pp-pay-later-message")}function IsPayPalPayLaterEnabled(){return!("undefined"==typeof g_PayPalPayLater||!g_PayPalPayLater)}$(document).ready(function(){!IsPayPalPayLaterEnabled()||void 0===IsFilterAsDefaultView&&IsFilterAsDefaultView()||(UpdatePayPalPayLaterMessages(),RenderPayPalPayLaterMessages())}),$(document).ready(function(){var e=window.location.href;if(0!==e.search("file:")){var t=getCookie("ACTINIC_BUSINESS");if(t&&t.split("\n").length>1){var r=e.substring(e.lastIndexOf("/")+1);if(r=r.split("?")[0],r=r.split("#")[0],/(\.((s?)html|htm))/.test(r)||""==r){var i=pg_sSearchScript.replace("/ss","/aj");
16$.ajax({url:i+"?ACTIONS=GetUserAccount",dataType:"json",success:function(e){var t=e.GetUserAccount;if(t.success&&1==t.nPriceSchedule){var i=$(".content-area p:first");if(!i.length)return void UpdateSwiftLoginInfo(t);var n=i.html().indexOf("actinic:logout_simple")>-1?t.sLogoutSimple:t.sLogout;i.html(t.sServing+t.sCurrentAccount+t.sMyAccountUrl+n);var a=$(".infoPagesSecondaryBar");if(a.length){var o=$(a[0]).children();$(o[1]).remove()}}t.success&&t.nPriceSchedule>1&&(""==r&&(r=t.sHomePage),window.location.href=pg_sCustomerAccountsCGIURL+"?PRODUCTPAGE="+r)}})}}}});function UpdateSwiftLoginInfo(e){var t=$(".sub-header-links ul");if(t.length){var r=t.children();$(r[0]).remove();var i=$("div:first",$(r[1])),n=i.html(),a=e.sServing;a=a.replace("Buyer:","Hi,"),a=a.replace("|",""),a=$.trim(a),n=n.replace("<actinic:nowserving></actinic:nowserving>",a);var o=e.sMyAccountUrl;o=o.replace("|",""),n=n.replace("<actinic:myaccount></actinic:myaccount>",o);var l=e.sLogoutSimple;l=l.replace(" ",""),n=n.replace("<actinic:logout_simple></actinic:logout_simple>",l),i.html(n),i.show()}}function InitialisePaymentMethod(e){pspAccordion=document.getElementById("idPSPAccordion"+e),pspAccordion&&($("#idPSPAccordion"+e).detach().appendTo("#idPSP"+e),$("#idPSPAccordion"+e).show());var t=document.getElementById("idPaymentMethod"+e);t&&t.addEventListener("click",function(e){SetPaymentMethodsVisibility(t)})}function SetPaymentMethodsVisibility(e){g_nCurrentPspId!=e.value&&("90"==e.value&&GetAvailableFinanceProducts(),$("#idPSPinput"+g_nCurrentPspId).toggle(!1),g_nCurrentPspId=e.value,$("#idPSPinput"+g_nCurrentPspId).toggle(!0),$("#idBtnConfirm").toggle(500!=g_nCurrentPspId),doPsp(e.value))}function doPsp(e){$("#idBtnConfirm").off("click.payment"),$("#idBtnConfirm").on("click.payment",function(t){return $("body").addClass("paymentOverlayActive"),pspFunction="doPspConfirm"+e,"function"==typeof window[pspFunction]?(t.preventDefault(),void window[pspFunction]()):SubmitPSPForm()}),pspFunction="doPspSelected"+e,"function"==typeof window[pspFunction]&&window[pspFunction]()}function PostWithFetch(e,t){var r=!1;return fetch(e,{mode:"same-origin",credentials:"same-origin",method:"post",headers:{"content-type":"application/x-www-form-urlencoded"},body:t}).then(checkFetchStatus).then(function(e){var t=e.headers.get("content-type");return t&&-1!==t.indexOf("text/html")?(r=!0,e.text()):e.json()}).then(function(e){return r?(console.info("PostWithFetch: HTML response"),Promise.resolve({html:e})):e.error?(console.info("PostWithFetch: Failed",e.error.message),Promise.reject(e.error.message)):Promise.resolve(e)}).catch(function(e){throw console.error('PostWithFetch: Request "'+t+'" failed. '+e),e})}function GetPriceSchedule(){var e=0,t=getCookie("ACTINIC_BUSINESS");if(!t)return e;for(var r=t.split(/\n/),i=0;i<r.length;i++){var n=r[i].split(/\t/);if("SCHEDULE"==n[0]&&""!=n[1]){e=1*n[1];break}}return e}function GetRadioValue(e){var t=document.getElementsByName(e);for(i=0;i<t.length;i++)if(t[i].checked)return t[i].value;return null}/*************************************************************** 17* 18* ActinicSearch.js - utility functions for search functionality 19* 20* Copyright (c) 2012-2014 SellerDeck Limited 21* 22****************************************************************/ 23var g_bIsDebugging=!1,g_ErrorCode={TAG:1,LOGIC:2,IO:3,UNDEFINED:4},g_FilterDataType={STOCKFILTER:1,PRODUCTLIST:2,PRODUCTDETAILS:3,FULLPERMLIST:4,MAX:5};function ShowError(e,t){var r="";switch(t){case g_ErrorCode.TAG:r="Tag not found error";break;case g_ErrorCode.LOGIC:r="Logical error";break;case g_ErrorCode.IO:r="Input output error";break;case g_ErrorCode.UNDEFINED:r="Variable undefined error";break;default:r="Unknown error"}var i="Error: "+r+"\nMessage: "+e;g_bIsDebugging&&console.log(i)}function GetIEVersion(){var e=0;return/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&(e=new Number(RegExp.$1)),e}function GetArrayIndex(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var r=e.length,i=0;i<r;i++)if(e[i]===t)return i;return-1}function InsertSort(e){for(var t=1;t<e.length;t++){for(var r=e[t],i=t;e[i-1]>r;)e[i]=e[i-1],--i;e[i]=r}return e}function IsPreview(){return 0==window.location.href.indexOf("file://")}function EscapeRegExp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function AutoSuggest(e){var t=500,r=!1,i,n=new Array,a=new Array,o={},l="",s=0,c={ENTER:13,ESC:27,SPACE:32,LEFTARROW:37,UP:38,RIGHTARROW:39,DOWN:40};if("undefined"!=typeof pg_sSearchScript&&e){"Quick Search"===e.value&&(e.value="");var d=document.createElement("div"),u=findPosX(e),p=findPosY(e);p+=e.offsetHeight,d.style.left=u+"px",d.style.top=p+"px";var g=document.createElement("ul");g.style.display="none",d.className="sf_suggestion",g.style.width=e.offsetWidth+"px",d.appendChild(g),e.parentNode.appendChild(d),e.onblur=function(){d.parentNode===e.parentNode&&e.parentNode.removeChild(d)},e.onkeypress=function(t){return e.AS_getKeyCode(t)==c.ENTER&&"none"!=g.style.display&&0!=s&&(e.AS_selectList(),s=0),!0},e.onkeyup=function(t){switch(e.AS_getKeyCode(t)){case c.LEFTARROW:case c.RIGHTARROW:case c.ENTER:return!1;case c.ESC:e.value="",s=0,e.AS_clearList();break;case c.UP:e.AS_navList("up");break;case c.DOWN:e.AS_navList("down");break;default:""==e.value?e.AS_clearList():(e.AS_clearTimer(),e.AS_setTimer(500))}},e.AS_getListItems=function(){var t=new Array,r=new Array,i={},a,s=pg_sSearchValidWordCharacters;s=s.replace(/([\^\$\.\*\+\?\=\!\:\|\\\/\(\)\[\]\{\}])/g,"\\$1");var c=new RegExp("[^"+s+"]"),d=e.value.split(c),u="";r.length=0;for(var p=0;p<d.length;p++)d[p]&&r.push(d[p]);var g=e.AS_getChangedSearchWord(r);if(u=g[g.length-1],g.length=0,void 0!==u){var m=pg_sSearchScript,f=new ajaxObject(m);f.callback=function(n){if(""!==n){try{i=n.parseJSON()}catch(e){return}0!=i.count?(t=i.words,e.value.length>0?(e.AS_createList(t,r,u,!0),l=u):e.AS_clearList()):u&&(l=u,t.push(u),o[u]="",e.AS_createList(t,r,u,!1))}};var v="ACTION=MATCH&TEXT="+u;IsHostMode()&&(v+="&SHOP="+pg_sShopID),f.update(v,"GET"),n=r,e.AS_clearTimer()}},e.AS_getChangedSearchWord=function(t){var r=new Array;
23if(t.length>0)for(var i=0;i<t.length;i++)e.AS_findFromArray(n,t[i])?a.push(t[i]):r.push(t[i]);return r},e.AS_createList=function(t,r,i,n){if(e.AS_resetList(),t.length>0){for(var a=0;a<t.length;a++){var o=document.createElement("li");o.className="notselected";var l=document.createElement("a");l.href="javascript:void(0);",l.m_nIndex=a+1;var c=i+"<b>"+t[a].substr(i.length)+"</b>";l.innerHTML=n?c:"<strike>"+c+"</strike>",o.m_nIndex=a+1,o.onmouseover=function(){e.AS_navListItem(this.m_nIndex)},l.onmousedown=function(){return s=this.m_nIndex,e.AS_selectList(this.m_nIndex),!1},o.appendChild(l),g.setAttribute("tabindex","-1"),g.appendChild(o)}g.style.display="block"}else e.AS_clearList()},e.AS_resetList=function(){for(var e=g.getElementsByTagName("li"),t=e.length,r=0;r<t;r++)g.removeChild(e[0])},e.AS_navList=function(t){s+="down"==t?1:-1;var r=g.getElementsByTagName("li");s<1&&(s=r.length),s>r.length&&(s=1),e.AS_navListItem(s)},e.AS_navListItem=function(e){s=e;for(var t=g.getElementsByTagName("li"),r=0;r<t.length;r++)t[r].className=r==s-1?"selected":"notselected"},e.AS_selectList=function(){for(var t=g.getElementsByTagName("li"),r=t[s-1].getElementsByTagName("a")[0],i=r.innerHTML.replace(/(<strike>(.*)<\/strike>)|(<[^>]+>)/g,""),a="",c=0;c<n.length;c++)void 0===o[n[c]]&&(n[c]===l?a+=i+" ":a+=n[c]+" ");e.value=a,e.AS_clearList()},e.AS_clearList=function(){g&&(g.style.display="none",selectedIndex=0),n.length=0},e.AS_getKeyCode=function(e){var t;if(!e)var e=window.event;return e.keyCode&&(t=e.keyCode),t},e.AS_findFromArray=function(e,t){for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1},e.AS_setTimer=function(t){r||(i=setTimeout(e.AS_getListItems,t),r=!0)},e.AS_clearTimer=function(){r&&(clearTimeout(i),r=!1)}}}function AddAutoSuggest(){if(!IsPreview()){if("undefined"==typeof pg_sSearchScript||""===pg_sSearchScript){return void ShowError('Variable "pg_sSearchScript" undefined OR null, autosuggest may not work',g_ErrorCode.UNDEFINED)}for(var e=0;e<document.forms.length;e++)document.forms[e]&&document.forms[e].SS&&(document.forms[e].SS.setAttribute("autocomplete","off"),document.forms[e].SS.setAttribute("onfocus","AutoSuggest(this)"))}}$(document).ready(function(){AddAutoSuggest(),AddOnFilter(),CheckHashChangeEvent()});var g_eResultLayout={STD:1,TABULAR:2,UNDEFINED:3},gArrSortedProductRefs=new Array,gArrResultSet=new Array,gArrayDefinedPropertiesSorted=new Array,gArrProperty=new Array,gArrFilterGrpIdSorted=new Array,gMapObjProductDetails={},gMapPropIdDecoratedChoices={},gMapInvalidProdRefs={},gMapInvalidEmptyPermsProdRefs={},gMapPropNameToPropId={},gMapFilterGrpIdToFilterGrpName={},gMapParams={},gMapProdRefToDecProdRef={},g_sSearchResultsTemplate="",g_sListStartTemplate="",g_sListRowStartTemplate="",g_sListCellStartTemplate="",g_sListCellEndTemplate="",g_sListRowEndTemplate="",g_sListEndTemplate="",g_sResultLayout=g_eResultLayout.UNDEFINED,g_nListColCount=0,gMapAltProdToParentProductRef={},gMapProdToAltProdArray={},gMapMatchedProducts={},g_sDefinedPropertiesPattern,gMapRefStock={},gMapChildToParentProducts={};gArrSortedProductRefs.length=0,gArrResultSet.length=0;var g_nProductMinIndex=0,g_nProductMaxIndex=0,g_nCurrenPageNumber=0,g_nIEVersion=0,g_eFilterTimer={Cache:1,Server:2,UNDEFINED:3},g_hFilterTimer,g_bFilterTimerOn=!1,g_bFirstLoad=!1,g_bCacheStock=!0,g_bClearAll=!1,g_bHasPresetOptions=!1,g_bUseStorageFromClick=!1,g_bUseStorageSortPage=!1,g_bSortOrder="",g_eFilterSettings={FILTER:1,SORTORDER:2,PAGINATION:3},g_bMapFilteringDataReady={},g_bAllFilteringDataReady=!1,g_arrProductListJSON={};function AddOnFilter(){if(!IsPreview()){var e=document.forms.filter;if(void 0!==e){if("undefined"==typeof pg_sSearchScript||""===pg_sSearchScript){var t='Variable "pg_sSearchScript" undefined OR null, filtering may not work';return void ShowError(t,g_ErrorCode.UNDEFINED)}g_nIEVersion=GetIEVersion();for(var r=document.forms.filter.elements,i=0;i<r.length;i++)"INPUT"!==r[i].tagName||"radio"!==r[i].type&&"checkbox"!==r[i].type?"INPUT"===r[i].tagName&&"submit"===r[i].type&&r[i].setAttribute("onclick",'OnFilter(this, "link", false); return false;'):r[i].setAttribute("onclick","OnFilter(this);");var n=GetSelectWithinSortForm("filter_sortorder");if(n&&n.setAttribute("onchange","OnSort(this);"),n=GetSelectWithinSortForm("filter_sortorder_static"),n&&n.setAttribute("onchange","OnSortStatic(this);"),void 0!==e){var a=document.getElementById("SearchResults");if(a)g_sSearchResultsTemplate=a.innerHTML,g_sSearchResultsTemplate=g_sSearchResultsTemplate.replace(/(<actinic:xmltemplate name=\"ImageLine\">((.*?)|(.*?(\n))+.*?)<\/actinic:xmltemplate>)/gi,""),g_sSearchResultsTemplate=g_sSearchResultsTemplate.replace(/(<script(\s*)type=\"text\/template\">([^`]*?)<\/script>)/gi,"$3"),g_sSearchResultsTemplate=g_sSearchResultsTemplate.replace(/(<sd_script)/gi,"<script"),g_sSearchResultsTemplate=g_sSearchResultsTemplate.replace(/(<\/sd_script)/gi,"</script");else{var t='Element with id "SearchResults" not found in result template, search might not work properly';ShowError(t,g_ErrorCode.TAG)}if((g_sResultLayout=GetResultLayoutUsed())===g_eResultLayout.TABULAR){var o="",l="",s="",c="",d="",u="";o=document.getElementById("S_LISTSTART"),l=document.getElementById("S_LISTROWSTART"),s=document.getElementById("S_LISTCELLSTART"),c=document.getElementById("S_LISTCELLEND"),d=document.getElementById("S_LISTROWEND"),u=document.getElementById("S_LISTEND"),o&&(g_sListStartTemplate=o.innerHTML,g_sListStartTemplate=g_sListStartTemplate.replace(/(<)/gi,"<"),g_sListStartTemplate=g_sListStartTemplate.replace(/(>)/gi,">")),l&&(g_sListRowStartTemplate=l.innerHTML,g_sListRowStartTemplate=g_sListRowStartTemplate.replace(/(<)/gi,"<"),g_sListRowStartTemplate=g_sListRowStartTemplate.replace(/(>)/gi,">")),s&&(g_sListCellStartTemplate=s.innerHTML,g_sListCellStartTemplate=g_sListCellStartTemplate.replace(/(<)/gi,"<"),g_sListCellStartTemplate=g_sListCellStartTemplate.replace(/(>)/gi,">")),c&&(g_sListCellEndTemplate=c.innerHTML,g_sListCellEndTemplate=g_sListCellEndTemplate.replace(/(<)/gi,"<"),g_sListCellEndTemplate=g_sListCellEndTemplate.replace(/(>)/gi,">")),d&&(g_sListRowEndTemplate=d.innerHTML,g_sListRowEndTemplate=g_sListRowEndTemplate.replace(/(<)/gi,"<"),g_sListRowEndTemplate=g_sListRowEndTemplate.replace(/(>)/gi,">")),u&&(g_sListEndTemplate=u.innerHTML,g_sListEndTemplate=g_sListEndTemplate.replace(/(<)/gi,"<"),g_sListEndTemplate=g_sListEndTemplate.replace(/(>)/gi,">"))}ResetSortOrder()}CacheProperties(),CacheFilterSections(),CacheDefinedPriceBands(),CachePriceBandPriceRange(),CacheDefinedChoices(),SetDefaultSelection(),SortFilterGroup(),g_bHasPresetOptions=HasPresetFilterOptions(),SetSelectionMapsFromStorage(),SetStoredPageNumber(),IsFilterCountEnabled()?OnFilter(null,null,!0):(GenerateDynamicFilterOptions(),IsFilterAsDefaultView()?OnFilter(null,null,!0):OnFilter(null,null,!1)),HideModifyStaticControls()}}}function HasFilterStorage(){var e=SDStorage.readPage("filterSettings");return null!==e&&""!==e}function IsUseFilterStorage(){return-1!=window.location.hash.search("usestorage")}function CacheProperties(){for(var e=0;e<pg_arrayPropertyName.length;e++)if(void 0!==pg_arrayPropertyName[e]){var t=pg_arrayPropertyName[e].replace(/(_)/g,"_"),r=t.split(":"),i=r[0],n=r[1],a=i.substr(i.lastIndexOf("_")+1),o=(n+"_"+a).toUpperCase();gMapPropNameToPropId[o]=i,gMapFilterGrpIdToFilterGrpName[i]=o,gArrFilterGrpIdSorted.push(i),gArrayDefinedPropertiesSorted.push(o),gArrProperty.push(i)}InsertSort(gArrayDefinedPropertiesSorted),g_sDefinedPropertiesPattern="-"+gArrayDefinedPropertiesSorted.join("--")+"-"}function SortFilterGroup(){InsertSort(gArrFilterGrpIdSorted)}function GetSelectWithinSortForm(e){var t=document.forms[e];if(void 0!==t){var r=t.elements;if(void 0!==r)for(var i=0;i<r.length;i++)if("SELECT"===r[i].tagName)return r[i]}return null}
23function OnFilter(e,t,r,i){var n="",a=document.forms.filter;if(void 0!==e&&null!==e&&AppendUseStorageHash(g_eFilterSettings.FILTER),g_bUseStorageFromClick&&ResetAllStorage(),ResetSortOrder(),void 0!==e&&null!==e&&-1!=g_nCurrenPageNumber&&SetCurrentPageNumber(0),g_bFirstLoad=!!r,g_bClearAll=!!i,g_bFirstLoad||ClearCtrlSelectionMap(),ClearURLParamCache(),ShowLoadingDialog(),n+="PAGE=DynamicFilter&",void 0!==e&&void 0!==t&&"link"===t&&!g_bFirstLoad&&"update_lnk"!==e.id&&"update_btn"!==e.id){var o="hf_"+e.name,l="";l=document.getElementById(o),l&&l.parentNode.removeChild(l);var s="";s="PR"===e.name?"hf_PR":"SX"===e.name?"hf_SX":"hf_"+e.id;var c="";if(g_nIEVersion<9&&0!==g_nIEVersion?c=document.createElement('<input name="'+s+'">'):(c=document.createElement("input"),c.name=s),c.id="hf_"+e.name,c.type="hidden",c.value=e.value,e.parentNode.appendChild(c),null!==e.parentNode){EditLabel(GetParent("li",e))}}if(ReadFilterParamsFromPage(),IsFilterCountEnabled()&&HideOptionAny(),ClearButtonHandler(),!IsFilterCountEnabled()&&!IsFilterAsDefaultView()||g_bFirstLoad){if(!g_bFirstLoad&&(g_bClearAll||GetClearButtonCount()<1))return void HideLoadingDialog();
23g_bFirstLoad&&g_bCacheStock&&CacheStockFilter(),GetAllProductDetails()}else ClearFilterTimer(),SetFilterTimer(g_eFilterTimer.Cache)}function ReadFilterParamsFromPage(){for(var e=document.forms.filter,t=e.elements,r=0;r<t.length;r++){var i="",n="",a="",o=!1,l="",s="",c=!1;if("INPUT"!==t[r].tagName||"checkbox"!==t[r].type&&"radio"!==t[r].type)if("INPUT"===t[r].tagName&&"hidden"===t[r].type&&"PAGE"!==t[r].name&&"FILTERPAGE"!==t[r].name&&"ACTINIC_REFERRER"!==t[r].name&&"Action"!==t[r].name&&null===t[r].name.match(/hf_/g))l=t[r].name,s=t[r].value,o=!0;else if("SELECT"===t[r].tagName){var d=t[r];a=GetSelections(d),o=!1,c=!0}else if("INPUT"===t[r].tagName&&"hidden"===t[r].type){if("hf_"===t[r].name.substr(0,3)){var u=t[r].name.substr(3,t[r].name.length);l=u.split("-")[0],s=t[r].value,"PR"===l||"SX"===l?i=s:(i=u,n=s),o=!0}}else o=!1;else!0===t[r].checked?(l=t[r].name,s=t[r].value,"SX"===l?i=s:(i=t[r].id,n=t[r].value),o=!0):o=!1;if(o){var p=encodeURIComponent(s).replace(/!|'|\(|\)|\*|%20|%C2/g,function(e){return{"!":"%21","'":"%27","(":"%28",")":"%29","*":"%2A","%20":"+","%C2":""}[e]});g_bFirstLoad||GetControlSelections(l,i,n),CacheURLParams(l,p)}}}function ClearButtonHandler(){for(var e in gMapFilters){ShowHideClearButton(IsShowClearButton(e),e)}GetClearButtonCount()<1&&ShowSectionContent()}function SetFilterTimer(e,t){g_bFilterTimerOn||(g_hFilterTimer=setTimeout(function(){e===g_eFilterTimer.Cache?FilterProductsFromCache():e===g_eFilterTimer.Server&&FilterProductsFromServer(t)},25),g_bFilterTimerOn=!0)}function ClearFilterTimer(){g_bFilterTimerOn&&(clearTimeout(g_hFilterTimer),g_bFilterTimerOn=!1)}function FilterProductsFromServer(e){if("undefined"!=typeof pg_aSearchProductList)return void FilterDataReceived(g_FilterDataType.PRODUCTLIST,JSON.stringify(pg_aSearchProductList),200,!1,e,!1);if(!IsLoggedIn()&&"undefined"!=typeof pg_bFilteringCacheEnabled&&0!==pg_bFilteringCacheEnabled&&(IsFilterCountEnabled()||IsFilterAsDefaultView())){var t=new XMLHttpRequest,r="AjaxProductList_"+pg_nUploadReferenceNumber+"_"+pg_nCurrentFilterSectionID+".js";try{return t.open("GET",GetFilterCacheURL(r)),t.onreadystatechange=function(){this.readyState===this.DONE&&FilterDataReceived(g_FilterDataType.PRODUCTLIST,t.responseText,t.status,!1,e,!1)},void t.send()}catch(e){}}GetProductListFromServer(e)}function GetProductListFromServer(e){var t=pg_sSearchScript,r=new ajaxObject(t);r.callback=function(t,r){FilterDataReceived(g_FilterDataType.PRODUCTLIST,t,r,!1,e,!0)},r.update(e,"GET")}function ProcessProductList(e){if(0!=e.ProductSearchResults.ResultCount){gArrResultSet.length=0,gArrResultSet=e.ProductSearchResults.ResultSet;DoSort(GetSortOrder(),gArrResultSet),RetrieveProductDetails(g_nCurrenPageNumber,!0)}else g_bFirstLoad&&!IsFilterAsDefaultView()||FormatResultHTML(!1,null,null,!1),HideLoadingDialog()}function FilterProductsFromCache(){if(GetClearButtonCount()<1?(ClearCtrlSelectionMap(),g_bClearAll=!0):g_bClearAll=!1,g_bClearAll&&!IsFilterAsDefaultView())return UpdateFilterCount(),void HideLoadingDialog();var e="";g_bClearAll||(e=GetFilterPatternForResult()),gArrResultSet.length=0;var t=GetFilteredProducts(e);gArrResultSet=GetDecoratedProdRefs(t),DoSort(GetSortOrder(),gArrResultSet),RetrieveProductDetails(g_nCurrenPageNumber,!0)}function GetDecoratedProdRefs(e){for(var t=new Array,r=0;r<e.length;r++){var i=e[r];void 0!==gMapProdRefToDecProdRef[i]&&t.push(gMapProdRefToDecProdRef[i])}return t}function GetFilterPatternForResult(){var e={},t="";for(var r in gMapFilterGrpIdToFilterGrpName)if(void 0!==gMapControlToSelection[r]){var i=gMapControlToSelection[r],n=new Array,a="";if("PR"===r)for(var o in i){var l=r+"_"+o;n.push(l)}else if("SX"===r){var s={};for(var o in i){s[o]="";for(var c=gMapFilters.SX[o].m_arrSubSectionIds,d=0;d<c.length;d++)-1!==GetArrayIndex(gArraySectionIDs,c[d])&&(s[c[d]]="")}for(var u in s){var l=r+"_"+u;n.push(l)}}else for(var p in i)if(void 0!==gMapControlIdChoiceName[p]){var l=r+":"+gMapControlIdChoiceName[p];n.push(l)}n.length>0&&(e[r]="(\\!"+n.join("\\!|\\!")+"\\!)")}for(var g=0;g<gArrFilterGrpIdSorted.length;g++){var m=gArrFilterGrpIdSorted[g];void 0!==e[m]&&(t.length>0&&(t+=".*"),t+=e[m])}return t}function CacheURLParams(e,t){void 0!==gMapParams[e]?gMapParams[e].push(t):(gMapParams[e]=new Array,gMapParams[e].push(t))}function ClearURLParamCache(){for(var e in gMapParams)gMapParams[e]=new Array}function GetURLParam(e){var t="",r=!1;if(e&&UpdateDefaultParams(),(IsFilterAsDefaultView()||IsFilterCountEnabled())&&g_bFirstLoad){for(var i in gMapDefCtrlSelections)void 0!==gMapParams[i]&&(gMapParams[i]=new Array,gMapParams[i].push(""));void 0!==gMapParams.PR&&(gMapParams.PR=new Array,gMapParams.PR.push("-1")),void 0!==gMapParams.SX&&(gMapParams.SX=new Array,gMapParams.SX.push("-1"))}for(var n in gMapParams){var a=gMapParams[n],o=a.length;if(0!=o)for(var l=0;l<o;l++){var s=a[l];t+=n+"="+s+"&"}else{var s="";"PR"!==n&&"SX"!==n||(s="-1"),t+=n+"="+s+"&"}}return t}function UpdateDefaultParams(){var e="";for(var t in gMapDefCtrlSelections){var r=t+"-"+gMapDefCtrlSelections[t],i="";
23void 0!==gMapControlIdChoiceName[r]&&(i=gMapControlIdChoiceName[r]);var n=encodeURIComponent(i).replace(/!|'|\(|\)|\*|%20|%C2/g,function(e){return{"!":"%21","'":"%27","(":"%28",")":"%29","*":"%2A","%20":"+","%C2":""}[e]});void 0!==gMapParams[t]&&(gMapParams[t]=new Array,gMapParams[t].push(n))}void 0!==gMapParams.PR&&(gMapParams.PR=new Array,gMapParams.PR.push("-1")),void 0!==gMapParams.SX&&(gMapParams.SX=new Array,gMapParams.SX.push("-1"))}function GetSelections(e){for(var t="",r="",i="",n=0;n<e.options.length;n++)if(!0===e.options[n].selected){var a=e.name,o=encodeURIComponent(e.options[n].value);t+=a+"="+o+"&","PR"===a||"SX"===a?r=e.options[n].value:(r=e.options[n].id,i=e.options[n].value),g_bFirstLoad||GetControlSelections(a,r,i),CacheURLParams(a,o)}return t}function ValidateMultipleListBox(e){for(var t=0,r=0;r<e.options.length;r++)!0===e.options[r].selected&&t++}function DoSort(e,t){var r=pg_sSortOrdersPrependedToProdRefs,i=e.split("_");i.push("0","0","0","0");for(var n=0;n<i.length;n++)i[n]=parseInt(i[n]);for(var a=r.split(","),n=0;n<a.length;n++)a[n]=parseInt(a[n]);var o={0:1,1:-1,2:1,3:-1,4:1,5:-1,6:1,7:-1,8:-1,9:-1,10:1,11:-1,12:1,13:-1,14:1,15:-1},l={0:0,1:1,2:2,3:2,4:4,5:4,6:6,7:7,8:8,9:9,10:10,11:10,12:12,13:12,14:14,15:14},s=a.length,c="^";c+="([0-9]*):",c+="([i|v])";for(var d=0;d<s;d++)c+="([0-9A-Za-z?_]{2}|{[0-9A-Za-z?_]{3}|}[0-9A-Za-z?_]{4})";c+="(.*)$";var u=new RegExp(c),p={};gArrSortedProductRefs.length=0;for(var n=0;n<t.length;n++){var g=t[n].match(u);if(g){var m=g[s+3],f=m.split(":");2==f.length&&(m=f[0],gMapAltProdToParentProductRef[m]=f[1]),gArrSortedProductRefs[n]=m,g[1]=String("0000000000"+g[1]).substr(-10,10),p[m]=g,"i"===g[2]&&(gMapInvalidProdRefs[m]=""),((IsFilterCountEnabled()||IsFilterAsDefaultView())&&g_bFirstLoad||!IsFilterCountEnabled())&&(gMapProdRefToDecProdRef[m]=t[n])}else{ShowError("Logical error occurred during sorting",g_ErrorCode.LOGIC)}}for(var v={},S=0;S<s;S++)v[a[S]]=S+3;v[0]=s+3,v[1]=1;var h=new Array(o[i[0]],o[i[1]],o[i[2]],o[i[3]]),P=new Array(v[l[i[0]]],v[l[i[1]]],v[l[i[2]]],v[l[i[3]]]);gArrSortedProductRefs.sort(function(e,t){for(var r,i,n=0;n<4;n++){if(r=p[e][P[n]],i=p[t][P[n]],r<i)return-1*h[n];if(r>i)return h[n]}return 0})}function RetrieveProductDetails(e,t){var r=!1,i=!1;ShowLoadingDialog(),SetCurrentPageNumber(e),StoreSettings();var n=GetProdRefsOfNonCachedProductDetails(gArrSortedProductRefs);n.length>0&&(r=!0),i=n.length===gArrSortedProductRefs.length;var a=!1;if((t||r)&&(a=!0),"undefined"!=typeof pg_aSearchProductDetails)return void FilterDataReceived(g_FilterDataType.PRODUCTDETAILS,JSON.stringify(pg_aSearchProductDetails),200,a,"",!1);if(r)if(IsLoggedIn()||"undefined"==typeof pg_bFilteringCacheEnabled||0===pg_bFilteringCacheEnabled||!IsFilterCountEnabled()&&!IsFilterAsDefaultView())UpdateProductDetailsFromServer(n,i,a);else{var o=new XMLHttpRequest,l="AjaxProductDetails_"+pg_nUploadReferenceNumber+"_"+pg_nCurrentFilterSectionID+".js";o.open("GET",GetFilterCacheURL(l)),o.onreadystatechange=function(){this.readyState===this.DONE&&FilterDataReceived(g_FilterDataType.PRODUCTDETAILS,o.responseText,o.status,a,"",!1)},o.send()}else if(0!==gArrSortedProductRefs.length){var s=IsFilterAsDefaultView(),c=HasFilterStorage();if(!g_bFirstLoad||s||c){if((s||IsFilterCountEnabled())&&t){var d=GetFilterPatternForResult();gArrResultSet.length=0;var u=GetFilteredProducts(d);gArrResultSet=GetDecoratedProdRefs(u);var p=GetSortOrder();DoSort(p,gArrResultSet)}FormatResultHTML(!0,gArrSortedProductRefs,e,a)}else UpdateFilterCount()}else g_bFirstLoad&&!IsFilterAsDefaultView()||FormatResultHTML(!0,null,
23null,a)}function UpdateProductDetailsFromServer(e,t,r){for(var i="",n=0;n<e.length;n++)void 0!==e[n]&&(i+=e[n],n+1<e.length&&(i+="_"));var a=pg_sSearchScript,o={},l=new ajaxObject(a);if(l.callback=function(e,t){FilterDataReceived(g_FilterDataType.PRODUCTDETAILS,e,t,r,"",!0)},i="PAGE=DynamicFilter&DPR="+i,IsSearchBySubSection()&&g_bFirstLoad){for(var s="",c=0;c<gArraySectionIDs.length;c++)s+=gArraySectionIDs[c],c+1<gArraySectionIDs.length&&(s+="_");""!==s&&(i+="&SIDS="+s)}t&&(i+="&SID="+pg_nCurrentFilterSectionID),IsHostMode()&&(i+="&SHOP="+pg_sShopID),l.update(i,"POST")}function ShowJSONError(e){void 0!==e&&e.length>500&&(e=e.substring(0,500)+"...");var t="The filter operation returned a script error. Please try again, and contact us if the error persists. The error was: \n\n["+e+"]";alert(t)}function UpdateProductDetails(e,t){var r=e.ProductDetails.ProductInfoCount;if(void 0!==e.SectionDetails&&0!=e.SectionDetails.SectionInfoCount&&CacheSectionDetails(e.SectionDetails.SectionInfoSet),0!=r){var i=new Array;i=e.ProductDetails.ProductInfoSet,CacheProductDetails(i),CacheProductDetailsWithFullPermutation(t),IsPayPalPayLaterEnabled()&&(UpdatePayPalPayLaterMessages(),RenderPayPalPayLaterMessages())}}function UpdateProductDetailsHelper(e){var t=HasFilterStorage();g_bFirstLoad&&IsFilterCountEnabled()&&(g_bHasPresetOptions||t)&&(CalculateCount(!0),RemoveFilterWithZeroCount(),ClearFilterCounts());var r=IsFilterAsDefaultView();if(!g_bFirstLoad||r||t){if(r||IsFilterCountEnabled()){var i=GetFilterPatternForResult();gArrResultSet.length=0;var n=GetFilteredProducts(i);gArrResultSet=GetDecoratedProdRefs(n);DoSort(GetSortOrder(),gArrResultSet)}FormatResultHTML(!0,gArrSortedProductRefs,g_nCurrenPageNumber,e)}else UpdateFilterCount(),HideLoadingDialog()}function CacheProductDetailsWithFullPermutation(e){var t=GetProdRefForFullPermutation();if(""==t)return void UpdateProductDetailsHelper(e);var r=new Array,i=pg_sSearchScript,n=new ajaxObject(i);n.callback=function(t,r){FilterDataReceived(g_FilterDataType.FULLPERMLIST,t,r,e)},sParams="ACTION=FULLPERMLIST&PRODREF="+t,n.update(sParams,"GET")}function SetSelectionMapsFromStorage(){if(HasFilterStorage()){var e=SDStorage.readPage("filterSettings");ClearCtrlSelectionMap(),arrSettings=e.split(",");for(var t=0;t<arrSettings.length;t++){var r=arrSettings[t].split(":"),i=r[0],n=r[1];if(void 0===gMapControlToSelection[i]?(gMapControlToSelection[i]={},gMapControlToSelection[i][n]=""):gMapControlToSelection[i][n]="","PR"===i||"SX"===i?gMapCtrlSelections[arrSettings[t]]=!0:gMapCtrlSelections[n]=!0,void 0!==gMapFilterGrpIdToFilterGrpName[i]&&void 0!==gMapControlIdChoiceName[n]){var a=(gMapFilterGrpIdToFilterGrpName[i]+":"+gMapControlIdChoiceName[n]).toUpperCase();gMapPropCtrlSelections[a]=!0,void 0===gMapPropIdToSelections[i]&&(gMapPropIdToSelections[i]=new Array),-1==GetArrayIndex(gMapPropIdToSelections[i],a)&&(gMapPropIdToSelections[i].push(a),gMapPropIdToSelections[i].length>0&&InsertSort(gMapPropIdToSelections[i]))}}}}function HasPresetFilterOptions(){var e=!1;for(var t in gMapFilters)if("PR"!==t&&"SX"!==t)for(var r=gMapFilters[t].m_mapChoices,i=1;void 0!==r[i];){var n=r[i].m_sChoiceID;void 0!==gMapCtrlSelections[n]&&""!==gMapFilters[t].m_mapChoices[i].m_sChoiceName&&(e=!0),i++}return e}function FormatResultHTML(e,t,r,i){i&&FilterProductsBasedOnPerms();var n=document.getElementById("ContentPage");n&&(n.style.display="none");var a=document.getElementById("filter_results_area");a&&(a.style.cssText="display:block");var o=document.getElementById("search_results_list");o&&(o.style.cssText="display:block");var l=document.getElementById("SortBy");if(l&&(l.style.cssText="display:block"),$(".search_result_template").show(),ReloadCarousels(),!e||0===gArrSortedProductRefs.length){return UpdateResultContent("No matching products were found."),UpdateResultSummary(!1),UpdatePaginatedLinks(!1),i&&UpdateFilterCount(),gArrSortedProductRefs.length=0,gArrResultSet.length=0,HideLoadingDialog(),void $("#search_sidebar").hide()}g_sResultLayout===g_eResultLayout.TABULAR?FormatTabularResult(r):FormatStandardResult(r),i&&UpdateFilterCount()}function FormatStandardResult(e){var t="",r="",i=GetPaginatedProducts(gArrSortedProductRefs,e);0==i.length&&(e=0,i=GetPaginatedProducts(gArrSortedProductRefs,e));for(var n=0;n<i.length;n++){var a=new ProductDetails;a=GetProductDetails(i[n]),void 0!==a&&(r=ReplaceResultTemplates(a,n),t+='<div class="std-product-details">'+r+"</div>")}UpdateResultContent(t),UpdateResultSummary(!0);var o=CreateSearchResultPageLinks();o[1]<2?UpdatePaginatedLinks(!1):UpdatePaginatedLinks(!0,o[0]),HideLoadingDialog()}function FormatTabularResult(e){var t="",r="",i="",n=GetPaginatedProducts(gArrSortedProductRefs,e);0==n.length&&(e=0,n=GetPaginatedProducts(gArrSortedProductRefs,e));for(var a=!1,o=0;o<n.length;o++){var l=new ProductDetails;l=GetProductDetails(n[o]),void 0!==l&&(r=ReplaceResultTemplates(l,o),g_nListColCount>1?((o+1)%g_nListColCount==0?(i+=g_sListCellStartTemplate+r+g_sListCellEndTemplate,a=!0):(i+=g_sListCellStartTemplate+r+g_sListCellEndTemplate,a=!1),a?(t+=g_sListRowStartTemplate+i+g_sListRowEndTemplate,i=""):o+1===n.length&&(t+=g_sListRowStartTemplate+i+g_sListRowEndTemplate)):t+=g_sListRowStartTemplate+g_sListCellStartTemplate+r+g_sListCellEndTemplate+g_sListRowEndTemplate)}t=g_sListStartTemplate+t+g_sListEndTemplate;var s=CreateSearchResultPageLinks();s[1]<2?UpdatePaginatedLinks(!1):UpdatePaginatedLinks(!0,s[0]),UpdateResultContent(t),HideLoadingDialog()}function ReplaceResultTemplates(objProductDetails,nProdCount){var nProductCount=g_nProductMinIndex+1+nProdCount,sResultTemplate=g_sSearchResultsTemplate;
23for(sResultTemplate=ReplaceProductDetailstemplate(objProductDetails,sResultTemplate,nProductCount);sResultTemplate.match(/<Actinic:ScriptFunctionCall[^>]*>([^`]*?)<\/Actinic:ScriptFunctionCall>/i);){var arrMatch=sResultTemplate.match(/<Actinic:ScriptFunctionCall[^>]*>([^`]*?)<\/Actinic:ScriptFunctionCall>/i);if(arrMatch[1]){var scriptResult="";try{scriptResult=eval(arrMatch[1])}catch(e){console.log("Error in evaluating the statement: "+arrMatch[1])}sResultTemplate=sResultTemplate.replace(/<Actinic:ScriptFunctionCall[^>]*>([^`]*?)<\/Actinic:ScriptFunctionCall>/i,scriptResult)}}return sResultTemplate}function ReplaceProductDetailstemplate(e,t,r){var i=FormatPrices(e.m_sPrice);t=t.replace(/(<Actinic:S_ITEM><\/Actinic:S_ITEM>)/gi,r);var n="",a=GetPriceSchedule();if(IsLoggedIn()&&"undefined"!=typeof pg_sCustomerAccountsCGIURL&&""!==pg_sCustomerAccountsCGIURL&&a>1){var o="";IsHostMode()&&(o="SHOP="+pg_sShopID+"&"),n='<a href="'+pg_sCustomerAccountsCGIURL+"?"+o+"PRODUCTPAGE="+e.m_sAnchor+'">'}else n='<a href="'+e.m_sAnchor+'">';var l="("+e.m_sSection+") ",s=e.m_sSid,c=i+" ",d=e.m_sDescription+" ";if(t=t.replace(/((<|<)Actinic:S_PNAME(>|>)(<|<)\/Actinic:S_PNAME(>|>))/gi,e.m_sName),t=t.replace(/(<Actinic:S_SNAME><\/Actinic:S_SNAME>)/gi,l),t=t.replace(/(<Actinic:S_SID><\/Actinic:S_SID>)/gi,s),t=t.replace(/(<Actinic:S_LINK><\/Actinic:S_LINK>)/gi,n),t=t.replace(/(<Actinic:S_PRAWPRICE><\/Actinic:S_PRAWPRICE>)/gi,e.m_sPrice),t=t.replace(/(<Actinic:S_PRICE><\/Actinic:S_PRICE>)/gi,c),t=t.replace(/(<Actinic:S_DESCR><\/Actinic:S_DESCR>)/gi,d),t=t.replace(/(<Actinic:S_STOCK><\/Actinic:S_STOCK>)/gi,e.m_nStockLevel),""==e.m_sImage&&"undefined"!=typeof pg_sDefaultProductImage&&(e.m_sImage=pg_sDefaultProductImage),""!==e.m_sImage){var u=/(<div[^>]*ResultImage[^>]*>([^`]*?)<\/div>)/gim,p=new Array;if(null!=(p=u.exec(t))){var g=p[2],m="";"undefined"!=typeof pg_nProductImageWidth&&pg_nProductImageWidth>0&&(m+='width="'+pg_nProductImageWidth+'" '),"undefined"!=typeof pg_nProductImageHeight&&pg_nProductImageHeight>0&&(m+='height="'+pg_nProductImageHeight+'"'),g=g.replace(/=\"\"/gi,""),g=g.replace(/netquotevar:thumbnailsize/gi,m);var f=DecodeHtmlEntity(e.m_sImage);f=EncodeHtmlEntity(f.substr(0,f.lastIndexOf("."))+".webp"),g=g.replace(/NETQUOTEVAR:THUMBNAIL\b/gi,e.m_sImage),g=g.replace(/NETQUOTEVAR:THUMBNAILWEBP\b/gi,f),t=t.replace(u,g)}}else t=t.replace(/(<div[^>]*ResultImage[^>]*>([^`]*?)<\/div>)/gi,"");if(pg_bShowProductFeedback){var u=/(<div[^>]*ResultFeefoLogo[^>]*>([^`]*?)<\/div>)/gim,p=new Array;if(null!=(p=u.exec(t))){var v=p[2];v=v.replace(/((<|<)Actinic:S_PRODREF(>|>)(<|<)\/Actinic:S_PRODREF(>|>))/g,e.m_sProdRef),v=v.replace(/((<|<)ACTINIC:S_PRODREF(>|>)(<|<)\/ACTINIC:S_PRODREF(>|>))/g,e.m_sProdRef.toUpperCase()),t=t.replace(u,v)}}else t=t.replace(/(<div[^>]*ResultFeefoLogo[^>]*>([^`]*?)<\/div>)/gi,"");return t=UpdateUDPVariableTemplates(e,t)}function UpdateUDPVariableTemplates(e,t){for(var r in e.m_mapUDPs)if(r){var i=EscapeRegExp(DecodeHtmlEntity(r)),n='(((<)|(<))actinic:template[^((>)|(>))]*name=((")|("))'+i+'((")|("))((>)|(>))((<)|(<))/actinic:template((>)|(>)))';t=t.replace(new RegExp(n,"ig"),e.m_mapUDPs[r])}return t=t.replace(/(<actinic:template[^>]*name[^>]*>([^`]*?)<\/actinic:template>)/gi,"")}var DecodeHtmlEntity=function(e){return e.replace(/&#(\d+);/g,function(e,t){return"39"==t||"34"==t?"\\"+String.fromCharCode(t):String.fromCharCode(t)})},EncodeHtmlEntity=function(e){for(var t=[],r=e.length-1;r>=0;r--)t.unshift(["&#",e[r].charCodeAt(),";"].join(""));return t.join("")};function ProductDetails(){this.m_sProdRef="",this.m_sSid="",this.m_sName="",this.m_sDescription="",this.m_sSection="",this.m_sImage="",this.m_sAnchor="",this.m_sPrice="",this.m_mapProperties={},this.m_mapCompToPermutation={},this.m_sDecSection="",this.m_sDecPriceBand="",this.m_sDecFilterString="",this.m_mapDecChoices={},this.m_mapUDPs={},this.m_nStockLevel,this.m_bFullPermutation=!1}function ProductProperties(){this.m_mapChoices={},this.m_sPropID="",this.m_bShow=!1,this.m_bHideAlways=!1}function FilterChoiceDetails(){this.m_sChoiceID="",this.m_sChoiceN
23ame="",this.m_nChoiceCount=0,this.m_bHideAlways=!1}function SetProductDetails(e,t){e.m_sProdRef=t[0],e.m_sSid=t[1],e.m_sName=t[2],e.m_sDescription=t[3],e.m_sSection=t[4],e.m_sImage=t[5],e.m_sAnchor=t[6],e.m_sPrice=t[7];var r=t[8],i=t[9],n=t[10],a=t[11];e.m_nStockLevel=t[14];var o=n.split(",");if(""!=i)for(var l=i.split("|"),s=0;s<l.length;s++){var c=l[s];""!=c&&(c=DecodeHtmlEntity(c),void 0===gMapChildToParentProducts[c]&&(gMapChildToParentProducts[c]=new Array),gMapChildToParentProducts[c].push(e.m_sProdRef))}for(var d=new Array,u=0;u<o.length;u++){var p=o[u].split("!"),g=p[0],m="S_"+g;if(void 0!==gMapFilterGrpIdToFilterGrpName[m]){e.m_mapProperties[m]=new ProductProperties;for(var f=1;f<p.length;f++){SetProductProperties(e,m,d,g,p[f].replace(/(^\s*)|(\s*$)/gi,""))}}}var v=!1;if(""!==r)for(var S=r.split(","),h=0;h<S.length;h++){var P=/(<(.*)>(.*))/gim,C=P.exec(S[h]);if(null!==C&&""!==C[2]){var _=C[2].toUpperCase().split(":");InsertSort(_);for(var I=_.join(":"),A=0;A<_.length;A++)void 0===gMapPropNameToPropId[_[A]]&&(_.splice(A,1),A--);var T=C[3];if(""===T){void 0===e.m_mapCompToPermutation[I]&&(e.m_mapCompToPermutation[I]="EMPTY",v=!0);continue}for(var y=T.toUpperCase().split("|"),b=0;b<y.length;b++){for(var R=y[b].split("!!"),E=0;E<R.length;E++){var D=R[E].split("!");void 0===gMapPropNameToPropId[D[0]]&&(R.splice(E,1),E--)}InsertSort(R);var L="\\-"+R.join("\\-.*\\-")+"\\-",M=L.split("!"),F=new RegExp(M.join("\\:"),"i");void 0!==e.m_mapCompToPermutation[I]&&"EMPTY"!==e.m_mapCompToPermutation[I]&&"OSTOCK"!==e.m_mapCompToPermutation[I]||(e.m_mapCompToPermutation[I]=new Array),e.m_mapCompToPermutation[I].push(F)}}}else e.m_mapCompToPermutation.EMPTY="";if(v&&void 0!==gMapInvalidProdRefs[e.m_sProdRef]){ 24for(I in e.m_mapCompToPermutation)"EMPTY"!==e.m_mapCompToPermutation[I]&&(v=!1);v&&(gMapInvalidEmptyPermsProdRefs[e.m_sProdRef]=0)}if(IsFilterCountEnabled()||IsFilterAsDefaultView()){var N=GetPriceBand(parseInt(e.m_sPrice));e.m_sDecPriceBand=N;var O="PR_"+N;d.push(O),e.m_sDecSection=e.m_sSid;var w="SX_"+e.m_sSid;d.push(w)}InsertSort(d);var k="!"+d.join("!!")+"!";e.m_sDecFilterString=k;for(var B=a.split(","),G=0;G<B.length;G++){var H=B[G].split("|");e.m_mapUDPs[H[0]]=H[1]}}function SetProductProperties(e,t,r,i,n){if(objProductProperties=e.m_mapProperties[t],objProductProperties.m_sPropID=i,"!"===n)return void(objProductProperties.m_mapChoices[0]="");for(var a=n.split("!"),o=0;o<a.length;o++){var l=a[o].replace(/(^\s*)|(\s*$)/gi,""),s=l.replace(/( )/gi," ");if(objProductProperties.m_mapChoices[s]=o,""!==s){var c="S_"+i+":"+s;r.push(c),e.m_mapDecChoices[c.toUpperCase()]=""}}}function OnSortStatic(e){var t=e.selectedIndex,r=GetSelectWithinSortForm("filter_sortorder");r&&(r.selectedIndex=t),OnSort(e)}function OnSort(e){var t=document.forms.filter_sortorder,r=e.selectedIndex,i=e.options[r].value;g_bSortOrder=i,AppendUseStorageHash(g_eFilterSettings.SORTORDER),-1!=g_nCurrenPageNumber&&SetCurrentPageNumber(0),ShowLoadingDialog(),UpdateSortOrder(i),DoSort(i,gArrResultSet),RetrieveProductDetails(g_nCurrenPageNumber,!1)}function OnPagination(e){AppendUseStorageHash(g_eFilterSettings.PAGINATION),RetrieveProductDetails(e,!1),$(function(){$("html, body").animate({scrollTop:$("#SortBy").offset().top},"slow")})}function AppendUseStorageHash(e){if(SDStorage.isSupported()){var t=!1;""==window.location.hash?(window.location.hash="#usestorage",t=!0):""!=window.location.hash&&-1!=window.location.hash.indexOf("usestorage")?t=!1:(window.location.hash="#usestorage",t=!0),e==g_eFilterSettings.FILTER?g_bUseStorageFromClick=t:g_bUseStorageSortPage=t}}function StoreSettings(){if(IsUseFilterStorage()){var e="",t=new Array,r=0,i=!1;for(var n in gMapControlToSelection){var a=gMapControlToSelection[n];for(var o in a){var l=n+":"+o;t[r++]=l,i=!0}}i&&(e=t.join(",")),SDStorage.writePage("filterSettings",e),SDStorage.writePage("sortOrder",g_bSortOrder),SDStorage.writePage("pageNumber",g_nCurrenPageNumber)}}function ResetAllStorage(){ResetStorage(g_eFilterSettings.FILTER),ResetStorage(g_eFilterSettings.SORTORDER),ResetStorage(g_eFilterSettings.PAGINATION)}function ResetStorage(e){switch(e){case g_eFilterSettings.FILTER:SDStorage.writePage("filterSettings","");break;case g_eFilterSettings.SORTORDER:g_bSortOrder=pg_sDefaultSortOrder,SDStorage.writePage("sortOrder",g_bSortOrder);break;case g_eFilterSettings.PAGINATION:g_nCurrenPageNumber=0,SDStorage.writePage("pageNumber",g_nCurrenPageNumber)}}function GetProductDetails(e){return gMapObjProductDetails[e]}function IsProductDetailsCached(e){var t=!1;return void 0!==gMapObjProductDetails[e]&&(t=!0),t}function GetPaginatedProducts(e,t){var r=new Array;0===pg_nSearchResultsLimit||-1===t?(g_nProductMinIndex=0,g_nProductMaxIndex=e.length+1):(g_nProductMinIndex=t*pg_nSearchResultsLimit,g_nProductMaxIndex=(t+1)*pg_nSearchResultsLimit);for(var i=g_nProductMinIndex;i<g_nProductMaxIndex;i++)void 0!==e[i]&&r.push(e[i]);return r}function GetParent(e,t){var r=t.parentNode;if(void 0!==r&&null!=r&&null!=r.tagName)for(;r.tagName!==e.toUpperCase();)r=r.parentNode;return r}function EditLabel(e){for(var t=e.childNodes,r=e.parentNode.childNodes,i=0;i<r.length;i++)if(null!==r[i])for(var n=r[i].childNodes,a=0;a<n.length;a++)null!==n[a]&&"LABEL"==n[a].nodeName&&(n[a].style.cssText="");for(var o=0;o<t.length;o++)null!==t[o]&&"LABEL"==t[o].nodeName&&(t[o].style.cssText="color:red;")}function UpdateResultSummary(e){var t="";if(null===(t=document.getElementById("search_results_list")))return void ShowError("Tag with the id 'search_results_list' is not found in Filter Results L
24ayout, result summary might not be updated properly",g_ErrorCode.TAG);if(!e){var r="<Actinic:S_SUMMARY></Actinic:S_SUMMARY>";return void(t.innerHTML=t.innerHTML.replace(/(<Actinic:S_SUMMARY>(.*?)<\/Actinic:S_SUMMARY>)/gi,r))}var i=CalculateMinMaxSearchResult(),r="<Actinic:S_SUMMARY>Results "+i[0]+"-"+i[1]+" of "+gArrSortedProductRefs.length+"</Actinic:S_SUMMARY>";t.innerHTML=t.innerHTML.replace(/(<Actinic:S_SUMMARY>(.*?)<\/Actinic:S_SUMMARY>)/gi,r)}function CalculateMinMaxSearchResult(){var e=g_nProductMinIndex+1,t=0;return t=g_nProductMaxIndex>gArrSortedProductRefs.length?gArrSortedProductRefs.length:g_nProductMaxIndex,[e,t]}function UpdateResultContent(e){var t=document.getElementById("FilterResultElements"),r=document.getElementById("StaticResults");if(r&&(r.innerHTML=""),g_sResultLayout===g_eResultLayout.TABULAR){var i="";i=document.getElementById("product-list"),i&&(i.innerHTML=e)}else if(t)t.innerHTML=e,t.style.display="block";else{var n='Tag with the id "SearchResults" is not found in filter option layout, filter might not work properly';ShowError(n,g_ErrorCode.TAG)}}function CreateSearchResultPageLinks(){var e=document.getElementById("PaginationLinksTemplate");if(e){var t=e.innerHTML.replace(/(\n)/g,""),r={nMaxVisibleLinks:"<Actinic:PAGINATION_VISIBLELINKS>(.*?)</Actinic:PAGINATION_VISIBLELINKS>",sHeader:"<Actinic:PAGINATION_HEADER>(.*?)</Actinic:PAGINATION_HEADER>",sShowFirstLink:"<Actinic:PAGINATION_SHOWFIRSTURL>(.*?)</Actinic:PAGINATION_SHOWFIRSTURL>",sFirstPageURL:"<Actinic:PAGINATION_FIRSTPAGEURL>(.*?)</Actinic:PAGINATION_FIRSTPAGEURL>",sPrevPageURL:"<Actinic:PAGINATION_PREVPAGEURL>(.*?)</Actinic:PAGINATION_PREVPAGEURL>",sLinksPageURL:"<Actinic:PAGINATION_LINKSPAGEURL>(.*?)</Actinic:PAGINATION_LINKSPAGEURL>",sNextPageURL:"<Actinic:PAGINATION_NEXTPAGEURL>(.*?)</Actinic:PAGINATION_NEXTPAGEURL>",sLastPageURL:"<Actinic:PAGINATION_LASTPAGEURL>(.*?)</Actinic:PAGINATION_LASTPAGEURL>",sFullPageURL:"<Actinic:PAGINATION_FULLPAGEURL>(.*?)</Actinic:PAGINATION_FULLPAGEURL>"};for(var i in r){var n=new RegExp(r[i],"gi"),a=n.exec(t);if(a){var o=a[1];o=o.replace(/(<)/gi,"<"),o=o.replace(/(>)/gi,">"),r[i]=o}else r[i]=""}}var l="",s=pg_nSearchResultsLimit,c=parseInt(r.nMaxVisibleLinks);0===pg_bShowFullPageInPagination&&-1===g_nCurrenPageNumber&&(g_nCurrenPageNumber=0),s>gArrSortedProductRefs.length&&(s=gArrSortedProductRefs.length);var d=0;if(0!==s&&(d=Math.floor(gArrSortedProductRefs.length/s),gArrSortedProductRefs.length%s!=0&&d++),d<2)return[l,d];if(0!==pg_bShowFullPageInPagination&&-1===g_nCurrenPageNumber){var u=r.sShowFirstLink,p="javascript:OnPagination(0)";return l=u.replace(/<ACTINIC:PAGINATION_URLLINK><\/ACTINIC:PAGINATION_URLLINK>/gi,p),[l,d]}if(l=r.sHeader,0!==g_nCurrenPageNumber){var u=r.sFirstPageURL,p="javascript:OnPagination(0)";u=u.replace(/<ACTINIC:PAGINATION_URLLINK><\/ACTINIC:PAGINATION_URLLINK>/gi,p),l+=u,u=r.sPrevPageURL,p="javascript:OnPagination("+(g_nCurrenPageNumber-1)+")",u=u.replace(/<ACTINIC:PAGINATION_URLLINK><\/ACTINIC:PAGINATION_URLLINK>/gi,p),l+=u}0===c&&(c=d);var g=0;g_nCurrenPageNumber>-1&&(g=Math.floor(g_nCurrenPageNumber/c));var m=g*c,f=m+c;f>d&&(f=d);for(var v=m;v<=f;v++){var p="javascript:OnPagination("+v+")",u=r.sLinksPageURL,S,h=v+1;if(v<f)v===g_nCurrenPageNumber?(S=" <b>"+h+"</b> ",u=u.replace(/<A(.*)<\/A>/gi,S)):(u=u.replace(/<ACTINIC:PAGINATION_INDEX><\/ACTINIC:PAGINATION_INDEX>/gi,h),u=u.replace(/<ACTINIC:PAGINATION_URLLINK><\/ACTINIC:PAGINATION_URLLINK>/gi,p)),l+=u;else if(v<d){var P="...";u=u.replace(/<ACTINIC:PAGINATION_INDEX><\/ACTINIC:PAGINATION_INDEX>/gi,"..."),u=u.replace(/<ACTINIC:PAGINATION_URLLINK><\/ACTINIC:PAGINATION_URLLINK>/gi,p),l+=u}}if(d!==g_nCurrenPageNumber+1&&(p="javascript:OnPagination("+(g_nCurrenPageNumber+1)+")",u=r.sNextPageURL,u=u.replace(/<ACTINIC:PAGINATION_URLLINK><\/ACTINIC:PAGINATION_URLLINK>/gi,p),l+=u,p="javascript:OnPagination("+(d-1)+")",u=r.sLastPageURL,u=u.replace(/<ACTINIC:PAGINATION_URLLINK><\/ACTINIC:PAGINATION_URLLINK>/gi,p),l+=u),0!==pg_bShowFullPageInPagination){u=r.sFullPageURL,p="javascript:OnPagination(-1)";var C=gArrSortedProductRefs.length;u=u.replace(/<ACTINIC:PAGINATION_URLLINK><\/ACTINIC:PAGINATION_URLLINK>/gi,p),u=u.replace(/<ACTINIC:PAGINATION_PRODUCTCOUNT><\/ACTINIC:PAGINATION_PRODUCTCOUNT>/gi,C),l+=u}return[l,d]}function UpdatePaginatedLinks(e,t){var r=document.getElementById("filter_pagination_links_top");null===r&&(r=document.getElementById("search_pagination_links_top")),r&&(r.innerHTML=e?t:"");var i=document.getElementById("filter_pagination_links_bottom");null===i&&(i=document.getElementById("search_pagination_links_bottom")),i&&(i.innerHTML=e?t:"")}function UpdateSortOrder(e){var t=document.forms.filter;if(void 0!==t)for(var r=t.elements,i=0;i<r.length;i++)"INPUT"===r[i].tagName&&"SO"===r[i].name&&(r[i].value=e)}
24function GetPaginationDetails(){var e=0;e=pg_nSearchResultsLimit>gArrSortedProductRefs.length?gArrSortedProductRefs.length:pg_nSearchResultsLimit;var t=0;return 0!==e&&(t=Math.floor(gArrSortedProductRefs.length/e),gArrSortedProductRefs.length%e!=0&&t++),[e,t]}function GetSortOrder(){var e="",t=document.forms.filter;return void 0!==t&&t.SO&&(e=t.SO.value),""===e&&"undefined"!=typeof pg_sDefaultSortOrder&&(e=pg_sDefaultSortOrder),e}function ResetSortOrder(){var e=document.forms.filter,t="";t=SDStorage.readPage("sortOrder"),t?(g_bSortOrder=t,e.SO.value=t):void 0!==e&&"undefined"!=typeof pg_sDefaultSortOrder&&e.SO&&(g_bSortOrder=pg_sDefaultSortOrder,e.SO.value=pg_sDefaultSortOrder);var r=document.forms.filter_sortorder,i="";void 0!==r&&(i=r.getElementsByTagName("option"));for(var n in i)i[n].value===g_bSortOrder?i[n].selected="selected":i[n].selected=""}function SetCurrentPageNumber(e){g_nCurrenPageNumber=e}function SetStoredPageNumber(){var e=SDStorage.readPage("pageNumber");g_nCurrenPageNumber=null!=e?e:0}function ShowLoadingDialog(){var e=document.getElementById("loading-dialog");e&&(e.style.display="block")}function HideLoadingDialog(){var e=document.getElementById("loading-dialog");e&&(e.style.display="none")}function GetProdRefsOfNonCachedProductDetails(e){var t=new Array;if(t.length=0,0!==e.length)for(var r=0;r<e.length;r++)IsProductDetailsCached(e[r])||t.push(e[r]);return t}function CacheProductDetails(e){for(var t=0;t<e.length;t++){var r=e[t].ProductInfo,i=r[0];IsOutOfStock(i,r[12],r[13])||(gMapObjProductDetails[i]=new ProductDetails,SetProductDetails(gMapObjProductDetails[i],r))}}function IsOutOfStock(e,t,r){var i=IsOutOfStockFromStockFilter(e);if(IsExcludeOutOfStockItems()&&t)if(null==i){if(r<=0)return!0}else if(i)return!0;return!1}var gMAX_INT="9007199254740992",gMapPriceBandPriceRange={},gMapFilters={},gMapDefCtrlSelections={},gArrayPriceIDs=new Array,gArraySectionIDs=new Array,gMapControlIdChoiceName={},gMapPropIdToBtnClearStatus={},gMapCtrlSelections={},gMapPropCtrlSelections={},gMapPropIdToSelections={},gMapControlToSelection={},g_eControlType={BUTTON:1,LIST:2,LINK:4,UNDEFINED:5};function UpdateFilterCount(){IsFilterCountEnabled()&&"undefined"!=typeof pg_arrayPriceBandValues&&"undefined"!=typeof pg_arrayProperties&&(CalculateCount(!1),!g_bFirstLoad||g_bHasPresetOptions||HasFilterStorage()||RemoveFilterWithZeroCount(),GenerateDynamicFilterOptions(),ClearFilterCounts())}function CacheDefinedPriceBands(){if("undefined"==typeof pg_arrayPriceBandValues){return void ShowError("Global variables 'pg_arrayPriceBandValues' is not defined, filtering functionality might not be available",g_ErrorCode.UNDEFINED)}gMapFilterGrpIdToFilterGrpName.PR="PR",gArrFilterGrpIdSorted.push("PR"),gMapFilters.PR={},gMapFilters.PR.m_bShow=!1;for(var e=0;e<pg_arrayPriceBandValues.length;e++){var t=pg_arrayPriceBandValues[e].split(":"),r=t[1].split("-"),i=t[0];gArrayPriceIDs.push(i),gMapFilters.PR[i]=new PriceBandDetails,e===pg_arrayPriceBandValues.length-1&&(r[1]=gMAX_INT),SetPriceDetails(gMapFilters.PR[i],r[0],r[1])}}function PriceBandDetails(){this.m_nMin=0,this.m_nMax=0,this.m_nCount=0,this.m_bHideAlways=!1}function SetPriceDetails(e,t,r){e.m_nMin=parseInt(t),e.m_nMax=parseInt(r)}function GetPriceBand(e){var t="-1",r=gMapFilters.PR;for(var i in r){var n=r[i].m_nMin,a=r[i].m_nMax;if(e>=n&&e<=a){t=i;break}}return t}function GenerateDynamicFilterOptions(){CreateFilterSectionOptions(),CreateFilterPriceBandOptions(),CreateFilterPropertyOptions()}function ClearFilterCounts(){for(var e in gMapFilters)if("PR"===e){var t=gMapFilters[e];for(var r in t)t[r].m_nCount=0;gMapFilters[e].m_bShow=!1}else if("SX"===e){var i=gMapFilters[e];for(var n in i)i[n].m_nCumulativeCount=0,i[n].m_nCount=0;gMapFilters[e].m_bShow=!1}else{var a=gMapFilters[e].m_mapChoices;for(var o in a)a[o].m_nChoiceCount=0,gMapFilters[e].m_bShow=!1}}function CacheDefinedChoices(){if("undefined"==typeof pg_arrayProperties){return void ShowError("Global variables 'pg_arrayProperties' is not defined, filtering functionality might not be available",g_ErrorCode.UNDEFINED)}for(var e=0;e<pg_arrayProperties.length;e++)if(void 0!==pg_arrayProperties[e]){var t=pg_arrayProperties[e].split(":"),r=t[0].replace(/(_)/g,"_"),i=r.split("-"),n=i[0],a=i[1],o=t[1];
24if(gMapControlIdChoiceName[r]=o,void 0===gMapPropIdDecoratedChoices[n]&&(gMapPropIdDecoratedChoices[n]=new Array),""!==o){var l=gMapFilterGrpIdToFilterGrpName[n]+":"+o;l.toUpperCase(),-1==GetArrayIndex(gMapPropIdDecoratedChoices[n],l)&&(gMapPropIdDecoratedChoices[n].push(l),InsertSort(gMapPropIdDecoratedChoices[n]))}void 0===gMapFilters[n]&&(gMapFilters[n]=new ProductProperties),void 0===gMapFilters[n].m_mapChoices[a]&&(gMapFilters[n].m_mapChoices[a]=new FilterChoiceDetails),void 0!==gMapFilters[n].m_mapChoices[a]&&SetDefinedChoices(gMapFilters[n].m_mapChoices[a],n,r,o)}}function SetDefinedChoices(e,t,r,i){e.m_sChoiceID=r,e.m_sChoiceName=i,gMapFilters[t].m_bShow=!1}function CachePriceBandPriceRange(){if("undefined"!=typeof pg_arrayPriceBandRange)for(var e=0;e<pg_arrayPriceBandRange.length;e++){var t=pg_arrayPriceBandRange[e].split(":"),r=t[0];gMapPriceBandPriceRange[r]=t[1]}}function CreateFilterPriceBandOptions(){var e="",t="";if(e=document.getElementById("FilterPriceBandOptions"),t=document.getElementById("PriceOptionTemplate"),null===e||null===t){return void ShowError('Tag with the id "FilterPriceBandOptions" OR "PriceOptionTemplate" is not found in filter option layout, filter count might not work for price band',g_ErrorCode.TAG)}var r=!1;if(IsHideChoiceWithZeroResults()&&IsFilterCountEnabled()||IsFilterCountEnabled()&&g_bFirstLoad){var i=document.getElementById("PR");gMapFilters.PR.m_bShow?(i.style.display="block",r=!1):(i.style.display="none",r=!0)}var n=t.outerHTML,a=t.innerHTML,o="",l="",s=GetLayoutType(a),c="",d="",u="",p="";if(null!==(p=document.getElementById("PriceOptionTemplateSelect"))){c=p.outerHTML;var g=p.innerHTML,m=g.toLowerCase().indexOf("</act:select>");m>0&&(d=g.substring(0,m),d=d.replace(/(ACT:SELECT)/gi,"select"),u="</select>")}var f="",v="",S="",h="",P="",C="";if(f=document.getElementById("PriceOptionTemplateStartUL"),null!==f&&(v=f.innerHTML,S=f.outerHTML,v=v.replace(/(<)/gi,"<"),v=v.replace(/(>)/gi,">")),h=document.getElementById("PriceOptionTemplateEndUL"),null!==h&&(P=h.innerHTML,C=h.outerHTML,P=P.replace(/(<)/gi,"<"),P=P.replace(/(>)/gi,">")),!r&&""!==c&&IsDropDownListBox(c)){o=a,o=o.replace(/(<Actinic:PriceIndex><\/Actinic:PriceIndex>)/gi,"-1"),o=o.replace(/(<Actinic:PriceIndex><\/Actinic:PriceIndex>)/gi,"-1"),o=o.replace(/(<Actinic:PriceBand><\/Actinic:PriceBand>)/gi,"Any");var _="PR:-1",I="";void 0!==gMapCtrlSelections[_]&&(I="selected"),o=o.replace(/(ActinicDisabledCtrl=\"\")/gi,""),o=o.replace(/(ActinicDisabledStyle=\"\")/gi,""),o=o.replace(/(ActinicCustomSelection=\"\")/gi,I),o=o.replace(/(ACT:OPTION)/gi,"option"),o=o.replace(/(<Actinic:HiddentInput><\/Actinic:HiddentInput>)/gi,""),l+=o}var A=0,T=1;o="";for(var y=0;y<gArrayPriceIDs.length;y++){var b=gArrayPriceIDs[y];if(void 0!==gMapFilters.PR[b]&&!gMapFilters.PR[b].m_bHideAlways){sHiddenInput="",A=gMapFilters.PR[b].m_nCount,T++,o=a,o=o.replace(/(<Actinic:PriceIndex><\/Actinic:PriceIndex>)/gi,gArrayPriceIDs[y]),o=o.replace(/(<Actinic:PriceIndex><\/Actinic:PriceIndex>)/gi,gArrayPriceIDs[y]);var R=gMapPriceBandPriceRange[gArrayPriceIDs[y]].replace(/( )/gi," ");IsFilterCountEnabled()&&(R+=" ("+A+")"),o=o.replace(/(<Actinic:PriceBand><\/Actinic:PriceBand>)/gi,R);var _="PR:"+gArrayPriceIDs[y],I="",E="",D="";void 0!==gMapCtrlSelections[_]&&("LIST"===s?I="selected":"LINKS"===s?(I='style="color:red"',sHiddenInput='<input type="hidden" value="'+gArrayPriceIDs[y]+'" name="hf_PR" id="hf_PR"/>'):I="checked"),IsFilterCountEnabled()&&IsHideChoiceWithZeroResults()&&(A>0||(D='style="display:none;"',E='style="display:none;"')),IsFilterCountEnabled()&&!IsHideChoiceWithZeroResults()&&("LIST"===s?A>0||(D='disabled="disabled"'):"LINKS"===s?A>0||(D='disabled="disabled"',E='style="color:gray;cursor:default"'):A>0||(D='disabled="disabled"',E='style="color:gray"')),o=o.replace(/(ActinicDisabledCtrl=\"\")/gi,D),o=o.replace(/(ActinicDisabledStyle=\"\")/gi,E),o=o.replace(/(ACT:OPTION)/gi,"option"),o=o.replace(/(ActinicCustomSelection=\"\")/gi,I),o=o.replace(/(<Actinic:HiddentInput><\/Actinic:HiddentInput>)/gi,sHiddenInput),l+=o}}r?(d="",v="",l="",P="",u=""):(d=d.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,T),d=d.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,T)),e.innerHTML=c+n+S+C+d+v+l+P+u}function CreateFilterPropertyOptions(){for(var e=0;e<gArrProperty.length;e++)if(void 0!==gArrProperty[e]){var t=gArrProperty[e],r="FilterPropertyOptions_"+t,i="PropOptionTemplate_"+t,n="",a="";if(n=document.getElementById(r),a=document.getElementById(i),null===n||null===a){var o="Tag with the id"+r+" OR "+i+"is not found in filter option layout, filter count might not work for the property ID "+t;ShowError(o,g_ErrorCode.TAG);continue}var l=a.innerHTML,s=a.outerHTML,c=GetLayoutType(l),d="",u="",p=!1;if(void 0!==gMapFilters[t]){var g=gMapFilters[t].m_mapChoices,m=1;if(IsHideChoiceWithZeroResults()&&IsFilterCountEnabled()||IsFilterCountEnabled()&&g_bFirstLoad||gMapFilters[t].m_bHideAlways){var f=document.getElementById(t);g_bFirstLoad&&gMapFilters[t].m_bHideAlways||g_bFirstLoad&&!gMapFilters[t].m_bShow&&IsHideChoiceWithZeroResults()||!g_bFirstLoad&&!gMapFilters[t].m_bShow?(f.style.display="none",n.style.display="none",p=!0):(f.style.display="block",n.style.display="block",p=!1)}var v="",S="",h="",P="",C="",_="PropOptionTemplateSelect_"+t;if(null!==(C=document.getElementById(_))&&(v=C.innerHTML,S=C.outerHTML,!p)){var I=v.toLowerCase().indexOf("</act:select>");I>0&&(h=v.substring(0,I),h=h.replace(/(ACT:SELECT)/gi,"select"),h=h.replace(/(<Actinic:FilterPropValueName><\/Actinic:FilterPropValueName>)/gi,t),h=h.replace(/(<Actinic:FilterPropValueName><\/Actinic:FilterPropValueName>)/gi,t),P="</select>")}
24var A=IsDropDownListBox(v),T="",y="",b="",R="",E="",D="";T=document.getElementById("PropOptionTemplateStartUL_"+t),null!==T&&(y=T.innerHTML,b=T.outerHTML,y=y.replace(/(<)/gi,"<"),y=y.replace(/(>)/gi,">")),R=document.getElementById("PropOptionTemplateEndUL_"+t),null!==R&&(E=R.innerHTML,D=R.outerHTML,E=E.replace(/(<)/gi,"<"),E=E.replace(/(>)/gi,">"));for(var L=0;void 0!==g[m];){var M=!1;if(""===g[m].m_sChoiceName){if(!A||p){m++;continue}M=!0}if(""===g[m].m_sChoiceID||g[m].m_bHideAlways&&!M)m++;else{var F="",N=g[m].m_nChoiceCount;L++,d=l,d=d.replace(/(<Actinic:FilterPropValueName><\/Actinic:FilterPropValueName>)/gi,t),d=d.replace(/(<Actinic:FilterPropValueName><\/Actinic:FilterPropValueName>)/gi,t);var O=g[m].m_sChoiceName;d=d.replace(/(<Actinic:FilterPropValue><\/Actinic:FilterPropValue>)/gi,O),d=d.replace(/(<Actinic:FilterPropValue><\/Actinic:FilterPropValue>)/gi,O);var w=t+"-"+m,k="",B="",G="";void 0===gMapCtrlSelections[w]||g_bClearAll||("LIST"===c?k="selected":"LINKS"===c?(k='style="color:red"',F='<input type="hidden" value="'+g[m].m_sChoiceName+'" name="hf_'+g[m].m_sChoiceID+'" id="hf_'+t+'"/>'):k="checked"),IsFilterCountEnabled()&&IsHideChoiceWithZeroResults()&&(N>0||(B='style="display:none;"',G='style="display:none;"')),!IsFilterCountEnabled()||IsHideChoiceWithZeroResults()||M||("LIST"===c?N>0||(B='disabled="disabled"'):"LINKS"===c?N>0||(B='disabled="disabled"',G='style="color:gray;cursor:default"'):N>0||(B='disabled="disabled"',G='style="color:gray"')),d=d.replace(/(ACT:OPTION)/gi,"option"),d=d.replace(/(ActinicDisabledCtrl=\"\")/gi,B),d=d.replace(/(ActinicDisabledStyle=\"\")/gi,G),d=d.replace(/(ActinicCustomSelection=\"\")/gi,k),d=d.replace(/(<Actinic:FilterPropChoiceID><\/Actinic:FilterPropChoiceID>)/gi,g[m].m_sChoiceID),d=d.replace(/(<Actinic:FilterPropChoiceID><\/Actinic:FilterPropChoiceID>)/gi,g[m].m_sChoiceID);var H=g[m].m_sChoiceName;M&&(H="Any"),IsFilterCountEnabled()&&!M&&(H+=" ("+g[m].m_nChoiceCount+")"),d=d.replace(/(<Actinic:FilterPropText><\/Actinic:FilterPropText>)/gi,H),d=d.replace(/(<Actinic:FilterPropText><\/Actinic:FilterPropText>)/gi,H),d=d.replace(/(<Actinic:HiddentInput><\/Actinic:HiddentInput>)/gi,F),u+=d,m++}}1===L&&L++,h=h.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,L),h=h.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,L),n.innerHTML="",n.innerHTML=b+D+S+s+h+y+u+E+P}}}function GetLayoutType(e){var t;return t=e.match(/(ACT:OPTION)/gim)?"LIST":e.match(/(type=\"submit\")/gim)||e.match(/(type=submit)/gim)?"LINKS":"BUTTONS"}function IsDropDownListBox(e){var t=!1,r=e.match(/(ACT:SELECT(.*)size\s*=\s*["\']?([^"\' ]*)["\' ]\s*)/i);return r?void 0!==r[3]&&"1"===r[3]&&(t=!0):e.match(/(ACT:SELECT)/i)&&(t=!0),t}function GetControlSelections(e,t,r){var i="";if("SX"===e||"PR"===e)i=e+":"+t,"-1"!==t&&(void 0===gMapControlToSelection[e]?(gMapControlToSelection[e]={},gMapControlToSelection[e][t]=""):gMapControlToSelection[e][t]="");else{if(""!==(i=t)&&""!==r&&void 0!==gMapControlIdChoiceName[i]){var n=gMapControlIdChoiceName[i],a=i.split("-")[0],o=gMapFilterGrpIdToFilterGrpName[a]+":"+n,l=o.toUpperCase();void 0===gMapPropIdToSelections[a]&&(gMapPropIdToSelections[a]=new Array),-1==GetArrayIndex(gMapPropIdToSelections[a],l)&&(gMapPropIdToSelections[a].push(l),gMapPropIdToSelections[a].length>0&&InsertSort(gMapPropIdToSelections[a])),void 0===gMapPropCtrlSelections[l]&&(gMapPropCtrlSelections[l]=!0)}""!==i&&""!==e&&""!==r&&(void 0===gMapControlToSelection[e]?(gMapControlToSelection[e]={},gMapControlToSelection[e][i]=""):gMapControlToSelection[e][i]="")}""!==i&&(gMapCtrlSelections[i]=!0)}function ClearCtrlSelectionMap(){gMapCtrlSelections={},gMapControlToSelection={},gMapPropCtrlSelections={},gMapPropIdToSelections={}}function IsFilterCountEnabled(){return!("undefined"==typeof pg_bEnableFilterCount||!pg_bEnableFilterCount)}function GetResultLayoutUsed(){var e=g_eResultLayout.UNDEFINED,t="";return t=document.getElementById("S_LISTCOLCOUNT"),t?(e=g_eResultLayout.TABULAR,g_nListColCount=parseInt(t.innerHTML)):e=g_eResultLayout.STD,e}function IsHostMode(){return!("undefined"==typeof pg_sShopID||!pg_sShopID)}function SetDefaultSelection(){if(GetControlSelections("PR","-1"),GetControlSelections("SX","-1"),"undefined"!=typeof pg_arrayDefaultProperties)for(var e=0;e<pg_arrayDefaultProperties.length;e++)if(void 0!==pg_arrayDefaultProperties[e]&&null!==pg_arrayDefaultProperties[e]){var t=pg_arrayDefaultProperties[e].replace(/(_)/g,"_"),r=t.split("-");gMapDefCtrlSelections[r[0]]=r[1],GetControlSelections(r[0],t,gMapControlIdChoiceN
24ame[t])}}function CheckHashChangeEvent(){if(!IsPreview()){var e=GetIEVersion();if(e<8&&0!==e){var t="";function r(){window.location.hash!==t&&(HashChangeHandler(),t=window.location.hash)}r(),window.setInterval(r,500)}else AddEvent(window,"hashchange",HashChangeHandler),window.location.hash&&HashChangeHandler()}}function HashChangeHandler(){if(g_bUseStorageSortPage)return void(g_bUseStorageSortPage=!1);if(g_bUseStorageFromClick)return void(g_bUseStorageFromClick=!1);if(ResetSortOrder(),SetStoredPageNumber(),-1!=window.location.hash.search("usestorage"))return SetSelectionMapsFromStorage(),void(IsFilterCountEnabled()?OnFilter(null,null,!0):(GenerateDynamicFilterOptions(),IsFilterAsDefaultView()?OnFilter(null,null,!0):OnFilter(null,null,!1)));var e="";if(e=document.getElementById("filter_results_area")){var t="";t=document.getElementById("ContentPage"),t&&(t.style.display="block"),e.style.display="none",""!=window.location.hash&&(window.location.hash=window.location.hash),ShowSectionContent(),HideAllClearButtons(),ResetStorage(g_eFilterSettings.FILTER)}}function IsHideChoiceWithZeroResults(){return"undefined"!=typeof pg_bHideChoiceWithZeroResults&&1===pg_bHideChoiceWithZeroResults}function CreateClearButton(e){var t=document.getElementById(e+"-clear-button");if(t)return void(t.style.cssText="display:block");var r=document.getElementById(e);if(r){var i="<a href='javascript:ClearFilterOptions(\""+e+'");\' id="'+e+'-clear-button" class="clear-button">Clear</a>';r.innerHTML=r.innerHTML+i}}function ShowHideClearButton(e,t){var r=document.getElementById(t+"-clear-button");r?e?(r.style.cssText="display:block",gMapPropIdToBtnClearStatus[t]=!0):(r.style.cssText="display:none",gMapPropIdToBtnClearStatus[t]=!1):e&&(CreateClearButton(t),gMapPropIdToBtnClearStatus[t]=!0)}function GetClearButtonCount(){var e=0;for(sPropId in gMapPropIdToBtnClearStatus)!0===gMapPropIdToBtnClearStatus[sPropId]&&e++;return e}function ClearFilterOptions(e){GetClearButtonCount()<2?OnClearAllOptions():(ClearFilterChoices(e),OnFilter())}function ClearFilterChoices(e){if(void 0!==document.forms.filter)for(var t=document.forms.filter.elements,r=0;r<t.length;r++){var i=GetControlType(t[r]);if(e===t[r].name&&i!==g_eControlType.UNDEFINED&&(ResetSelectionCheck(i,t[r],e),i===g_eControlType.LINK))break}}function GetControlType(e){var t=g_eControlType.UNDEFINED,r=e.type,i=e.tagName;return"INPUT"===i?"checkbox"===r||"radio"===r?t=g_eControlType.BUTTON:"submit"===r&&(t=g_eControlType.LINK):"SELECT"===i&&(t=g_eControlType.LIST),t}function ResetSelectionCheck(e,t,r){switch(e){case g_eControlType.BUTTON:"-1"==t.value&&""==t.value||(t.checked=!1);break;case g_eControlType.LIST:for(var i=0;i<t.options.length;i++)"-1"==t.options[i].value&&""==t.options[i].value||(t.options[i].selected=!1);break;case g_eControlType.LINK:var n=document.getElementById("hf_"+r);if(n){var a=n.value,o="";if("PR"===r)o="lbl_"+a;else if("SX"===r)o+="lbl_SX_"+a;else{var l=n.name.split("hf_");o="lbl_"+l[1]}var s=document.getElementById(o);s&&(s.style.cssText=""),n.parentNode.removeChild(n)}}}function HideModifyStaticControls(){var e=document.getElementById("update_btn");if(e){var t=e.parentNode;t&&t.parentNode.removeChild(t)}var r=document.getElementById("update_lnk");r&&(r.setAttribute("onclick","javascript:OnClearAllOptions(); return false;"),r.value="Clear All")}function OnClearAllOptions(){GetClearButtonCount()<1||(ShowSectionContent(),HideAllClearButtons(),ResetStorage(g_eFilterSettings.FILTER),-1!=g_nCurrenPageNumber&&ResetStorage(g_eFilterSettings.PAGINATION))}function ShowSectionContent(){if(!IsFilterAsDefaultView()){var e=document.getElementById("filter_results_area");e&&(e.style.cssText="display:none");var t=document.getElementById("ContentPage");t&&(t.style.cssText="display:block"),ReloadCarousels()}}function HideAllClearButtons(){ClearCtrlSelectionMap();for(var e in gMapPropIdToBtnClearStatus)!0===gMapPropIdToBtnClearStatus[e]&&ClearFilterChoices(e);OnFilter(null,null,!1,!0)}function CacheFilterSections(){if("undefined"!=typeof pg_arrayFilterSections){gMapFilterGrpIdToFilterGrpName.SX="SX",gArrFilterGrpIdSorted.push("SX"),gMapFilters.SX={},gMapFilters.SX.m_bShow=!1;for(var e=0;e<pg_arrayFilterSections.length;e++)if(void 0!==pg_arrayFilterSections[e]&&null!==pg_arrayFilterSections[e]){var t=pg_arrayFilterSections[e].split(":"),r=t[0];
24gMapFilters.SX[r]=new SectionDetails,gMapFilters.SX[r].m_sSectionName=t[1],gArraySectionIDs.push(r)}}}function SectionDetails(){this.m_sSectionName="",this.m_nCount=0,this.m_nCumulativeCount=0,this.m_arrSubSectionIds=new Array,this.m_bHideAlways=!1}function CreateFilterSectionOptions(){var e="",t="";if(e=document.getElementById("FilterSectionOptions"),t=document.getElementById("SectionOptionTemplate"),null===e||null===t){return void ShowError('Tag with the id "FilterSectionOptions" OR "SectionOptionTemplate" is not found in filter option layout, filter count might not work for departments',g_ErrorCode.TAG)}var r=!1;if(IsHideChoiceWithZeroResults()&&IsFilterCountEnabled()||IsFilterCountEnabled()&&g_bFirstLoad){var i=document.getElementById("SX");gMapFilters.SX.m_bShow?(i.style.display="block",r=!1):(i.style.display="none",r=!0)}var n=t.outerHTML,a=t.innerHTML,o="",l="",s=GetLayoutType(a),c="",d="",u="",p="";if(null!==(p=document.getElementById("SectionOptionTemplateSelect"))){c=p.outerHTML;var g=p.innerHTML,m=g.toLowerCase().indexOf("</act:select>");m>0&&(d=g.substring(0,m),d=d.replace(/(ACT:SELECT)/gi,"select"),u="</select>")}var f="",v="",S="",h="",P="",C="";if(f=document.getElementById("SectionOptionTemplateStartUL"),null!==f&&(v=f.innerHTML,S=f.outerHTML,v=v.replace(/(<)/gi,"<"),v=v.replace(/(>)/gi,">")),h=document.getElementById("SectionOptionTemplateEndUL"),null!==h&&(P=h.innerHTML,C=h.outerHTML,P=P.replace(/(<)/gi,"<"),P=P.replace(/(>)/gi,">")),!r&&""!==c&&IsDropDownListBox(c)){o=a,o=o.replace(/(<Actinic:SectionIndex><\/Actinic:SectionIndex>)/gi,"-1"),o=o.replace(/(<Actinic:SectionIndex><\/Actinic:SectionIndex>)/gi,"-1"),o=o.replace(/(<Actinic:SectionName><\/Actinic:SectionName>)/gi,"Any");var _="SX:-1",I="";void 0!==gMapCtrlSelections[_]&&(I="selected"),o=o.replace(/(ActinicDisabledCtrl=\"\")/gi,""),o=o.replace(/(ActinicDisabledStyle=\"\")/gi,""),o=o.replace(/(ActinicCustomSelection=\"\")/gi,I),o=o.replace(/(ACT:OPTION)/gi,"option"),o=o.replace(/(<Actinic:HiddentInput><\/Actinic:HiddentInput>)/gi,""),l+=o}for(var A=0,T=1,y=0;y<gArraySectionIDs.length;y++)if(sHiddenInput="",void 0!==gMapFilters.SX[gArraySectionIDs[y]]&&""!==gMapFilters.SX[gArraySectionIDs[y]].m_sSectionName&&!gMapFilters.SX[gArraySectionIDs[y]].m_bHideAlways){A=gMapFilters.SX[gArraySectionIDs[y]].m_nCumulativeCount,T++,o=a,o=o.replace(/(<Actinic:SectionIndex><\/Actinic:SectionIndex>)/gi,gArraySectionIDs[y]),o=o.replace(/(<Actinic:SectionIndex><\/Actinic:SectionIndex>)/gi,gArraySectionIDs[y]);var b=gMapFilters.SX[gArraySectionIDs[y]].m_sSectionName;IsFilterCountEnabled()&&(b+=" ("+A+")"),o=o.replace(/(<Actinic:SectionName><\/Actinic:SectionName>)/gi,b);var _="SX:"+gArraySectionIDs[y],I="",R="",E="";void 0!==gMapCtrlSelections[_]&&("LIST"===s?I="selected":"LINKS"===s?(I='style="color:red"',sHiddenInput='<input type="hidden" value="'+gArraySectionIDs[y]+'" name="hf_SX" id="hf_SX"/>'):I="checked"),IsFilterCountEnabled()&&IsHideChoiceWithZeroResults()&&(A>0||(E='style="display:none;"',R='style="display:none;"')),IsFilterCountEnabled()&&!IsHideChoiceWithZeroResults()&&("LIST"===s?A>0||(E='disabled="disabled"'):"LINKS"===s?A>0||(E='disabled="disabled"',R='style="color:gray;cursor:default"'):A>0||(E='disabled="disabled"',R='style="color:gray"')),o=o.replace(/(ActinicDisabledCtrl=\"\")/gi,E),o=o.replace(/(ActinicDisabledStyle=\"\")/gi,R),o=o.replace(/(ACT:OPTION)/gi,"option"),o=o.replace(/(ActinicCustomSelection=\"\")/gi,I),o=o.replace(/(<Actinic:HiddentInput><\/Actinic:HiddentInput>)/gi,sHiddenInput),l+=o}r?(d="",v="",l="",P="",u=""):(d=d.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,T),d=d.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,T)),e.innerHTML=c+n+S+C+d+v+l+P+u}function IsSearchBySubSection(){return"undefined"!=typeof pg_bSearchBySubSection&&1===pg_bSearchBySubSection}function CacheSectionDetails(e){for(var t=0;t<e.length;t++){var r=e[t].SectionID;void 0!==gMapFilters.SX[r]?gMapFilters.SX[r].m_arrSubSectionIds=e[t].SubSectionIDs:(gMapFilters.SX[r]=new SectionDetails,gMapFilters.SX[r].m_arrSubSectionIds=e[t].SubSectionIDs)}}function UpdateCumulativeSectionCount(){if(IsSearchBySubSection())for(var e=0;e<gArraySectionIDs.length;e++){var t=gArraySectionIDs[e];if(void 0!==gMapFilters.SX[t]){var r=new Array;r=gMapFilters.SX[t].m_arrSubSectionIds 25;for(var i=0;i<r.length;i++)void 0!==gMapFilters.SX[r[i]]&&(gMapFilters.SX[t].m_nCumulativeCount+=gMapFilters.SX[r[i]].m_nCount);gMapFilters.SX[t].m_nCumulativeCount+=gMapFilters.SX[t].m_nCount}}}function HideOptionAny(){var e=IsFilterAsDefaultView(),t=document.getElementById("SX_-1");if(t){var r=t.parentNode,i;i=e?r.childNodes:r.parentNode.childNodes;for(var n=0;n<i.length;n++)"LABEL"===i[n].tagName&&"SX_-1"===i[n].htmlFor&&i[n].parentNode.removeChild(i[n]);t.parentNode.removeChild(t)}var a=document.getElementById("-1");if(a){var o=a.parentNode,i;i=e?o.childNodes:o.parentNode.childNodes;for(var n=0;n<i.length;n++)"LABEL"===i[n].tagName&&"-1"===i[n].htmlFor&&i[n].parentNode.removeChild(i[n]);a.parentNode.removeChild(a)}for(var l=0;l<gArrProperty.length;l++)if(void 0!==gArrProperty[l]){var s=gArrProperty[l],c="",d="PropOptionTemplateSelect_"+s,u=document.getElementById(d);if(null!==u&&(c=u.innerHTML),""!==c&&IsDropDownListBox(c))continue;s+="-1";var p=document.getElementById(s);if(p&&""===p.value){var g=p.parentNode,i;i=e?g.childNodes:g.parentNode.childNodes;for(var n=0;n<i.length;n++)"LABEL"===i[n].tagName&&i[n].htmlFor===s&&i[n].parentNode.removeChild(i[n]);g.removeChild(p)}}}function IsFilterAsDefaultView(){return!("undefined"==typeof pg_bFilterDefaultView||!pg_bFilterDefaultView)}function IsShowClearButton(e){var t=!1;if("SX"===e)for(var r in gMapFilters.SX)void 0!==gMapCtrlSelections["SX:"+r]&&"-1"!==gMapCtrlSelections[r]&&(t=!0);else if("PR"===e)for(var i in gMapFilters.PR)void 0!==gMapCtrlSelections["PR:"+i]&&"-1"!==gMapCtrlSelections[i]&&(t=!0);else if(void 0!==gMapFilters[e])for(var n=gMapFilters[e].m_mapChoices,a=1;void 0!==n[a];){var o=n[a].m_sChoiceID;void 0!==gMapCtrlSelections[o]&&""!==gMapFilters[e].m_mapChoices[a].m_sChoiceN
25ame&&(t=!0),a++}return t}function FilterProductsBasedOnPerms(){var e={},t=new Array;for(var r in gMapPropCtrlSelections)void 0!==r&&t.push(r);if(t.length<=0)for(var i=gArrayDefinedPropertiesSorted.join(":"),n=0;n<gArrSortedProductRefs.length;n++){var a=gArrSortedProductRefs[n];if(void 0!==gMapInvalidProdRefs[a]||gMapObjProductDetails[a].m_bFullPermutation){var o=gMapObjProductDetails[a].m_mapCompToPermutation;void 0===o[i]||"EMPTY"!==o[i]&&"OSTOCK"!==o[i]?e[a]=!0:IsAllOtherPermsValid(o,i)?e[a]=!0:e[a]=!1}else e[a]=!0}else{InsertSort(t);for(var l=GetPermSelectionString(""),n=0;n<gArrSortedProductRefs.length;n++){var a=gArrSortedProductRefs[n];if(void 0!==gMapInvalidProdRefs[a]||gMapObjProductDetails[a].m_bFullPermutation){e[a]=!1;var o=gMapObjProductDetails[a].m_mapCompToPermutation;if(void 0===o.EMPTY){var s=!0,c=!1;for(sComponent in o)if(!0===IsValidComponent(t,sComponent)){if(c=!0,"EMPTY"===o[sComponent]||"OSTOCK"===o[sComponent]){IsAllOtherPermsValid(o,sComponent)&&(e[gArrSortedProductRefs[n]]=!0);continue}var d=o[sComponent];if(d.length>0)for(var u=0;u<d.length;u++)if(TestRegExp(d[u],l)){s=!1;break}!1===s&&(e[gArrSortedProductRefs[n]]=!0)}c||(e[gArrSortedProductRefs[n]]=!0)}else e[a]=!1}else e[a]=!0}}for(var a in e)if(!1===e[a]){var p=GetArrayIndex(gArrSortedProductRefs,a);-1!==p&&(gArrSortedProductRefs.splice(p,1),delete gMapMatchedProducts[a])}for(var p=0;p<gArrSortedProductRefs.length;p++){var a=gArrSortedProductRefs[p];void 0!==gMapAltProdToParentProductRef[a]&&void 0!==gMapMatchedProducts[gMapAltProdToParentProductRef[a]]&&(gArrSortedProductRefs.splice(p,1),p--)}gArrResultSet.length=0,gArrResultSet=GetDecoratedProdRefs(gArrSortedProductRefs)}function IsValidComponent(e,t){for(var r=!1,i=t.split(":"),n=e.join("|"),a=0;a<i.length;a++){var o=i[a];if(-1!==n.indexOf(o)){r=!0;break}}return r}function UpdatePermutationCount(e,t){var r=new Array;for(var i in gMapPropCtrlSelections)void 0!==i&&r.push(i);if("SX"!==e&&"PR"!==e){var n="",a=gMapFilters[e].m_mapChoices;for(n in a)if(""!==n){var o=a[n].m_nChoiceCount;if(0!==o){var l="",i=e,s=a[n].m_sChoiceName;l=GetPermSelectionString(i,s);for(var c=0;c<t.length;c++){var d=t[c];if(void 0===gMapAltProdToParentProductRef[d]||void 0===gMapProdToAltProdArray[gMapAltProdToParentProductRef[d]])if(void 0===gMapProdToAltProdArray[d]){if(void 0!==gMapObjProductDetails[d].m_mapProperties[e]){var u=gMapObjProductDetails[d].m_mapProperties[e].m_mapChoices;if(void 0!==u[s]){var p=gMapObjProductDetails[d].m_mapCompToPermutation,g=gMapFilterGrpIdToFilterGrpName[i],m=GetCombination(g,p);if(""!==m)IsValidCombination(d,l,m)||a[n].m_nChoiceCount--;else{var f=GetPermSelectionString("");if(""!==f){var v=!1,S="";for(S in p)if((0==r.length||IsValidComponent(r,S))&&!IsValidCombination(d,f,S)){v=!0;break}v&&a[n].m_nChoiceCount--}}}}}else CheckAlternativePermutations(d,e,s,r)||a[n].m_nChoiceCount--}}}}else for(var c=0;c<t.length;c++){var d=t[c];if(void 0===gMapAltProdToParentProductRef[d]||void 0===gMapProdToAltProdArray[gMapAltProdToParentProductRef[d]]||!("PR"===e&&gMapObjProductDetails[gMapAltProdToParentProductRef[d]].m_sDecPriceBand===gMapObjProductDetails[d].m_sDecPriceBand||"SX"===e&&gMapObjProductDetails[gMapAltProdToParentProductRef[d]].m_sDecSection===gMapObjProductDetails[d].m_sDecSection)){var f=GetPermSelectionString("");if(""!==f){var v=!1,S="",p=gMapObjProductDetails[d].m_mapCompToPermutation;for(S in p)if((0==r.length||IsValidComponent(r,S))&&!IsValidCombination(d,f,S)){v=!0;break}if(v)if("PR"===e){var h=gMapObjProductDetails[d].m_sDecPriceBand,P=gMapFilters.PR;for(var C in P)if(h===C){P[h].m_nCount--;break}}else if("SX"===e){var _=gMapObjProductDetails[d].m_sDecSection,I=gMapFilters.SX;for(var A in I)if(_===A){I[_].m_nCount--;break}}}}}}function CheckAlternativePermutations(e,t,r,i){if(void 0===gMapProdToAltProdArray[e])return!0;var n="",a=t,o=!0;n=GetPermSelectionString(a,r);for(var l=gMapProdToAltProdArray[e],s=0;s<l.length;s++){var e=l[s];if(void 0!==gMapObjProductDetails[e].m_mapProperties[t]){if(void 0!==gMapObjProductDetails[e].m_mapProperties[t].m_mapChoices[r]){var c=gMapObjProductDetails[e].m_mapCompToPermutation,d=gMapFilterGrpIdToFilterGrpName[a],u=GetCombination(d,c);if(""!==u){var p=c[u];
25if(void 0!==gMapInvalidProdRefs[e]&&!gMapObjProductDetails[e].m_bFullPermutation&&"EMPTY"===p||"OSTOCK"===p){if(IsAllOtherPermsValid(c,u))return!0;o=!1;continue}if("EMPTY"===p)return!0;if(p.length>0){for(var g=0;g<p.length;g++)if(TestRegExp(p[g],n))return!0;g===p.length&&(o=!1)}}else{var m=GetPermSelectionString("");if(""!==m){var f=!1,v="";for(v in c)if(IsValidComponent(i,v)){if(IsValidCombination(e,m,v))return!0;o=!1;break}}}}}}return o}function IsValidCombination(e,t,r){var i=gMapObjProductDetails[e].m_mapCompToPermutation;if(""!==r){var n=i[r];if(void 0!==gMapInvalidProdRefs[e]&&!gMapObjProductDetails[e].m_bFullPermutation&&"EMPTY"===n||"OSTOCK"===n)return!!IsAllOtherPermsValid(i,r);if("EMPTY"===n)return!0;if(n.length>0){for(var a=0;a<n.length;a++)if(TestRegExp(n[a],t))return!0;return!1}}return!0}function GetPermSelectionString(e,t){for(var r="",i=gMapFilterGrpIdToFilterGrpName[e]+":"+t,n=0;n<gArrayDefinedPropertiesSorted.length;n++){var a=gArrayDefinedPropertiesSorted[n],o=gMapPropNameToPropId[a];e===o?r+="-"+i+"-":void 0!==gMapPropIdToSelections[o]?r+="-"+gMapPropIdToSelections[o].join("--")+"-":r+="-"+gMapPropIdDecoratedChoices[o].join("--")+"-"}return r}function GetCombination(e,t){var r="";for(var i in t)if(""!==i&&-1!==i.indexOf(e)){r=i;break}return r}function CalculateCount(e){for(var t=0;t<gArrFilterGrpIdSorted.length;t++){var r="",i=gArrFilterGrpIdSorted[t];e||g_bClearAll||(r=GetFilterPatternForCount(i));var n=GetFilteredProducts(r);CountFilterOptions(i,n),UpdatePermutationCount(i,n),"SX"===i&&UpdateCumulativeSectionCount()}}function GetFilterPatternForCount(e){var t={},r="";for(var i in gMapFilterGrpIdToFilterGrpName)if(i!==e&&void 0!==gMapControlToSelection[i]){var n=gMapControlToSelection[i],a=new Array,o="";if("PR"===i)for(var l in n){var s=i+"_"+l;a.push(s)}else if("SX"===i){var c={};for(var l in n){c[l]="";for(var d=gMapFilters.SX[l].m_arrSubSectionIds,u=0;u<d.length;u++)-1!==GetArrayIndex(gArraySectionIDs,d[u])&&(c[d[u]]="")}for(var p in c){var s=i+"_"+p;a.push(s)}}else for(var g in n)if(void 0!==gMapControlIdChoiceName[g]){var s=i+":"+gMapControlIdChoiceName[g];a.push(s)}a.length>0&&(t[i]="(\\!"+a.join("\\!|\\!")+"\\!)")}for(var m=0;m<gArrFilterGrpIdSorted.length;m++){var f=gArrFilterGrpIdSorted[m];void 0!==t[f]&&(r.length>0&&(r+=".*"),r+=t[f])}return r}function GetFilteredProducts(e){var t=new Array,r=new RegExp(e,"i");gMapMatchedProducts={},gMapProdToAltProdArray={};for(var i in gMapObjProductDetails)if(""!==e){var n=gMapObjProductDetails[i].m_sDecFilterString;TestRegExp(r,n)&&(t.push(i),gMapMatchedProducts[i]="")}else t.push(i),gMapMatchedProducts[i]="";for(var a=0;a<t.length;a++){var i=t[a];void 0!==gMapAltProdToParentProductRef[i]&&void 0!==gMapMatchedProducts[gMapAltProdToParentProductRef[i]]&&(void 0===gMapProdToAltProdArray[gMapAltProdToParentProductRef[i]]&&(gMapProdToAltProdArray[gMapAltProdToParentProductRef[i]]=new Array,gMapProdToAltProdArray[gMapAltProdToParentProductRef[i]].push(gMapAltProdToParentProductRef[i])),gMapProdToAltProdArray[gMapAltProdToParentProductRef[i]].push(i))}return t}function TestRegExp(e,t){var r=!1;return void 0!==e&&void 0!==t&&""!=t&&(r=e.test(t)),r}function CountFilterOptions(e,t){for(var r={},i=0;i<t.length;i++)r[t[i]]="";for(var i=0;i<t.length;i++){var n=t[i];if("PR"===e){var a=gMapObjProductDetails[t[i]].m_sDecPriceBand;void 0!==gMapAltProdToParentProductRef[n]&&void 0!==r[gMapAltProdToParentProductRef[n]]&&gMapObjProductDetails[gMapAltProdToParentProductRef[n]].m_sDecPriceBand===a||UpdatePriceCount(a)}else if("SX"===e){var o=gMapObjProductDetails[t[i]].m_sDecSection;void 0!==gMapAltProdToParentProductRef[n]&&void 0!==r[gMapAltProdToParentProductRef[n]]&&gMapObjProductDetails[gMapAltProdToParentProductRef[n]].m_sDecSection===o||UpdateSectionCount(o)}else{var l=gMapObjProductDetails[t[i]].m_sDecFilterString,s=gMapObjProductDetails[t[i]].m_mapDecChoices;if(void 0===gMapAltProdToParentProductRef[n]||void 0===r[gMapAltProdToParentProductRef[n]])UpdateChoiceCount(e,l,s);else{var c=gMapObjProductDetails[gMapAltProdToParentProductRef[n]].m_mapDecChoices,d={};for(var u in s)d[u]="";for(var u in c)void 0!==d[u]&&delete d[u];UpdateChoiceCount(e,l,d)}}}}function UpdatePriceCount(e){var t=gMapFilters.PR,r=!1;for(var i in t)if(i===e){t[i].m_nCount++,r=!0;break}r&&(gMapFilters.PR.m_bShow=!0)}function UpdateSectionCount(e){var t=gMapFilters.SX,r=!1;for(var i in t){if(i===e){t[i].m_nCount++,r=!0;break}var n=t[i].m_arrSubSectionIds,a=!1;if(void 0!==n)for(var o=0;o<n.length;o++)if(n[o]===e){var l=n[o];if(void 0!==gMapFilters.SX[l]){gMapFilters.SX[l].m_nCount++,r=!0,a=!0;break}
25gMapFilters.SX[l]=new SectionDetails,gArraySectionIDs.push(l),gMapFilters.SX[l].m_nCount++,r=!0,a=!0;break}if(a)break}r&&(gMapFilters.SX.m_bShow=!0)}function UpdateChoiceCount(e,t,r){var i=gMapFilters[e].m_mapChoices,n=!1;for(var a in i){var o=i[a];if(""!==o.m_sChoiceName){void 0!==r[(e+":"+o.m_sChoiceName).toUpperCase()]&&(o.m_nChoiceCount++,n=!0)}}n&&(gMapFilters[e].m_bShow=!0)}function RemoveFilterWithZeroCount(){for(var e in gMapFilters)if("PR"===e){var t=gMapFilters[e];for(var r in t)0==t[r].m_nCount&&(t[r].m_bHideAlways=!0)}else if("SX"===e){var i=gMapFilters[e];for(var n in i)0==i[n].m_nCumulativeCount&&(i[n].m_bHideAlways=!0)}else{var a=gMapFilters[e].m_mapChoices;gMapFilters[e].m_bHideAlways=!0;for(var o in a)0==a[o].m_nChoiceCount?a[o].m_bHideAlways=!0:gMapFilters[e].m_bHideAlways=!1}}function IsAllOtherPermsValid(e,t){var r=!1;for(var i in e)if(i!==t){var n=e[i];if("EMPTY"!==n&&"OSTOCK"!==n&&n.length>0){r=!0;break}}return r}function GetFilterCacheURL(e){var t="",r=document.getElementsByTagName("base");if(r&&r.length>0){t=r[0].href;var i=document.location.protocol,n=t.split("//")[0];n!=i&&(t=t.replace(new RegExp("^"+n),i));var a=t.split("//")[1].split("/")[0];return a!=document.location.host&&(t=t.replace(a,document.location.host)),t.match(/\/$/)||(t+="//"),t+e}return e}function ReloadCarousels(){$("div[class^='bxSlider']").each(function(e){var t=$(this).data("sd_BXSlider");t&&t.reloadSlider()})}function CacheStockFilter(){if(!IsExcludeOutOfStockItems())return void FilterDataReceived(g_FilterDataType.STOCKFILTER,"");var e=new ajaxObject("stockfilter.js");e.callback=function(e,t){FilterDataReceived(g_FilterDataType.STOCKFILTER,e,t,!1)},e.update("","GET")}function IsOutOfStockFromStockFilter(e){return void 0===gMapRefStock[e]?null:gMapRefStock[e]<=0}function IsExcludeOutOfStockItems(){return"undefined"!=typeof pg_bExcludeOutOfStockItems&&0!==pg_bExcludeOutOfStockItems}function GetProdRefForFullPermutation(){var e={};for(var t in gMapRefStock)if(void 0!==gMapChildToParentProducts[t])for(var r=gMapChildToParentProducts[t],i=0;i<r.length;i++)e[r[i]]=null;
25for(var t in gMapInvalidEmptyPermsProdRefs)e[t]=null;var n="",a=0;for(var t in e)n+=(0==a?"":"_")+t,a++;return n}function UpdateProductDetailsWithFullPermutation(e){var t={};try{t=e.parseJSON()}catch(e){return void ShowJSONError(e)}arrProductToFullPermutation=t.FullPermutationList;for(var r=0;r<arrProductToFullPermutation.length;r++){var i=arrProductToFullPermutation[r];for(var n in i)if(void 0!==gMapObjProductDetails[n]){var a=gMapObjProductDetails[n];UpdateCompToPermMapWithFullPermutation(a,i[n]);var o=gMapObjProductDetails[n].m_mapCompToPermutation;if(0==Object.keys(o).length)continue;var l=!0;for(var s in o)if("OSTOCK"!==o[s]){l=!1;break}l&&delete gMapObjProductDetails[n]}}}function UpdateCompToPermMapWithFullPermutation(e,t){if(""!==t){e.m_mapCompToPermutation={};for(var r=t.split(","),i=0;i<r.length;i++){var n=/(<(.*)>(.*))/gim,a=n.exec(r[i]);if(null!==a&&""!==a[2]){var o=a[2].toUpperCase().split(":");InsertSort(o);for(var l=o.join(":"),s=0;s<o.length;s++)void 0===gMapPropNameToPropId[o[s]]&&(o.splice(s,1),s--);var c=a[3];if(""===c)continue;for(var d=c.split("|"),u=d.length>0,p=0;p<d.length;p++){var n=/(.*)\:(\d)\:.*\:(.*)/gim,a=n.exec(d[p]);if(0!=a[2]){var g=a[3];if(""!=g){var m=g.split("!"),f=m[0];f=DecodeHtmlEntity(f);if(IsOutOfStock(f,m[2],m[3]))continue;u=!1}for(var v=a[1],S=v.toUpperCase().split("!!"),h=0;h<S.length;h++){var P=S[h].split("!");void 0===gMapPropNameToPropId[P[0]]&&(S.splice(h,1),h--)}if(0!==S.length){InsertSort(S);var C="\\-"+S.join("\\-.*\\-")+"\\-",_=C.split("!"),I=new RegExp(_.join("\\:"),"i");void 0!==e.m_mapCompToPermutation[l]&&"EMPTY"!==e.m_mapCompToPermutation[l]&&"OSTOCK"!==e.m_mapCompToPermutation[l]||(e.m_mapCompToPermutation[l]=new Array),e.m_mapCompToPermutation[l].push(I)}}else void 0===e.m_mapCompToPermutation[l]&&(e.m_mapCompToPermutation[l]="EMPTY")}!u||void 0!==e.m_mapCompToPermutation[l]&&"EMPTY"!==e.m_mapCompToPermutation[l]||(e.m_mapCompToPermutation[l]="OSTOCK")}}e.m_bFullPermutation=!0}else e.m_mapCompToPermutation.EMPTY=""}function FilterDataReceived(e,t,r,i,n,a){switch(e){case g_FilterDataType.STOCKFILTER:if(g_bMapFilteringDataReady[e]=!0,""!==t&&404!==r){g_bCacheStock=!1;var o=t.split("|");for(gMapRefStock={},index=0;index<o.length;index++)if(""!=o[index]){var l=o[index].split("_");gMapRefStock[l[0]]=parseInt(l[1])}}g_bMapFilteringDataReady[g_FilterDataType.STOCKFILTER]&&g_bMapFilteringDataReady[g_FilterDataType.PRODUCTLIST]&&ProcessProductList(g_arrProductListJSON);break;case g_FilterDataType.PRODUCTLIST:if(200===r||304===r){try{g_arrProductListJSON=t.parseJSON()}catch(e){return a?void ShowJSONError(e):void GetProductListFromServer(n)}g_bMapFilteringDataReady[e]=!0,g_bMapFilteringDataReady[g_FilterDataType.STOCKFILTER]&&ProcessProductList(g_arrProductListJSON)}else a?console.log("Server error when retrieving product list from server: ".nStatus):GetProductListFromServer(n);break;case g_FilterDataType.PRODUCTDETAILS:var s=GetProdRefsOfNonCachedProductDetails(gArrSortedProductRefs),c=s.length===gArrSortedProductRefs.length;if(200===r||304===r){var d={};try{if(d=t.parseJSON(),!a&&(0==d.ProductDetails.ProductInfoCount||s.length>0&&d.ProductDetails.ProductInfoCount!==s.length))return void UpdateProductDetailsFromServer(s,c,i)}catch(e){return a?void ShowJSONError(e):void UpdateProductDetailsFromServer(s,c,i)}g_bMapFilteringDataReady[e]=!0,UpdateProductDetails(d,i)}else a?console.log("Server error when retrieving product details from server: ".nStatus):UpdateProductDetailsFromServer(s,c,i);break;case g_FilterDataType.FULLPERMLIST:if(g_bMapFilteringDataReady[e]=!0,""===t)return void UpdateProductDetailsHelper(i);UpdateProductDetailsWithFullPermutation(t),UpdateProductDetailsHelper(i),g_bAllFilteringDataReady=!0}}function ResetFilterDataMap(){g_bAllFilteringDataReady=!1;for(var e=g_FilterDataType.STOCKFILTER;e<g_FilterDataType.MAX;e++)g_bMapFilteringDataReady[e]=!1}function GetAllProductDetails(){var e=document.forms.filter,t="PAGE=DynamicFilter&";if(t+=GetURLParam(g_bClearAll),IsHostMode()&&(t+="SHOP="+pg_sShopID+"&"),(IsFilterCountEnabled()||IsFilterAsDefaultView())&&(t+="SID="+pg_nCurrentFilterSectionID+"&"),e.Action){t+="Action="+e.Action.value}FilterProductsFromServer(t)}/*************************************************************** 26* 27* dynamic.js - utility functions for dynamic prices and choices 28* 29* Copyright (c) 2014 SellerDeck Limited 30* 31****************************************************************/ 32var g_mapProds={},timeout=null,g_nTimeout=1e3,g_sDynamicPriceURL="";function OnProdLoad(e,t,r){if(e)g_sDynamicPriceURL=e,getAllDynamicPrices(e,t,r);else{if(g_sDynamicPriceURL="",g_bStockUpdateInProgress)return void(g_bChoicesUpdatePending=!0);SetupVariants(!1);for(var i in g_mapProds){UpdateChoices(g_mapProds[i],!0,void 0)}}}function GetAttrFromSuffix(e,t){if(!e.mapAttr){e.mapAttr={};for(var r=0;r<e.arrComps.length;r++){var i=e.arrComps[r];if(i.aA)for(var n=0;n<i.aA.length;n++)e.mapAttr[i.aA[n].nUI]=i.aA[n]}}return e.mapAttr[t]}function UpdateChoices(e,t,r){if(e&&!e.bFixChoices&&!e.bNoATC&&e.arrComps){for(var i=GetProdChoices(e,r,t),n=GetChangedElemIndices(e,r),a=n?n.nCompIndex:0,o=e.arrComps,l=o.length,s=a;s<l;s++){var c=i[s],d=o[s];
32if(d.aA&&(t&&MapInvalidPermutations(d),d.mP||e.bSequentialChoices)){d.arrUserSeq||(d.arrUserSeq=[]),!e.bSequentialChoices&&n&&s==n.nCompIndex&&UpdateUserSequence(d,n.nAttrIndex,i[s]),NormaliseAttrSeq(d);var c=NormaliseUserChoices(d,i[s]);NormalisePerms(d);var u=0;e.bSequentialChoices&&s==a&&n&&(u=n.nAttrIndex),UpdateCompChoices(e,d,c,u)}}updateStockDisplay(g_mapStockByRef,!1),e.bSequentialChoices&&UpdateSequentialDisplay(e,i)}}function UpdateSequentialDisplay(e,t){for(var r=!1,i=0;i<e.arrComps.length;i++){var n=e.arrComps[i];if(n.bExclFromSeq){var a=r;UpdateSequentialCompDisplay(e,n,t[i],0,!1),r=a}else r=UpdateSequentialCompDisplay(e,n,t[i],0,r)}}function UpdateSequentialCompDisplay(e,t,r,i,n){var a=t.elemHTML,o=!0;if("checkbox"==a.type&&(a.disabled=n,n||(o=a.checked)),!t.aA)return n;for(var l=t.aA.length,s=i;s<l;s++){var c=t.aA[s],d=c.elem,u=d.elemHTML;if(n||!o)EnableSelectElement(u,!1),"SELECT"==u.tagName&&(u.selectedIndex=0);else{var p=GetValidChoiceCount(u);if((!t.bOpt||l>1)&&1==p.nCount){var g=GetAttributeValue(u);"SELECT"==u.tagName?p.elemFirstValid.selected=!0:p.elemFirstValid.checked=!0;var m=GetAttributeValue(u);g!=m&&(r[s]=m?parseInt(m):0,UpdateCompChoices(e,t,r,s+1))}var g=GetAttributeValue(u);EnableSelectElement(u,!0),""==g&&(n=!0)}}return n}function GetValidChoiceCount(e){var t=0,r=null;if("SELECT"==e.tagName)for(var i=0;i<e.options.length;i++){var n=e.options[i],a=parseInt(n.value?n.value:"0");a>0&&!n.disabled&&1==++t&&(r=n)}else for(var o=document.getElementsByName(e.name),i=0;i<o.length;i++){var l=o[i],a=parseInt(l.value?l.value:"0");a>0&&1==++t&&(r=l)}return{nCount:t,elemFirstValid:r}}function EnableSelectElement(e,t){if("SELECT"==e.tagName)e.disabled=!t;else for(var r=document.getElementsByName(e.name),i=0;i<r.length;i++){var n=r[i];n.disabled=!t}}function GetProdChoices(e,t,r){if(!e.arrComps)return[];for(var i=!1,n=new Array(e.arrComps.length),a=0;a<e.arrComps.length;a++){var o=e.arrComps[a];if(o.aA){n[a]=new Array(o.aA.length);for(var l=0;l<o.aA.length;l++){var s=o.aA[l];
32if(s.nCC&&s.elem)if(r)o.bOpt&&o.bSelDef&&"SPAN"==s.elem.elemHTML.tagName?n[a][l]=1:n[a][l]=0;else{var c=GetAttributeValue(s.elem.elemHTML),d=""==c?0:parseInt(c,10);e.bSequentialChoices&&(i?d=0:(0==d||t&&t.name==s.elem.elemHTML.name)&&(o.bOpt&&!IsCompEnabled(o,n[a])||(i=!0))),n[a][l]=d}}}}return n}function UpdateCompChoices(e,t,r,i,n){if(t.aA){var a=t.aA;void 0==n&&(n=a.length);for(var o=i;o<n;o++){var l=GetUserChoiceCount(r),s=GetNormAttr(t,o),c=r[o]?r[o]:"";if(void 0!=s.elem){var d=s.elem,u=d.elemHTML,p=d.arrOptions,g="";"SELECT"==u.tagName?u.options.length=0:g=d.arrHTMLFrag[0];for(var m=0,f=0,v=-1,S=s.nRBCCount,h=p.length,P=0,C=-1,_=!1,I=0;I<h;I++){var A=p[I],T=A[0];r[o]=T?parseInt(T):0;var y=p[I][1],b=p[I][2];if(0==I&&""==y||IsValidOption(t,r,o,o,l))if(_=0==I&&0==r[I],f++,T&&1==++P&&(C=r[o]),"SELECT"==u.tagName)AddOption(u,T,y,T==c,b);else{var R=d.arrHTMLFrag[m+1];S>1&&f%S==0&&I<p.length-1&&(R=d.arrHTMLFrag[S]),g+=y+R}m++}if((!t.bOpt||a.length>1)&&1==P&&(c=C,SetAttributeValue(u,c),r[o]=C,o>l&&UpdateCompChoices(e,t,r,l,o)),0==f||_){if(!t.bOpt){e.bNoATC=!0;var E=e.sProdRef.replace(/^\d+!/,"");$("[id^='EnableIfOutOfStock_']").filter("[id$='_"+E+"']").filter("[data-message]").each(function(){$(this).html($(this).attr("data-message")).removeAttr("data-message")}),$("[id^='EnableIfOutOfStock_']").filter("[id$='_"+E+"']").show(),$("[id^='RemoveIfOutOfStock_']").filter("[id$='_"+E+"']").hide()}"SELECT"==u.tagName&&(u.style.display="none",t.elemHTML.value="",t.elemHTML.style.display="none","checkbox"==t.elemHTML.type&&(t.elemHTML.checked=!1))}if("SELECT"!=u.tagName){document.getElementById("id"+u.name+"_Table").innerHTML=g,SetAttributeValue(u,c)}else-1==u.selectedIndex&&(u.selectedIndex=0);var D=GetAttributeValue(u);r[o]=""==D?0:parseInt(D,10)}}}}function GetPricePerm(e,t){if(t){if(t[e])return t[e];for(var r=Clone(e),i=0;i<e.length;i++)if(e[i]){if(r[i]=0,t[r])return t[r];r[i]=e[i]}}}function IsValidOption(e,t,r,i,n){if(0==e.nInvalidPermCount)return!0;var a=t[r];if(a>0&&0==e.nInvalidAnyCount&&0==e.arrInvalidPerms[r][a])return!0;var o=!IsInvalidAnyChoice(e,t,r,0);if(o)if(r!=i&&r>n-1){for(var l=GetNormAttr(e,r),s=l.nCC-1,c=1;c<l.nCC;c++)t[r]=c,r<t.length-1?IsValidOption(e,t,r+1,i,n)||s--:(-1==e.mapNormPerms[t]||r>0&&!HasValidPrevChoices(e,t,i-1,i))&&s--;o=s>0}else r<t.length-1&&(o=IsValidOption(e,t,r+1,i,n));return t[r]=a,o&&r>0&&(HasValidPrevChoices(e,t,i-1,i)||(o=!1)),o}function IsInvalidAnyChoice(e,t,r,i){if(-1==e.mapNormPerms[t])return!0;if(0==e.nInvalidAnyCount)return!1;for(var n=i;n<t.length;n++){if(0==t[n]){for(var a=e.aA[r].nCC-1,o=1;o<a;o++)t[n]=o,-1==e.mapNormPerms[t]&&a--;if(t[n]=0,a<=0)return!0}if(n!=r){var l=!1,s=t[n];if(t[n]=0,-1==e.mapNormPerms[t]?l=!0:n<t.length-1&&IsInvalidAnyChoice(e,t,r,n+1)&&(l=!0),t[n]=s,l)return!0}}return!1}function HasValidPrevChoices(e,t,r,i){if(r<0)return!0;var n=!1,a=t[r];if(t[r]=0,-1==e.mapNormPerms[t])n=!0;else{if(t[r]=a,0==a){for(var o=GetNormAttr(e,r),l=o.nCC-1,s=1;s<o.nCC;s++)t[r]=s,-1==e.mapNormPerms[t]?l--:r>0&&!HasValidPrevChoices(e,t,r-1,i)&&l--;t[r]=a,n=l<1}!n&&r>0&&!HasValidPrevChoices(e,t,r-1,i)&&(n=!0)}return t[r]=a,!n&&r>0&&(n=!HasValidPrevChoices(e,t,r-1,i)),!n}function IsCompEnabled(e,t){if(!e||!e.elemHTML)return!1;var r=e.elemHTML,i="on"==r.value;return"checkbox"==r.type?r.checked:void 0==t?i:i&&t[0]>-1}function ChoiceChanged(e,t,r,i){var n=e.name,a;if(0==n.indexOf("v_")){a=n.match(/^v_(.*)_\d+$/)[1]}else 0==n.indexOf("Q_")&&(a=n.substr(2));if(a){g_oConfig.bEstimateChoicePrices||ValidateChoices(a,!0,e)||ShowDynamicPriceMessage(a,g_sUndeterminedPrice);var o=g_mapProds[a];UpdateChoices(o,!1,e),UpdatePrice(o,t,r,i)}}function ValidateChoices(e,t,r){var i=g_mapProds[e];if(!i||!i.arrComps)return!0;for(var n=GetProdChoices(i,r),a=0;a<i.arrComps.length;a++)if(n[a]){var o=i.arrComps[a];if(IsCompEnabled(o,n[a])&&(!o.bOpt||1!=o.aA.length)&&!ValidateComp(n[a],o.aA,t))return!1}return r&&null!=r.name&&0===r.name.indexOf("WL_")&&AddJSFlagToProductForm(r),!0}function ValidateComp(e,t,r){for(var i=0;i<e.length;i++)if(!e[i]){if(!r){var n="Please select a "+t[i].sN,a=t[i].elem.elemHTML;if(alert(n),"SELECT"!=a.tagName){var o=a.id.replace(/(_(\d+|))$/,""),l=document.getElementsByName(o);l.length>0&&(a=l[0])}a.focus()}return!1}return!0}
32function UpdatePrice(e,t,r,i){if(e&&!e.bFixPrice&&!e.bNoATC&&t){var n=document.getElementById("id"+e.sProdRef+"TaxIncPrice"),a=document.getElementById("id"+e.sProdRef+"TaxExcPrice"),o=document.getElementById("id"+e.sProdRef+"AccountPrice");if(n||a||o){var l=document.getElementById("id"+e.sProdRef+"VATMsg"),s=document.getElementById("id"+e.sProdRef+"DynamicPrice"),c=document.getElementById("id"+e.sProdRef+"StaticPrice");e.bOvrStaticPrice&&c&&!e.bQuantityBreak&&(c.style.visibility="hidden",c.style.display="none");var d=GetOriginalRef(e.sProdRef);if(g_mapDynPrices[d]||g_mapDynPrices.ErrorMsg){if(g_mapDynPrices.ErrorMsg||g_mapDynPrices[d].ErrorMsg)return l&&(l.style.visibility="hidden",l.style.display="none"),a?a.innerHTML=g_mapDynPrices.ErrorMsg?g_mapDynPrices.ErrorMsg:g_mapDynPrices[d].ErrorMsg:n&&(n.innerHTML=g_mapDynPrices.ErrorMsg?g_mapDynPrices.ErrorMsg:g_mapDynPrices[d].ErrorMsg),void(s&&(s.style.display="",s.style.visibility="visible"));l&&(l.style.visibility="visible",l.style.display="");var u=g_mapDynPrices[d].Total,p=g_mapDynPrices[d].Total+g_mapDynPrices[d].Tax1+g_mapDynPrices[d].Tax2;a&&(a.innerHTML=FormatPrices(u)),n&&(n.innerHTML=FormatPrices(p))}else getDynamicAccPrice(t,r,e,i);s&&(s.style.display="",s.style.visibility="visible")}}}function FormatPrices(e){for(var t=[],r=0;r<g_oConfig.arrCurrs.length;r++){var i=g_oConfig.arrCurrs[r];t.push(FormatPrice(e,i))}return 1==t.length?t[0]:Sprintf(g_oConfig.sPriceFmt,t[0],t[1])}function ZeroPad(e,t){var r=e.toString();return r.length<t&&(r="000000000000000".substr(0,t-r.length)+r),r}function FormatPrice(e,t){var r=parseFloat(t.sRate),i=Math.round(e*r),n=Math.pow(10,t.nDecs),a=Math.pow(10,t.nThous),o="",l=i;if(n>1){var s=l%n;o=t.sDecSep+ZeroPad(s,t.nDecs),l=parseInt(l/n)}if(0==l)o="0"+o;else for(;l;){var c=l%a;l=parseInt(l/a),o=l?t.sThouSep+ZeroPad(c,t.nThous)+o:c.toString()+o}return t.sSym+o}function GetTaxRate(e){return e/100}function AddOption(e,t,r,i,n){var a=document.createElement("OPTION");return a.text=r,a.value=t,i&&(a.selected=!0),a.className=n,e.options.add(a),a}function CSelect(e){this.elemHTML=e,"SELECT"==e.tagName?(this.arrOptions=GetOptionsArray(e),this.sValue=e.value):this.arrOptions=GetOptionsArray(e,this)}function GetOptionsArray(e,t){var r=[];if("SELECT"==e.tagName)for(var i=0;i<e.options.length;i++){var n=e.options[i],a=[n.value,n.text,n.className];r.push(a)}else{var o=document.getElementById("id"+e.name+"_Table");if(o){for(var l=o.innerHTML,s=[],c=document.getElementsByName(e.name),d=0,u=0,i=0;i<c.length;i++){var p=c[i],g=p.value,m=p.className,f=e.name+"_"+g,v=document.getElementById(f),S=v.outerHTML;if(!S){var h=l.indexOf(v.id),P=l.lastIndexOf("<",h),C=l.indexOf(">",P+v.innerHTML.length);S=l.substring(P,C+1)}r.push([g,S,m]),u=l.indexOf(S,d),s.push(l.substring(d,u)),d=u+S.length}s.push(l.substr(d)),t.arrHTMLFrag=s}}return r}function GetChoiceValues(e){for(var t=[],r=GetAttributes(e),i=0;i<r.length;i++){var n=GetAttributeValue(r[i]),a=""==n?0:parseInt(n,10);t.push(a)}return t}var reProdRefName=/^v_(.*)_\d+$/,reProdRefID=/^v_(.*)_\d+_\d+$/;function GetProdRefFromElem(e){var t=e.name;if(!t){var r=e.id.match(reProdRefID);if(r)return r[1]}if(t){var r=t.match(reProdRefName);if(r)return r[1]}return""}var reAttr=/\bajs-attr\b/;function GetAttributes(e){for(var t={},r={},i=GetAllElements(e),n=0;n<i.length;n++){var a=i[n];if(reAttr.test(a.className)){var o=GetProdRefFromElem(a);if(t[o]||(t[o]=[]),"SELECT"==a.tagName)t[o].push(a);else{var l=a.id.replace(/_\d+$/,"");a.name=l,r[l]||(r[l]=a,t[o].push(a))}}}return t}function GetAttributeValue(e){if("SELECT"==e.tagName)return e.value;for(var t=document.getElementsByName(e.name),r=0;r<t.length;r++)if(t[r].checked)return t[r].value;return 0}function SetAttributeValue(e,t){if("SELECT"==e.tagName)return e.value=t,e.value==t;for(var r=document.getElementsByName(e.name),i=0;i<r.length;i++)if(r[i].value==t)return r[i].checked=!0,!0;return r.length>0&&(r[0].checked=!0),!1}function Clone(e){for(var t=new Array(e.length),r=0;r<e.length;r++)t[r]=e[r];return t}function QuantityTimer(e,t,r,i){var n=e.name;if(0==n.indexOf("Q_")&&(sProdRef=n.substr(2)),sProdRef){var a=g_mapProds[sProdRef];if(!g_oConfig.bEstimateChoicePrices&&!ValidateChoices(sProdRef,!0,e)){var o=document.getElementById("id"+sProdRef+"DynamicPrice"),l=document.getElementById("id"+sProdRef+"StaticPrice");return a.bOvrStaticPrice&&o&&"none"==o.style.display&&(l&&!a.bQuantityBreak&&(l.style.visibility="hidden",l.style.display="none"),o.style.display="",o.style.visibility="visible"),void ShowDynamicPriceMessage(sProdRef,g_sUndeterminedPrice)}
32a.arrComps&&UpdateChoices(a,!1,e),UpdatePrice(a,t,r,i)}}function QuantityChanged(e,t,r,i){timeout&&(clearTimeout(timeout),timeout=null),timeout=setTimeout(function(){QuantityTimer(e,t,r,i)},g_nTimeout)}function ShowDynamicPriceMessage(e,t){var r=document.getElementById("id"+e+"TaxIncPrice"),i=document.getElementById("id"+e+"TaxExcPrice"),n=document.getElementById("id"+e+"VATMsg");if(n&&(n.style.visibility="hidden",n.style.display="none"),r&&i?(r.innerHTML="",i.innerHTML=t):r?r.innerHTML=t:i&&(i.innerHTML=t),IsPayPalPayLaterEnabled()){var a=0,o=document.getElementById("id"+e+"PayLaterMessage");if(!o)return void 0!==IsFilterAsDefaultView||IsFilterAsDefaultView(),void UpdatePayPalPayLaterMessages(0);o.setAttribute("data-pp-amount",0),paypal.Messages().render(".pp-pay-later-message")}}function GetChangedElemIndices(e,t){if(t&&e.arrComps)for(var r=0;r<e.arrComps.length;r++){var i=e.arrComps[r];if(i.aA)for(var n=0;n<i.aA.length;n++){var a=i.aA[n];if("SELECT"==t.tagName){if(a.elem.elemHTML==t)return{nCompIndex:r,nAttrIndex:n}}else if("INPUT"==t.tagName&&"radio"==t.type&&a.elem.elemHTML.name==t.name)return{nCompIndex:r,nAttrIndex:n}}}}function CloneArray(e){for(var t=new Array(e.length),r=0;r<e.length;r++)t[r]=e[r];return t}function UpdateUserSequence(e,t,r){for(var i=e.arrUserSeq,n=r[t],a=0;a<i.length;a++)if(i[a]==t){i.splice(a,1);break}n>0&&i.push(t)}function NormaliseAttrSeq(e){if(e.aA){for(var t=[],r={},i=0;i<e.arrUserSeq.length;i++){var n=e.arrUserSeq[i];r[n]=1,t.push(n)}for(var i=0;i<e.aA.length;i++)r[i]||t.push(i);e.arrNormAttrSeq=t}}function NormaliseUserChoices(e,t){for(var r=[],i=0;i<e.arrNormAttrSeq.length;i++){var n=e.arrNormAttrSeq[i];r.push(t[n])}return r}function GetNormAttr(e,t){var r=e.arrNormAttrSeq[t];return e.aA[r]}function MapInvalidPermutations(e){if(e.nInvalidPermCount=0,e.mP){var t={},r=e.mP,i=e.hOS;for(var n in r){var a=r[n];(-1==a[0]||0==a[0]&&i&&""!=a[1]&&void 0!=g_mapStockByRef[a[1]]&&g_mapStockByRef[a[1]]<=0)&&(t[n]=-1,e.nInvalidPermCount++)}e.mapInvalid=t}}function NormalisePerms(e){var t={},r=e.mapInvalid;for(var i in r)if(1==e.aA.length)t[i]=-1;else{for(var n=i.split(","),a=[],o=0;o<e.arrNormAttrSeq.length;o++){var l=e.arrNormAttrSeq[o];a.push(n[l])}t[a]=-1}e.mapNormPerms=t,GetInvalidAttrCounts(e)}function GetInvalidAttrCounts(e){e.nInvalidAnyCount=0;for(var t=new Array(e.aA.length),r=0;r<t.length;r++){for(var i=GetNormAttr(e,r),n=i.nCC,a=new Array(n),o=0;o<n;o++)a[o]=0;t[r]=a}for(var l in e.mapNormPerms)for(var s=l.split(","),r=0;r<s.length;r++){var c=t[r],d=s[r];0!=d?c[d]++:e.nInvalidAnyCount++}e.arrInvalidPerms=t}function GetUserChoiceCount(e){for(var t=0,r=0;r<e.length;r++)0!=e[r]&&t++;return t}function AddJSFlagToProductForm(e){var t=$(e).closest("form");null!=t&&t.append('<input type="hidden" name="JS" value="1" />')}function PreValidate(e){return AddJSFlagToProductForm(e),!0}var g_wishListForm,g_sAddToCartButtonName="ACTION_ADDTOCART";$(function(){$(".wishlist-row").on("submit",function(e){return"Add to Cart"==$(document.activeElement).val()&&(g_sAddToCartButtonName=$(document.activeElement)[0].name,e.preventDefault(),g_wishListForm=this,$.ajax({url:this.action,type:"POST",dataType:"json",data:$(this).serialize()+"&"+g_sAddToCartButtonName+"=Add to Cart&AJAX=1",success:function(e){$(".wishlistmodal").show(),$(this).addClass("showPopup"),$(".atcpopup").slideFadeToggle()},error:function(e,t,r){$(g_wishListForm).append('<input type="hidden" name="'+g_sAddToCartButtonName+'" value="Add to Cart" /> '),g_wishListForm.submit()}})),!0}),$(".addanother").on("click",function(){return $(g_wishListForm).append('<input type="hidden" name="NEXT_ACTION" value="ADD_ANOTHER" /> '),$(g_wishListForm).append('<input type="hidden" name="'+g_sAddToCartButtonName+'" value="Add to Cart" /> '),g_wishListForm.submit(),!1}),$(".gotocart").on("click",function(){return $(g_wishListForm).append('<input type="hidden" name="NEXT_ACTION" value="GO_TO_CART" /> '),$(g_wishListForm).append('<input type="hidden" name="'+g_sAddToCartButtonName+'" value="Add to Cart" /> '),g_wishListForm.submit(),!1})}),$.fn.slideFadeToggle=function(e,t){return this.animate({opacity:"toggle",he
32ight:"toggle"},"fast",e,t)};var g_sAddToWishListButtonName;$(function(){$(".wish-list-button-popup").parents("form").on("submit",function(e){return"Add To Wish List"==$(document.activeElement).val()&&(g_sAddToWishListButtonName=$(document.activeElement)[0].name,e.preventDefault(),g_wishListForm=this,$.ajax({url:this.action,type:"POST",dataType:"json",data:$(this).serialize()+"&"+g_sAddToWishListButtonName+"=Add To Wish List&AJAX=1",success:function(e){if("ENFORCE_LOGIN"===e.result)return window.location=e.redirectUrl,!0;$(".wishlistmodal").show(),$(this).addClass("showPopup"),$(".atcpopup").slideFadeToggle()},error:function(e,t,r){$(g_wishListForm).append('<input type="hidden" name="'+g_sAddToWishListButtonName+'" value="Add To Wish List" /> '),g_wishListForm.submit()}})),!0}),$(".wl_goback").on("click",function(){return $(g_wishListForm).append('<input type="hidden" name="NEXT_ACTION" value="GO_BACK" /> '),$(g_wishListForm).append('<input type="hidden" name="'+g_sAddToWishListButtonName+'" value="Add To Wish List" /> '),g_wishListForm.submit(),!1}),$(".wl_gotowishlist").on("click",function(){return $(g_wishListForm).append('<input type="hidden" name="NEXT_ACTION" value="GO_TO_WISHLIST" /> '),$(g_wishListForm).append('<input type="hidden" name="'+g_sAddToWishListButtonName+'" value="Add To Wish List" /> '),g_wishListForm.submit(),!1})});var nStartPos=-1,bUseTable=!1;function CreateRecentProduct(e,t,r,i){this.sPid=e,this.sPname=t,this.sPprice=r,this.sThumb=i}function GetRecentFromCookie(){var e=getCookie("ACTINIC_RECENT");if(null!=e&&e.length>10){for(var t=new Array,r=e.split("\f"),i=0;i<r.length;i++){var n=r[i].split("\t");t.push(new CreateRecentProduct(n[0],n[1],n[2],n[3]))}return t}return!1}function SetRecentToCookie(e){for(var t="",r=0;r<e.length;r++)t+=e[r].sPid+"\t"+e[r].sPname+"\t"+e[r].sPprice+"\t"+e[r].sThumb+"\f";t=t.slice(0,-1);var i=new Date;i.setTime(i.getTime()+36e5*nKeepRecentHours),setCookie("ACTINIC_RECENT",t,i)}function ReplaceVariables(e,t){var r=0==t.sThumb.indexOf("file:///")?t.sThumb:catalogDir+t.sThumb;return e=e.replace(/_PID_/g,t.sPid),e=e.replace(/_ENAME_/g,escape(t.sPname)),e=e.replace(/_NAME_/g,t.sPname),e=e.replace(/_PRICE_/g,t.sPprice),e=e.replace(/_THUMB_/g,r),e=e.replace(/_SSURL_/g,ssURL),e=e.replace(/_HREF_/g,"href")}function ScrollBackRecent(){var e=GetRecentFromCookie();e&&e.length>nTrimListTo&&(nStartPos-=nScrollBy,nStartPos<0&&(nStartPos=0),document.getElementById("recenthtlist").innerHTML=bUseTable?RecentProductsListTableHTML():RecentProductsListHTML(),SetBackForwardButtons())}function ScrollForwardRecent(){var e=GetRecentFromCookie();e&&e.length>nTrimListTo&&(nStartPos<0&&(nStartPos=0),nStartPos+=nScrollBy,nStartPos>e.length-nTrimListTo&&(nStartPos=e.length-nTrimListTo),document.getElementById("recenthtlist").innerHTML=bUseTable?RecentProductsListTableHTML():RecentProductsListHTML(),SetBackForwardButtons())}function SetBackForwardButtons(){var e=GetRecentFromCookie();if(e){var t;(t=document.getElementById("scrollbackrecent"))&&(t.disabled=nStartPos<=0,t.style.cursor=nStartPos<=0?"default":"pointer"),(t=document.getElementById("scrollforwardrecent"))&&(t.disabled=nStartPos>=e.length-nTrimListTo,t.style.cursor=nStartPos>=e.length-nTrimListTo?"default":"pointer")}}function TrimRecentProductsList(e){var t=e.length;if(t<=nTrimListTo)return nStartPos=0,e;var r=new Array;for(nStartPos<0&&(nStartPos=t-nTrimListTo),nStartPos>t-nTrimListTo&&(nStartPos=t-nTrimListTo),i=0;i<nTrimListTo;i++)r.push(e[nStartPos+i]);return r}function RecentProductsListHTML(){var e=GetRecentFromCookie();if(e){e=TrimRecentProductsList(e),bDisplayReversed&&e.reverse();for(var t="",r=0;r<e.length;r++)t+=ReplaceVariables(sRecentItem,e[r]);if(""!=t)return sRecentPrefix+t+sRecentSuffix}return sRecentEmptyList}function RecentProductsListTableHTML(){var e=GetRecentFromCookie();if(e){e=TrimRecentProductsList(e),bDisplayReversed&&e.reverse();for(var t=!1,r=sRecentImageRowPrefix,i=sRecentDescRowPrefix,n=sRecentPriceRowPrefix,a=sRecentDeleteRowPrefix,o=0;o<e.length;o++)bHaveItems=!0,r+=ReplaceVariables(sRecentImageItem,e[o]),i+=ReplaceVariables(sRecentDescItem,e[o]),n+=ReplaceVariables(sRecentPriceItem,e[o]),a+=ReplaceVariables(sRecentDeleteItem,e[o]);if(bHaveItems)return sRecentPrefix+r+sRecentImageRowSuffix+i+sRecentDescRowSuffix+n+sRecentPriceRowSuffix+a+sRecentDeleteRowSuffix+sRecentSuffix}return sRecentEmptyList}
32function DisplayRecentProducts(e){bUseTable=!0===e,e?(document.write(RecentProductsListTableHTML()),SetBackForwardButtons()):(document.write(RecentProductsListHTML()),SetBackForwardButtons())}function SaveRecentProduct(e,t,r,i){if(""!=i){var n=new Array,a=GetRecentFromCookie();if(a)for(var o=0;o<a.length;o++)a[o].sPid!=e&&n.push(a[o]);for(n.push(new CreateRecentProduct(e,t,r,i));n.length>nMaxRecent;)n.shift();SetRecentToCookie(n)}}function DeleteRecent(e,t){var r=new Array,i=GetRecentFromCookie();if(i)for(var n=0;n<i.length;n++)i[n].sPid!=e&&r.push(i[n]);if(SetRecentToCookie(r),t)document.getElementById("recenthtlist").innerHTML=RecentProductsListTableHTML();else{var a=document.getElementById("recenthtlist");null===a&&(a=document.getElementById("recentstlist")),a&&(a.innerHTML=RecentProductsListHTML())}SetBackForwardButtons()}/*************************************************************** 33* 34* Responsive.js - utility functions for responsive web design 35* 36* Copyright (c) 2014 SellerDeck Limited 37* 38****************************************************************/ 39void 0===window.SD&&(window.SD={}),window.SD.Responsive={CallFunctions:function(){SD.Responsive.contactInfoTop(),SD.Responsive.menus(),SD.Responsive.orderHistory(),SD.Responsive.orderHistoryDisplay(),SD.Responsive.searchButton(),SD.Responsive.ie9(),SD.Responsive.android(),SD.Responsive.setBrowserSizeListener(),SD.Responsive.moveSizeDependentComponents(),SD.Responsive.quantityButtons(),SD.Responsive.addNavigateOnClick(),SD.Responsive.removeDuplicatedInfo(),SD.Responsive.resizeImages()},contactInfoTop:function(){var e=function(){$(".topContactInfoMobile div").css("clear","none"),$(".topContactInfoMobile div").css("width",""),$(".topContactInfoMobile div p.contactInfoP").css("display","none"),$(".topContactInfoMobile div p.contactInfoP").css("width",""),$(".topContactInfoMobile .contactInfoTopCol1").removeClass("colClass"),$(".topContactInfoMobile .contactInfoTopCol2").removeClass("colClass"),$(".topContactInfoMobile .contactInfoTopCol3").removeClass("colClass"),$(".navigation-bar .miniNav").removeAttr("style")},t=function(){$(".navigation-bar .miniNav").css("float","left")};e();var r=function(){e(),$(".topContactInfoMobile .contactInfoTopCol1").addClass("colClass"),$(".topContactInfoMobile .contactInfoTopCol1 p.contactInfoP").css("width","95%"),$(".topContactInfoMobile .contactInfoTopCol1 p.contactInfoP").toggle()},i=function(){e(),$(".topContactInfoMobile .contactInfoTopCol2").addClass("colClass"),$(".topContactInfoMobile .contactInfoTopCol2 p.contactInfoP").css("width","95%"),$(".topContactInfoMobile .contactInfoTopCol2 p.contactInfoP").toggle()},n=function(){e(),$(".topContactInfoMobile .contactInfoTopCol3").addClass("colClass"),$(".topContactInfoMobile .contactInfoTopCol3 p.contactInfoP").css("width","95%"),$(".topContactInfoMobile .contactInfoTopCol3 p.contactInfoP").toggle()};$(".topContactInfoMobile .contactInfoTopCol1 div.contactInfoClick").click(function(){r(),t(),$(".topContactInfoMobile .contactInfoTopCol1 div.contactInfoClick").click(function(){SD.Responsive.contactInfoTop()})}),$(".topContactInfoMobile .contactInfoTopCol2 div.contactInfoClick").click(function(){i(),t(),$(".topContactInfoMobile .contactInfoTopCol2 div.contactInfoClick").click(function(){SD.Responsive.contactInfoTop()})}),$(".topContactInfoMobile .contactInfoTopCol3 div.contactInfoClick").click(function(){n(),t(),$(".topContactInfoMobile .contactInfoTopCol3 div.contactInfoClick").click(function(){SD.Responsive.contactInfoTop()})})},menus:function(){$("div #mega-menu").addClass("menuHide"),$("#mainNav").click(function(e){$("div #mega-menu").slideToggle("slow",function(){$("div #mega-menu").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #brochure-menu").addClass("menuHide"),$("#mainNav").click(function(e){$("div #brochure-menu").slideToggle("slow",function(){$("div #brochure-menu").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #quickSearchLeft").addClass("menuHide"),$("#quickSearchTitle").click(function(e){$("#quickSearchLeft").slideToggle("slow",function(){$("#quickSearchLeft").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #shoppingCartSummaryLeft").addClass("menuHide"),$("#shoppingCartSummaryTitle").click(function(e){$("#shoppingCartSummaryLeft").slideToggle("slow",function(){$("#shoppingCartSummaryLeft").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #productFiltersLeft").addClass("menuHide"),$("#productFiltersTitle").click(function(e){$("#productFiltersLeft").slideToggle("slow",function(){$("#productFiltersLeft").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #infoBox").addClass("menuHide"),$("#infoBoxTitle").click(function(e){$("#infoBox").slideToggle("slow",function(){$("#infoBox").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #storeSections").addClass("menuHide"),$("#storeSectionsTitle").click(function(e){$("#storeSections").slideToggle("slow",function(){$("#storeSections").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #information").addClass("menuHide"),$("#informationTitle").click(function(e){$("#information").slideToggle("slow",function(){$("#information").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #bestSellerLeft").addClass("menuHide"),$("#bestSellerTitle").click(function(e){$("#bestSellerLeft").slideToggle("slow",function(){$("#bestSellerLeft").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #newProductLeft").addClass("menuHide"),$("#newProductTitle").click(function(e){$("#newProductLeft").slideToggle("slow",function(){$("#newProductLeft").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()}),$("div #couponFieldLeft").addClass("menuHide"),$("#couponFieldTitle").click(function(e){$("#couponFieldLeft").slideToggle("slow",function(){$("#couponFieldLeft").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")}),e.preventDefault()})},m_bResponsiveDeliveryFields:!1,setResponsiveDeliveryFields:function(e){
39SD.Responsive.m_bResponsiveDeliveryFields=e},getResponsiveDeliveryFields:function(){return SD.Responsive.m_bResponsiveDeliveryFields},orderHistory:function(){$("div#idORDER_TRACKING table tr.cart td:nth-child(1)").prepend("<span>Order Number:</span>"),$("div#idORDER_TRACKING table tr.cart td:nth-child(2)").prepend("<span>Date Ordered:</span>"),$("div#idORDER_TRACKING table tr.cart td:nth-child(3)").prepend("<span>Value:</span>"),$("div#idORDER_TRACKING table tr.cart td:nth-child(4)").prepend("<span>Status:</span>"),$("div#idORDER_TRACKING table tr.cart td:nth-child(5)").prepend("<span>Date Shipped:</span>"),$("div#idORDER_TRACKING table tr.cart td:nth-child(6)").prepend("<span>Carrier:</span>"),$("div#idORDER_TRACKING table tr.cart td:nth-child(7)").prepend("<span>Delivery Tracking:</span>"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td").find("span").remove("span"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(1)").prepend("<span>Product Ref:</span>"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(2)").prepend("<span>Item:</span>"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(3)").prepend("<span>Qty Ordered:</span>"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(4)").prepend("<span>Qty Shipped:</span>"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(5)").prepend("<span>Cancelled:</span>"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(6)").prepend("<span>Qty Back Ordered:</span>"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(7)").prepend("<span>Total Value:</span>"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr td").each(function(){var e=$
39(this);e.html(e.html().replace(/ /g,""))})},orderHistoryDisplay:function(){$("#idLookupAgain").addClass("hide"),$("#idLOOKUPORDERSFORM fieldset input[value='Lookup Order']").on("click",function(){$("#idLookupAgain").removeClass("hide"),$("#idLOOKUPORDERSFORM").toggle(),$("div#idLOOKUPORDERS > p:nth-child(2)").toggle()}),$("#idORDER_TRACKING").length&&($("#idLookupAgain").removeClass("hide"),$("#idLOOKUPORDERSFORM").toggle(),$("div#idLOOKUPORDERS > p:nth-child(2)").toggle()),$("#idLookupAgain").on("click",function(){$("#idLookupAgain").addClass("hide"),$("#idLOOKUPORDERSFORM").toggle(),$("div#idLOOKUPORDERS > p:nth-child(2)").toggle()})},searchButton:function(){$("div #searchFields").addClass("menuHide"),$("#searchButton").click(function(e){$("div #searchFields").slideToggle("slow",function(){$("div #searchFields").toggleClass("menuHide").toggleClass("menuShow").removeAttr("style")})})},ie9:function(){function e(){var e=!1;if("Microsoft Internet Explorer"==navigator.appName){var t=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(t)&&(e=9==parseFloat(RegExp.$1))}return e}e()?$("body").addClass("IeOnly"):$("body").removeClass("IeOnly")},android:function(){$("body").removeClass("androidOnly");var e=navigator.userAgent;e.indexOf("Mozilla/5.0")>-1&&e.indexOf("Android ")>-1&&e.indexOf("AppleWebKit")>-1&&!(e.indexOf("Chrome")>-1)&&$("body").addClass("androidOnly")},m_nWindowWidth:0,m_timerResizeID:0,setBrowserSizeListener:function(){SD.Responsive.m_nWindowWidth=SD.Responsive.getBrowserWidth(),$(window).resize(function(){null!=SD.Responsive.m_timerResizeID&&window.clearTimeout(SD.Responsive.m_timerResizeID),SD.Responsive.m_timerResizeID=window.setTimeout(SD.Responsive.resizeIfNeeded,20)})},resizeIfNeeded:function(){SD.Responsive.m_timerResizeID=null,SD.Responsive.m_nWindowWidth!=SD.Responsive.getBrowserWidth()&&(SD.Responsive.m_nWindowWidth=SD.Responsive.getBrowserWidth(),SD.Responsive.moveSizeDependentComponents())},getBrowserWidth:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},moveSizeDependentComponents:function(){SD.Responsive.moveMiniNavItems(),SD.Responsive.menuAlignment()}
39,m_bMiniNavVisible:!1,moveMiniNavItems:function(){var e=$("div.miniNav").is(":visible");SD.Responsive.m_bMiniNavVisible!=e&&(SD.Responsive.m_bMiniNavVisible=e,SD.Responsive.m_bMiniNavVisible?($("#mega-menu").insertAfter(".mainNav"),$("#brochure-menu").insertAfter(".mainNav"),$("#quickSearchLeft").insertAfter(".quickSearchTitle"),$("#shoppingCartSummaryLeft").insertAfter("#shoppingCartSummaryTitle"),$("#productFiltersLeft").insertAfter(".productFiltersTitle"),$("#infoBox").insertAfter("#infoBoxTitle"),$("#storeSections").insertAfter("#storeSectionsTitle"),$("#information").insertAfter("#informationTitle"),$("#bestSellerLeft").insertAfter("#bestSellerTitle"),$("#newProductLeft").insertAfter("#newProductTitle"),$("#couponFieldLeft").insertAfter("#couponFieldTitle")):($("#mega-menu").insertAfter(".miniNav"),$("#brochure-menu").insertAfter(".miniNav"),$("#couponFieldLeft").prependTo("#left-sidebar > .sidebar"),$("#newProductLeft").prependTo("#left-sidebar > .sidebar"),$("#bestSellerLeft").prependTo("#left-sidebar > .sidebar"),$("#information").prependTo("#left-sidebar > .sidebar"),$("#storeSections").prependTo("#left-sidebar > .sidebar"),$("#infoBox").prependTo("#left-sidebar > .sidebar"),$("#productFiltersLeft").prependTo("#left-sidebar > .sidebar"),$("#shoppingCartSummaryLeft").prependTo("#left-sidebar > .sidebar"),$("#quickSearchLeft").prependTo("#left-sidebar > .sidebar")))},quantityButtons:function(){$("fieldset.quantity-box input[type!='hidden']").before('<button type="button" class="dec quantityButton">-</button>').after('<button type="button" class="inc quantityButton">+</button>'),$(".quantityButton").on("click",function(e){var t=$(e.delegateTarget),r=t.parent().find("input");if(r&&$.isNumeric(r.val())){var i=parseInt(r.val(),10),n;n=t.hasClass("inc")?i+1:i>0?i-1:0,r.val(n);var a=$.Event("keyup");a.which=16,r.trigger(a)}})},addNavigateOnClick:function(){$(".navigateOnClick").on("click",function(e){var t=$(e.target).closest(".navigateOnClick"),r=$(t).find("a").filter(":first");r&&(window.location.href=r.attr("href"))})},removeDuplicatedInfo:function(){$(".checkout-cart tr td.cart").each(function(){$(this).find(".mobileHeader:contains('REF') + .floatLeft:contains('Â ')").prev().remove(),$(this).find(".floatLeft:contains('Â ')").remove()})},resizeImages:function(){$(window).on("load",function(){window.pg_nSectionImageMaxWidth&&0==window.pg_nSectionImageMaxWidth||$(".section-link-details .section-link-image img, .product-details .product-image img").each(function(){var e=$
39(this).prop("naturalWidth"),t=e>window.pg_nSectionImageMaxWidth?window.pg_nSectionImageMaxWidth:e;$(this).css({"max-width":t+"px",width:"100%"})}),window.pg_nProductImageMaxWidth&&0==window.pg_nProductImageMaxWidth||$("#product-page-body form .product-image img").each(function(){var e=$(this).prop("naturalWidth"),t=e>window.pg_nProductImageMaxWidth?window.pg_nProductImageMaxWidth:e;$(this).css({"max-width":t+"px",width:"100%"})})})},m_bMainNavVisible:!1,menuAlignment:function(){var e=$("div#mega-menu").is(":visible");if(SD.Responsive.m_bMainNavVisible!=e)if(SD.Responsive.m_bMainNavVisible=e,SD.Responsive.m_bMainNavVisible){$("#mega-menu ul li a, #brochure-menu ul li a").css({height:""});var t=0;$("#mega-menu ul li, #brochure-menu ul li").each(function(){$(this).height()>t&&(t=$(this).height())}),$("#mega-menu ul li a, #brochure-menu ul li a").css({height:t+"px"}),$("#mega-menu ul li ul > li a, #brochure-menu ul li ul > li a").css({height:""})}else $("#mega-menu ul li a, #brochure-menu ul li a").removeAttr("style")}}; 40//# sourceMappingURL=sellerdeck.min.map
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.