/*************************************************************** * * ActinicCore.js - core utility functions * * Copyright (c) 2014 SellerDeck Limited * ****************************************************************/ var 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;i0;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-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;l0&&(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;o0&&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;o0)&&(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;Ee[F.sAsscProdRef]&&(r[L]=1);var w=Math.floor(e[F.sAsscProdRef]/O);N=-1==N?w:Math.min(N,w)}}-1==N&&(r[L]=1)}var k=D[0];if(null!=e[L]){var B=IsInStock(L,e,r);"StockLevel"==k&&(M&&M.bAssemblyProduct&&N>-1?R[E].innerHTML=N: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 U=GetElementByName("Q_"+L);U&&(U.value=0,U.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 > .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),$("#idPSPinput201").toggle("201"==e),$("#idPSPinput500").toggle("500"==e),$("#idPSPinput501").toggle("501"==e),bNotWallet=-1==$.inArray(e,["500","201","202","203"]),$("#idBtnConfirm").toggle(bNotWallet),"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(''),AddHiddenShipClass(e);var r=document.getElementsByName("INVOICEADDRESSSELECT").length>0,i=!1;r&&(i=!IsElementChecked("idINVOICEADDRESSSELECT_0"));var n=document.getElementById("idSEPARATESHIP"),a=!1;if(r&&(a=!IsElementChecked("idDELIVERADDRESSSELECT_0")),a||(a=n&&!n.checked),i&&a)return!0;for(var o=GetAllElements(t),l=0;l')}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='',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/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}function 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=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 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}function 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;u0)&&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"+s+"";$("#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"+r+" "+a+" "+i+", "+n+"",$("#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)}function SetupInfoWindow(e){var t=e.pickupLocationDetails,r=Array(7),n="";for(i=0;i
"+(""!=t.property?t.property+"
":"")+(""!=t.street?t.street+"
":"")+(""!=t.locality?t.locality+"
":"")+(""!=t.town?t.town+"
":"")+(""!=t.county?t.county+"
":"")+t.postcode+"
";return l+="Distance:"+t.distance+" miles
Car Parking:"+(t.parking?"Yes":"No")+"
Disabled Access:"+(t.disabledaccess?"Yes":"No")+"
",""!=t.directions&&(l+="Additional directions:"+t.directions+"
"),l+="",l+="Normal opening hours: 
Mon: "+(void 0!=r[1]?r[1]:"Closed")+"
Tue: "+(void 0!=r[2]?r[2]:"Closed")+"
Wed: "+(void 0!=r[3]?r[3]:"Closed")+"
Thu: "+(void 0!=r[4]?r[4]:"Closed")+"
Fri: "+(void 0!=r[5]?r[5]:"Closed")+"
",void 0!=r[6]&&(l+="Sat: "+r[6]+"
"),void 0!=r[7]&&(l+="Sun: "+r[7]+"
"),l+="",l+="Latitude:"+e.position.lat().toFixed(5)+" | Longitude:"+e.position.lng().toFixed(5)+"
",l+='
',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&&-11){var t=window.location.pathname;if(/(\.((s?)html|htm))/.test(t)||""==t){var r=pg_sSearchScript.replace("/ss","/aj");$.ajax({url:r+"?ACTIONS=GetUserAccount",dataType:"json",success:function(e){var r=e.GetUserAccount;if(r.success&&1==r.nPriceSchedule&&r.bUseStaticPage){var i=$(".content-area p:first");if(!i.length)return void UpdateSwiftLoginInfo(r);var n=i.html().indexOf("actinic:logout_simple")>-1?r.sLogoutSimple:r.sLogout;i.html(r.sServing+r.sCurrentAccount+r.sMyAccountUrl+n);var a=$(".infoPagesSecondaryBar");if(a.length){var o=$(a[0]).children();$(o[1]).remove()}}r.success&&(r.nPriceSchedule>1||!r.bUseStaticPage)&&(""==t&&(t=r.sHomePage),window.location.href=pg_sCustomerAccountsCGIURL+"?PRODUCTPAGE="+t)}})}}}});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("",a);var o=e.sMyAccountUrl;o=o.replace("|",""),n=n.replace("",o);var l=e.sLogoutSimple;l=l.replace(" ",""),n=n.replace("",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.value)}),e==$("input[name=PAYMENTMETHOD]:checked","#idCheckoutForm").val()&&SetPaymentMethodsVisibility(t.value)):SetPaymentMethodsVisibility(e)}function SetPaymentMethodsVisibility(e){g_nCurrentPspId!=e&&("90"==e&&GetAvailableFinanceProducts(),$("#idPSPinput"+g_nCurrentPspId).toggle(!1),g_nCurrentPspId=e,$("#idPSPinput"+g_nCurrentPspId).toggle(!0),bNotWallet=-1==$.inArray(g_nCurrentPspId,["500","201","202","203"]),$("#idBtnConfirm").toggle(bNotWallet),doPsp(e))}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 GetPriceSchedule(){var e=0,t=getCookie("ACTINIC_BUSINESS");if(!t)return e;for(var r=t.split(/\n/),i=0;ir;)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;p0?(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;if(t.length>0)for(var i=0;i0){for(var a=0;a"+t[a].substr(i.length)+"";l.innerHTML=n?c:""+c+"",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;rr.length&&(s=1),e.AS_navListItem(s)},e.AS_navListItem=function(e){s=e;for(var t=g.getElementsByTagName("li"),r=0;r(.*)<\/strike>)|(<[^>]+>)/g,""),a="",c=0;c((.*?)|(.*?(\n))+.*?)<\/actinic:xmltemplate>)/gi,""),g_sSearchResultsTemplate=g_sSearchResultsTemplate.replace(/(([^`]*?)<\/script>)/gi,"$3"),g_sSearchResultsTemplate=g_sSearchResultsTemplate.replace(/(")),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'):(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();g_bFirstLoad&&g_bCacheStock&&CacheStockFilter(),GetAllProductDetails()}else ClearFilterTimer(),SetFilterTimer(g_eFilterTimer.Cache)}function ReadFilterParamsFromPage(){for(var e=document.forms.filter,t=e.elements,r=0;r0&&(e[r]="(\\!"+n.join("\\!|\\!")+"\\!)")}for(var g=0;g0&&(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;li)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,null,a)}function UpdateProductDetailsFromServer(e,t,r){for(var i="",n=0;n500&&(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;t0&&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(),IsPayPalPayLaterEnabled()&&(UpdatePayPalPayLaterMessages(),RenderPayPalPayLaterMessages())}function FormatStandardResult(e){var t="",r="",i=GetPaginatedProducts(gArrSortedProductRefs,e);0==i.length&&(e=0,i=GetPaginatedProducts(gArrSortedProductRefs,e));for(var n=0;n'+r+"")}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;o1?((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;for(sResultTemplate=ReplaceProductDetailstemplate(objProductDetails,sResultTemplate,nProductCount);sResultTemplate.match(/]*>([^`]*?)<\/Actinic:ScriptFunctionCall>/i);){var arrMatch=sResultTemplate.match(/]*>([^`]*?)<\/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>/i,scriptResult)}}return sResultTemplate}function ReplaceProductDetailstemplate(e,t,r){var i=FormatPrices(e.m_sPrice);t=t.replace(/(<\/Actinic:S_ITEM>)/gi,r);var n="",a=GetPriceSchedule(),o=GetCustomerUseStaticPge();if(IsLoggedIn()&&"undefined"!=typeof pg_sCustomerAccountsCGIURL&&""!==pg_sCustomerAccountsCGIURL&&(a>1||!o)){var l="";IsHostMode()&&(l="SHOP="+pg_sShopID+"&"),n=''}else n='';var s="("+e.m_sSection+") ",c=e.m_sSid,d=i+" ",u=e.m_sDescription+" ";if(t=t.replace(/((<|<)Actinic:S_PNAME(>|>)(<|<)\/Actinic:S_PNAME(>|>))/gi,e.m_sName),t=t.replace(/(<\/Actinic:S_SNAME>)/gi,s),t=t.replace(/(<\/Actinic:S_SID>)/gi,c),t=t.replace(/(<\/Actinic:S_LINK>)/gi,n),t=t.replace(/(<\/Actinic:S_PRAWPRICE>)/gi,e.m_sPrice),t=t.replace(/(<\/Actinic:S_PRICE>)/gi,d),t=t.replace(/(<\/Actinic:S_DESCR>)/gi,u),t=t.replace(/(<\/Actinic:S_STOCK>)/gi,e.m_nStockLevel),""==e.m_sImage&&"undefined"!=typeof pg_sDefaultProductImage&&(e.m_sImage=pg_sDefaultProductImage),""!==e.m_sImage){var p=/(]*ResultImage[^>]*>([^`]*?)<\/div>)/gim,g=new Array;if(null!=(g=p.exec(t))){var m=g[2],f="";"undefined"!=typeof pg_nProductImageWidth&&pg_nProductImageWidth>0&&(f+='width="'+pg_nProductImageWidth+'" '),"undefined"!=typeof pg_nProductImageHeight&&pg_nProductImageHeight>0&&(f+='height="'+pg_nProductImageHeight+'"'),m=m.replace(/=\"\"/gi,""),m=m.replace(/netquotevar:thumbnailsize/gi,f);var v=DecodeHtmlEntity(e.m_sImage);v=EncodeHtmlEntity(v.substr(0,v.lastIndexOf("."))+".webp"),m=m.replace(/NETQUOTEVAR:THUMBNAIL\b/gi,e.m_sImage),m=m.replace(/NETQUOTEVAR:THUMBNAILWEBP\b/gi,v),t=t.replace(p,m)}}else t=t.replace(/(]*ResultImage[^>]*>([^`]*?)<\/div>)/gi,"");if(pg_bShowProductFeedback){var p=/(]*ResultFeefoLogo[^>]*>([^`]*?)<\/div>)/gim,g=new Array;if(null!=(g=p.exec(t))){var S=g[2];S=S.replace(/((<|<)Actinic:S_PRODREF(>|>)(<|<)\/Actinic:S_PRODREF(>|>))/g,e.m_sProdRef),S=S.replace(/((<|<)ACTINIC:S_PRODREF(>|>)(<|<)\/ACTINIC:S_PRODREF(>|>))/g,e.m_sProdRef.toUpperCase()),t=t.replace(p,S)}}else t=t.replace(/(]*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(/(]*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_sChoiceName="",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(.*))/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(.*?)<\/Actinic:S_SUMMARY>)/gi,r))}var i=CalculateMinMaxSearchResult(),r="Results "+i[0]+"-"+i[1]+" of "+gArrSortedProductRefs.length+"";t.innerHTML=t.innerHTML.replace(/((.*?)<\/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:"(.*?)",sHeader:"(.*?)",sShowFirstLink:"(.*?)",sFirstPageURL:"(.*?)",sPrevPageURL:"(.*?)",sLinksPageURL:"(.*?)",sNextPageURL:"(.*?)",sLastPageURL:"(.*?)",sFullPageURL:"(.*?)"};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>/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>/gi,p),l+=u,u=r.sPrevPageURL,p="javascript:OnPagination("+(g_nCurrenPageNumber-1)+")",u=u.replace(/<\/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"+h+" ",u=u.replace(//gi,S)):(u=u.replace(/<\/ACTINIC:PAGINATION_INDEX>/gi,h),u=u.replace(/<\/ACTINIC:PAGINATION_URLLINK>/gi,p)),l+=u;else if(v<\/ACTINIC:PAGINATION_INDEX>/gi,"..."),u=u.replace(/<\/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>/gi,p),l+=u,p="javascript:OnPagination("+(d-1)+")",u=r.sLastPageURL,u=u.replace(/<\/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>/gi,p),u=u.replace(/<\/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;igArrSortedProductRefs.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=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");m>0&&(d=g.substring(0,m),d=d.replace(/(ACT:SELECT)/gi,"select"),u="")}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>)/gi,"-1"),o=o.replace(/(<\/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>)/gi,""),l+=o}var A=0,T=1;o="";for(var y=0;y<\/Actinic:PriceIndex>)/gi,gArrayPriceIDs[y]);var R=gMapPriceBandPriceRange[gArrayPriceIDs[y]].replace(/( )/gi," ");IsFilterCountEnabled()&&(R+=" ("+A+")"),o=o.replace(/(<\/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=''):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>)/gi,sHiddenInput),l+=o}}r?(d="",v="",l="",P="",u=""):(d=d.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,T),d=d.replace(/(<\/Actinic:ListCount>)/gi,T)),e.innerHTML=c+n+S+C+d+v+l+P+u}function CreateFilterPropertyOptions(){for(var e=0;e");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>)/gi,t),P="")}var 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 N="",F=g[m].m_nChoiceCount;L++,d=l,d=d.replace(/(<Actinic:FilterPropValueName><\/Actinic:FilterPropValueName>)/gi,t),d=d.replace(/(<\/Actinic:FilterPropValueName>)/gi,t);var O=g[m].m_sChoiceName;d=d.replace(/(<Actinic:FilterPropValue><\/Actinic:FilterPropValue>)/gi,O),d=d.replace(/(<\/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"',N=''):k="checked"),IsFilterCountEnabled()&&IsHideChoiceWithZeroResults()&&(F>0||(B='style="display:none;"',G='style="display:none;"')),!IsFilterCountEnabled()||IsHideChoiceWithZeroResults()||M||("LIST"===c?F>0||(B='disabled="disabled"'):"LINKS"===c?F>0||(B='disabled="disabled"',G='style="color:gray;cursor:default"'):F>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>)/gi,g[m].m_sChoiceID);var U=g[m].m_sChoiceName;M&&(U="Any"),IsFilterCountEnabled()&&!M&&(U+=" ("+g[m].m_nChoiceCount+")"),d=d.replace(/(<Actinic:FilterPropText><\/Actinic:FilterPropText>)/gi,U),d=d.replace(/(<\/Actinic:FilterPropText>)/gi,U),d=d.replace(/(<\/Actinic:HiddentInput>)/gi,N),u+=d,m++}}1===L&&L++,h=h.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,L),h=h.replace(/(<\/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;eClear';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");m>0&&(d=g.substring(0,m),d=d.replace(/(ACT:SELECT)/gi,"select"),u="")}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>)/gi,"-1"),o=o.replace(/(<\/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>)/gi,""),l+=o}for(var A=0,T=1,y=0;y<\/Actinic:SectionIndex>)/gi,gArraySectionIDs[y]);var b=gMapFilters.SX[gArraySectionIDs[y]].m_sSectionName;IsFilterCountEnabled()&&(b+=" ("+A+")"),o=o.replace(/(<\/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=''):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>)/gi,sHiddenInput),l+=o}r?(d="",v="",l="",P="",u=""):(d=d.replace(/(<Actinic:ListCount><\/Actinic:ListCount>)/gi,T),d=d.replace(/(<\/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;t0)for(var u=0;u0){for(var g=0;g0){for(var a=0;a0&&(t[i]="(\\!"+a.join("\\!|\\!")+"\\!)")}for(var m=0;m0&&(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;a0){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(.*))/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;s0,p=0;p0&&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;e1)&&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;i0&&!n.disabled&&1==++t&&(r=n)}else for(var o=document.getElementsByName(e.name),i=0;i0&&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;i1&&f%S==0&&I1)&&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;i0&&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;c0&&!HasValidPrevChoices(e,t,i-1,i))&&s--;o=s>0}else r0&&(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;n0&&!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;a0&&(a=l[0])}a.focus()}return!1}return!0}function 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;r1){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",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;i0&&(r[0].checked=!0),!1}function Clone(e){for(var t=new Array(e.length),r=0;r0&&i.push(t)}function NormaliseAttrSeq(e){if(e.aA){for(var t=[],r={},i=0;i')}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(' '),g_wishListForm.submit()}})),!0}),$(".addanother").on("click",function(){return $(g_wishListForm).append(' '),$(g_wishListForm).append(' '),g_wishListForm.submit(),!1}),$(".gotocart").on("click",function(){return $(g_wishListForm).append(' '),$(g_wishListForm).append(' '),g_wishListForm.submit(),!1})}),$.fn.slideFadeToggle=function(e,t){return this.animate({opacity:"toggle",height:"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(' '),g_wishListForm.submit()}})),!0}),$(".wl_goback").on("click",function(){return $(g_wishListForm).append(' '),$(g_wishListForm).append(' '),g_wishListForm.submit(),!1}),$(".wl_gotowishlist").on("click",function(){return $(g_wishListForm).append(' '),$(g_wishListForm).append(' '),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;inTrimListTo&&(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;inMaxRecent;)n.shift();SetRecentToCookie(n)}}function DeleteRecent(e,t){var r=new Array,i=GetRecentFromCookie();if(i)for(var n=0;nOrder Number:"),$("div#idORDER_TRACKING table tr.cart td:nth-child(2)").prepend("Date Ordered:"),$("div#idORDER_TRACKING table tr.cart td:nth-child(3)").prepend("Value:"),$("div#idORDER_TRACKING table tr.cart td:nth-child(4)").prepend("Status:"),$("div#idORDER_TRACKING table tr.cart td:nth-child(5)").prepend("Date Shipped:"),$("div#idORDER_TRACKING table tr.cart td:nth-child(6)").prepend("Carrier:"),$("div#idORDER_TRACKING table tr.cart td:nth-child(7)").prepend("Delivery Tracking:"),$("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("Product Ref:"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(2)").prepend("Item:"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(3)").prepend("Qty Ordered:"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(4)").prepend("Qty Shipped:"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(5)").prepend("Cancelled:"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(6)").prepend("Qty Back Ordered:"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr.cart td:nth-child(7)").prepend("Total Value:"),$("div#idORDER_TRACKING [id^=idORDER_DETAILS_] tr td").each(function(){var e=$(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()},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('').after(''),$(".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=$(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")}}; //# sourceMappingURL=sellerdeck.min.map