var Catalog={};Catalog.Utils={FormatUrl:function(a){return document.location.protocol+"//"+document.location.host+a},QueryString:function(a){var b=false,c=location.search.substring(1,location.search.length).split("&");for(i=0;i<c.length;i++){param_name=c[i].substring(0,c[i].indexOf("="));if(param_name==a)b=c[i].substring(c[i].indexOf("=")+1)}return b?b:""},ReplaceQueryString:function(a,b,c){var d=RegExp("([?|&])"+b+"=.*?(&|$)","i");return a.match(d)?a.replace(d,"$1"+b+"="+c+"$2"):a+"&"+b+"="+c}};
Catalog.Inventory={skus:[],AddControlToArray:function(a){Catalog.Inventory.skus.push(a)},RefreshControls:function(a){if(Catalog.Inventory.skus.length>0){a=readCookieName("Recognized")==null&&readCookieName("SelectedStores")==null||a==false?"/Catalog/ButtonControlContent.aspx?PopulateISA=false&AllowSecure=True&lang="+document.documentElement.lang:"/Catalog/ButtonControlContent.aspx?PopulateISA=true&AllowSecure=True&lang="+document.documentElement.lang;JsLib.UI.InjectHTMLMultiple(a,Catalog.Inventory.skus.join("&"),
Catalog.Inventory.skus)}}};
Catalog.DetailsTab={SelectTabSpecWithPagination:function(a,b,c,d,e,f){f=f="/Catalog/DetailsTabs.aspx?Sku="+encodeURIComponent(a)+"&ActiveTab="+encodeURIComponent(b)+"&SortOption="+encodeURIComponent(f);f+=c==""||c==null?"&Page="+encodeURIComponent(d-1)+"&PageSize="+encodeURIComponent(e):"&pcname="+encodeURIComponent(c);$get("BundleDetails").innerHTML=JsLib.HttpRequest.loadText(Catalog.Utils.FormatUrl("/Catalog/DetailsTabs.aspx?Sku="+encodeURIComponent(a)+"&ActiveTab="+encodeURIComponent(b)+"&SelectedProduct="+
encodeURIComponent(selectedId)));a=JsLib.HttpRequest.loadText(Catalog.Utils.FormatUrl(f));a=a.substring(a.indexOf('<div id="tableId"'));a=a.substring(0,a.indexOf("</form>"));$get("div"+b).innerHTML=a;$get("div"+b).style.display="block"},GetBundleDetails:function(a,b,c,d){a=$get(a);for(var e=0;e<a.parentNode.childNodes.length;e++)if(document.getElementsByTagName(a.parentNode.childNodes[e].tagName).item(e)!=null)/MSIE (\d+\.\d+);/.test(navigator.userAgent)?a.parentNode.childNodes[e].removeAttribute("className"):
a.parentNode.childNodes[e].removeAttribute("class");a.className="active";b="/Catalog/BundleTabDetailsContent.aspx?Sku="+encodeURIComponent(b);JsLib.UI.InjectHTML(b,c,d)},GetBundleSpecs:function(a,b,c,d){for(var e=$get(a).parentNode.parentNode.parentNode,f=0;f<e.childNodes.length;f++)if(/MSIE (\d+\.\d+);/.test(navigator.userAgent))e.childNodes[f].removeAttribute("className");else e.childNodes[f].nodeType!=3&&e.childNodes[f].removeAttribute("class");$get(a).parentNode.parentNode.className="active";
a="/Catalog/BundleTabSpecsContent.aspx?Sku="+encodeURIComponent(b);JsLib.UI.InjectHTML(a,c,d)},OpenGlossaryTermPopup:function(a,b){var c="../ResearchCentre/GlossaryTermDescription.aspx?GlossaryId="+encodeURIComponent(a)+"&GlossaryAlternateSource="+encodeURIComponent(b);$popUp(c,"",{scrollbars:true,status:false,width:850})}};
Catalog.Tabs={currentTab:"",ActivateById:function(a){url=location.href;url=Catalog.Utils.ReplaceQueryString(url,"ActiveTab",a);$redirect(url)},OnMouseOver:function(a){$get(a.id).className+=" pdptab-hover"},OnMouseOut:function(a){$get(a.id).className=$get(a.id).className.replace("pdptab-hover","")},Initialize:function(){currentTab="";var a=Catalog.Tabs.Initialize.arguments;for(i=1;i<a.length;i++){$get(a[i]).onmouseover=function(){Catalog.Tabs.OnMouseOver(this);return false};$get(a[i]).onmouseout=function(){Catalog.Tabs.OnMouseOut(this);
return false};$get(a[0]).className="pdptab roll"}},GetContent:function(a){JsLib.UI.InjectHTML(a,"_ajax_tabs","_ajax_tabs")}};Catalog.BundleTabDetailsControl={SelectTabSpec:function(a,b,c){$get("BundleDetails").innerHTML=JsLib.HttpRequest.loadText(Catalog.Utils.FormatUrl("/Catalog/DetailsTabs.aspx?Sku="+encodeURIComponent(a)+"&ActiveTab="+encodeURIComponent(b)+"&SelectedProduct="+encodeURIComponent(c)))}};
Catalog.SearchResults={GetContent:function(a,b,c){Catalog.ProductCompare.InitializeFields();var d=$get(Catalog.ProductCompare.lblSelectedProductIds).value;a=Catalog.Utils.ReplaceQueryString(a,"SelectedProductIds",d);JsLib.UI.InjectHTML(a,b,c)},GetContentWithPageSize:function(a,b,c,d){d=$get(d);a=Catalog.Utils.ReplaceQueryString(a,"PageSize",d.options[d.selectedIndex].value);Catalog.SearchResults.GetContent(a,b,c)},UpdateBackToSearchResultsHref:function(a,b,c){b=document.getElementById(b);if(document.referrer.match(c)){b.href=
document.referrer;b.innerHTML=a;b.style.display="inline"}}};
Catalog.ProductCompareTab={SelectCompareBrand:function(a,b,c,d,e){url="/Catalog/ProductDetails.aspx?Sku="+encodeURIComponent(b)+"&ActiveTab="+encodeURIComponent(a)+"&CompareBrand="+encodeURIComponent(c)+"&CompareCategory="+encodeURIComponent(d)+"&category="+encodeURIComponent(d)+"&SortOption="+encodeURIComponent(Catalog.Utils.QueryString("SortOption"));e==""||e==null||(url+="&pcname="+encodeURIComponent(e));$redirect(url)},GetContent:function(a,b,c,d,e,f,g,k,j,h,m){Catalog.ProductCompare.InitializeFields();
var l=$get(b);b=15;if(l!=null)b=l.options[l.selectedIndex].value;if(m=="sortoption")e=$get(h).value;h=$get(Catalog.ProductCompare.lblSelectedProductIds).value;a="/Catalog/ProductTabCompareContent.aspx?Sku="+encodeURIComponent(a)+"&ItemsPerPage="+encodeURIComponent(b)+"&CurrentItemIndex="+encodeURIComponent(c)+"&CurrentPage="+encodeURIComponent(d)+"&Sort="+encodeURIComponent(e)+"&CurrentCategory="+encodeURIComponent(f)+"&IncludeParentProducts="+encodeURIComponent(g)+"&SelectedProductIds="+encodeURIComponent(h);
JsLib.UI.InjectHTML(a,k,j)}};
Catalog.QuickView={quickViewData:null,lastQuickViewSku:"",quickView:null,boundPage:null,quickViewContent:null,quickViewTitle:"Quick View",quickViewCloseBtnTitle:"Close Window",quickViewLoadingText:"Loading...",quickViewWindow:"#QuickView",quickViewYClick:null,quickViewXClick:null,loaded:false,Initialize:function(){if($("html").attr("lang")=="fr-CA"){this.quickViewTitle="Vue rapide";this.quickViewCloseBtnTitle="Fermer la fen&ecirc;tre";this.quickViewLoadingText="Chargement..."}this.loaded=true;this.quickViewData=
[];$("body").append('<div id="QuickView"><div class="quick-view"><div class="box"><div class="hdr"><div class="left"><h3 class="floatleft">'+this.quickViewTitle+'</h3></div><a id="ucQuickView_HypClosePopup" class="floatright close" href="javascript:Catalog.QuickView.Hide();">'+this.quickViewCloseBtnTitle+'</a><div class="clear"/></div></div><div id="quickViewContent"><div class="content">'+this.quickViewLoadingText+'</div></div><div class="clear"/></div></div>')},Show:function(a,b,c,d){this.loaded==
false&&this.Initialize();if(b==this.lastQuickViewSku)this.Hide();else{this.lastQuickViewSku=b;$(this.quickViewWindow).html('<div class="quick-view" style="height: 100px;"><div class="box"><div class="hdr"><div class="left"><h3 class="floatleft">'+this.quickViewTitle+'</h3></div><a id="ucQuickView_HypClosePopup" class="floatright close" href="javascript:Catalog.QuickView.Hide();">'+this.quickViewCloseBtnTitle+'</a><div class="clear"/></div><div id="quickViewContent"><div class="content"><div style="margin-left: 120px;"><img src="/images/common/icons/anim_loading.gif" width="50" height="50" /></div></div></div><div class="clear"/></div></div>');
this.quickViewYClick=d.clientY;this.quickViewXClick=d.clientX;$(this.quickViewWindow).show();this.loadQuickViewResizeWindow(c);this.quickView=true;this.loadQuickViewData(a,b,c)}},loadQuickViewData:function(a,b,c){if(this.quickViewData[a]){$(this.quickViewWindow).html(this.quickViewData[a]);this.loadQuickViewResizeWindow(c)}else $.get(a,this.loadQuickViewDataWrap(a,b,c))},loadQuickViewDataWrap:function(a,b,c){return function(d,e){e=="success"?Catalog.QuickView.loadQuickViewDataParseResults(d,a,b,c):
$(Catalog.QuickView.quickViewWindow).html('<div class="quick-view" style="height: 100px;"><div class="box"><div class="hdr"><div class="left"><h3 class="floatleft">'+this.quickViewTitle+'</h3></div><a id="ucQuickView_HypClosePopup" class="floatright close" href="javascript:Catalog.QuickView.Hide();">'+this.quickViewCloseBtnTitle+'</a><div class="clear"/></div><div id="quickViewContent"><div class="content"><div style="margin-left: 120px;">Error loading content.</div></div></div><div class="clear"/></div></div>')}},
loadQuickViewDataParseResults:function(a,b,c,d){var e=document.createElement("div");e.innerHTML=a;this.quickViewData[b]=JsLib.UI.GetNestedElem(e,"div","quickviewmaindiv").innerHTML;if(c==this.lastQuickViewSku){$(this.quickViewWindow).html(this.quickViewData[b]);this.loadQuickViewResizeWindow(d)}},loadQuickViewResizeWindow:function(a){a=$(a).attr("id");document.getElementById(a);document.getElementById(a);var b=$(".quick-view").height(),c=$(".quick-view").width(),d=$(window).height(),e=$(window).width();
a=0;var f=this.quickViewXClick,g=this.quickViewYClick;a=g-b/2;windowAdjustX=f-c/2;if(a<0)a=0;if(g+b/2>=d)a=d-b-10;if(g-b/2<=0)a=10;if(f+c/2>=e)windowAdjustX=e-c-10;if(f-c/2<=0)windowAdjustX=10;b=typeof window.pageYOffset=="number"?window.pageYOffset:document.documentElement.scrollTop;$(this.quickViewWindow).css({left:windowAdjustX,top:b+a})},Hide:function(){if(this.quickView==true){this.lastQuickViewSku="";$(this.quickViewWindow).hide();this.quickView=false;ShowDropDownOnQuickViewClose()}}};
function HideDropDownOnQuickView(a){a=document.getElementById(a);var b=document.all.tags("SELECT");if(b!=null)for(i=0;i<b.length;i++)if(OBJIsUnderDiv(b[i],a))b[i].style.visibility="hidden"}function OBJIsUnderDiv(a,b){var c=findPosX(a),d=c+a.offsetWidth,e=findPosY(a),f=e+a.offsetHeight,g=findPosX(b),k=g+b.offsetWidth,j=findPosY(b),h=j+b.offsetHeight;if(c>=g&&c<=k&&e>=j&&e<=h)return true;if(d>=g&&d<=k&&f>=j&&f<=h)return true;return false}
function findPosX(a){var b=0;if(a.offsetParent)for(;a.offsetParent;){b+=a.offsetLeft;a=a.offsetParent}else if(a.x)b+=a.x;return b}function findPosY(a){var b=0;if(a.offsetParent)for(;a.offsetParent;){b+=a.offsetTop;a=a.offsetParent}else if(a.y)b+=a.y;return b}function ShowDropDownOnQuickViewClose(){var a=document.all.tags("SELECT");if(a!=null)for(i=0;i<a.length;i++)a[i].style.visibility="inherit"}$addHandler(document.body,"click",Catalog.QuickView.Hide);
Catalog.ProductImages={ImageUrlIndex:0,RotateImage:function(a,b,c,d){a=a.split(",");var e=a.length,f="";if(Catalog.ProductImages.ImageUrlIndex<0||Catalog.ProductImages.ImageUrlIndex>=e)Catalog.ProductImages.ImageUrlIndex=0;if(b.match("right"))if(Catalog.ProductImages.ImageUrlIndex<e-1){++Catalog.ProductImages.ImageUrlIndex;f=a[Catalog.ProductImages.ImageUrlIndex].toString();$get(c).src=f;$("#"+d).text("Image "+(Catalog.ProductImages.ImageUrlIndex+1)+" of "+e)}if(b.match("left"))if(this.ImageUrlIndex>
0){--this.ImageUrlIndex;f=a[this.ImageUrlIndex].toString();$get(c).src=f;$("#"+d).text("Image "+(this.ImageUrlIndex+1)+" of "+e)}}};
Catalog.MiniQuickView={ShowMiniQuickView:function(a,b){var c=$get(a);if(c){if(c.innerHTML==""){var d=JsLib.HttpRequest.loadText(b);d=d.substring(d.indexOf("<script"));c.innerHTML=d}d=Sys.UI.DomElement.getBounds(c);var e=Sys.UI.DomElement.getBounds($get("aspnetForm"));d.x+d.width>e.width&&Sys.UI.DomElement.setLocation(c,d.x-(d.x+d.width-e.width),d.y);document.getElementById("pagecontentmain2").style.zIndex=0;c.style.zIndex=1;c.style.display="block"}},HideMiniQuickView:function(a){$get(a).style.display=
"none"}};
Catalog.ProductCompare={lblSelectedProductIds:"",lblSelectedProductCount:"",hidNotEnoughProductsErrorMessage:"",hidTooManyProducts:"",hidMaxProductsToCompare:"",hidMinProductsToCompare:"",boolInitialized:false,InitializeFields:function(){if(!Catalog.ProductCompare.boolInitialized){Catalog.ProductCompare.lblSelectedProductIds=$get("hidSelectedProductIds_ID").value.replace("$","_");Catalog.ProductCompare.lblSelectedProductCount=$get("hidSelectedProductCount_ID").value.replace("$","_");Catalog.ProductCompare.hidNotEnoughProductsErrorMessage=$get("hidNotEnoughProductsMessage_ID").value.replace("$",
"_");Catalog.ProductCompare.hidTooManyProducts=$get("hidTooManyProductsMessage_ID").value.replace("$","_");Catalog.ProductCompare.hidMaxProductsToCompare=$get("hidMaxComparableProducts_ID").value.replace("$","_");Catalog.ProductCompare.hidMinProductsToCompare=$get("hidMinComparableProducts_ID").value.replace("$","_");Catalog.ProductCompare.boolInitialized=true}},doCompare:function(a){Catalog.ProductCompare.InitializeFields();var b="http://"+window.location.host,c=$get(Catalog.ProductCompare.lblSelectedProductIds).value,
d=parseFloat($get(Catalog.ProductCompare.lblSelectedProductCount).value),e=parseFloat($get(Catalog.ProductCompare.hidMaxProductsToCompare).value),f=parseFloat($get(Catalog.ProductCompare.hidMinProductsToCompare).value);if(d>e){f=$get(Catalog.ProductCompare.hidTooManyProducts).value;f=f.replace("{0}",e);alert(f)}else if(d<f){e=$get(Catalog.ProductCompare.hidNotEnoughProductsErrorMessage).value;e=e.replace("(2)",f);alert(e)}else{c=c.replace("#,","");e=b+"/catalog/compare-result.aspx?ProductIds="+encodeURIComponent(c)+
"&returnPath="+encodeURIComponent(""+a);$redirect(e)}},initHiddenFields:function(a,b,c){Catalog.ProductCompare.InitializeFields();$get(Catalog.ProductCompare.hidMaxProductsToCompare).value=a;$get(Catalog.ProductCompare.hidNotEnoughProductsErrorMessage).value=b;$get(Catalog.ProductCompare.hidTooManyProducts).value=c},initSelectedProductHiddenFields:function(a,b){Catalog.ProductCompare.InitializeFields();$get(Catalog.ProductCompare.lblSelectedProductIds.replace("$","_")).value=a;$get(Catalog.ProductCompare.lblSelectedProductCount).value=
b},checkBoxClicked:function(a,b){Catalog.ProductCompare.InitializeFields();var c=$get(Catalog.ProductCompare.lblSelectedProductIds).value,d=parseFloat($get(Catalog.ProductCompare.lblSelectedProductCount).value);if(a.checked){c=c+","+b;d+=1;var e=parseFloat($get(Catalog.ProductCompare.hidMaxProductsToCompare).value);if(d>e){e=parseFloat($get(Catalog.ProductCompare.hidMaxProductsToCompare).value);c=$get(Catalog.ProductCompare.hidTooManyProducts).value;c=c.replace("{0}",e);alert(c);a.checked=false}else{$get(Catalog.ProductCompare.lblSelectedProductIds).value=
c;$get(Catalog.ProductCompare.lblSelectedProductCount).value=d}}else{c=c.replace(","+b,"");c=c.replace(b+",","");c=c.replace(b,"");if(d>0)d-=1;$get(Catalog.ProductCompare.lblSelectedProductIds).value=c;$get(Catalog.ProductCompare.lblSelectedProductCount).value=d}},Initialize:function(a,b,c){Catalog.ProductCompare.InitializeFields();a=$get(a).value;b=parseFloat($get(b).value);if(c!=null&&b>0){b=a.split(",");for(a=0;a<c.length;a+=2)for(var d=0;d<b.length;d++)if(b[d]==c[a]){var e=$get(c[a+1]);if(e!=
null)e.checked=true}}}};function TermsPopup(a,b,c){a=document.getElementsByName(a);for(var d=0;d<a.length;d++)if(a[d].checked){var e=a[d].getAttribute("warrantyId");if(e!=null&&e!="0"){$popUp(b+"&WarrantyId="+encodeURIComponent(e)+"&Sku="+encodeURIComponent(c),"",{scrollbars:true,status:false});break}}}function WarrantyIsSelected(a){document.WarrantyChecked=a}function AcceptTermAndConditions(a){basket.set_PSPTermAccepted(a.checked)}
function PspConstituentSelected(a,b,c){acceptCheckbox=$get(b+"_ChkAcceptTerms");parentSpan=acceptCheckbox.parentNode;termsLink=$get(b+"_HypTerms");if(acceptCheckbox&&parentSpan&&termsLink){acceptCheckbox.parentNode.disabled=false;acceptCheckbox.disabled=false;parentSpan.style.visibility="visible";termsLink.style.visibility="visible";a=a.getAttribute("warrantyId");basket.addAtBundlePSP(c,a)}}
function EnableTermAcceptStartupScript(a,b,c){acceptCheckbox=$get(b+"_ChkAcceptTerms");parentSpan=acceptCheckbox.parentNode;termsLink=$get(b+"_HypTerms");additional=$get("warrantyterms");if(acceptCheckbox&&parentSpan&&termsLink){acceptCheckbox.parentNode.disabled=false;acceptCheckbox.disabled=false;parentSpan.style.visibility="visible";termsLink.style.visibility="visible";additional.style.visibility="visible";basket.set_PSP(c)}}
function EnableTermAccept(a,b){acceptCheckbox=$get(b+"_ChkAcceptTerms");parentSpan=acceptCheckbox.parentNode;termsLink=$get(b+"_HypTerms");additional=$get("warrantyterms");if(acceptCheckbox&&parentSpan&&termsLink){acceptCheckbox.parentNode.disabled=false;acceptCheckbox.disabled=false;parentSpan.style.visibility="visible";termsLink.style.visibility="visible";additional.style.visibility="visible";var c=a.getAttribute("warrantyId");basket.set_PSP(c)}}
function DisableTermAccept(a,b){acceptCheckbox=$get(b+"_ChkAcceptTerms");parentSpan=acceptCheckbox.parentNode;termsLink=$get(b+"_HypTerms");additional=$get("warrantyterms");if(acceptCheckbox&&parentSpan&&termsLink){acceptCheckbox.checked=false;parentSpan.style.visibility="hidden";termsLink.style.visibility="hidden";additional.style.visibility="hidden";basket.set_PSP("0");basket.set_PSPTermAccepted(false)}}function PrePopulateBundlePSPs(a){basket.BundlePSP=Array(a)}
function DisplayTermsNotAcceptedMessage(a){alert(a);return true}function WarrantyIsSelected(a){document.WarrantyChecked=a}function GotoTop(){document.location.hash="Top"}
function SetUniqueRadioButton(a,b){re=RegExp(a);var c;for(i=0;i<document.forms[0].elements.length;i++){elm=document.forms[0].elements[i];if(elm.type=="radio"){if(re.test(elm.name))elm.checked=false;if(elm.name==b.name)c=b.parentNode.getAttribute("ProductID")}if(elm.type=="hidden")if(elm.name.indexOf("HdfSelectedProduct")>0)elm.value=c}b.checked=true}function SetSelectedProductSku(a,b){a.value=b}
function PopupGlossary(a){window.open(a,"glossary","location=0,menubar=0,scrollbars=1,status=0,toolbar=0,width=585,height=480")};
