Type.registerNamespace("Mccp.Basket");Mccp.Basket.AddProduct=function(){Mccp.Basket.AddProduct.initializeBase(this);this.PSP="";this.PSPTermAccepted=false;this.Accessories=[];this.DetourToWarranty=false;this.BundlePSP=[]};
Mccp.Basket.AddProduct.prototype={initialize:function(){Mccp.Basket.AddProduct.callBaseMethod(this,"initialize")},get_ParentProductId:function(){return this.ParentProductId},set_ParentProductId:function(a){this.ParentProductId=a},get_PSP:function(){return this.PSP},set_PSP:function(a){this.PSP=a},get_PSPTermAccepted:function(){return this.PSPTermAccepted},set_PSPTermAccepted:function(a){this.PSPTermAccepted=a},GenericUpdateAccessories:function(a,b){b==true?this.addAccessories(a):this.removeAccessories(a)},
UpdateWarrantyDetour:function(a){this.DetourToWarranty=a.checked},UpdateAccessories:function(a){this.GenericUpdateAccessories(a.getAttribute("ProductID"),a.checked)},addAccessories:function(a){Array.add(this.Accessories,a)},removeAccessories:function(a){Array.remove(this.Accessories,a)},get_Accessories:function(){return this.Accessories},get_BundlePSP:function(){return this.BundlePSP},addAtBundlePSP:function(a,b){this.BundlePSP[a]=b;if(this.BundlePSP.length>0){this.PSP="";for(var c=0;c<this.BundlePSP.length;c++){bPSP=
this.BundlePSP[c];this.PSP=bPSP==""||bPSP==null?this.PSP.concat(","):this.PSP.concat(bPSP+",")}if(this.PSP.charAt(this.PSP.length-1)==",")this.PSP=this.PSP.substr(0,this.PSP.length-1)}},AddProductWithoutWarranty:function(a,b){var c=new Date;c.setDate(c.getDate()+1);document.cookie="AddToCartSet=true;expires="+c.toGMTString()+";path=/;";history.go(-1);b!=""&&encodeURIComponent(b);return false},AddSelectedAccessoriesAndWarranty:function(a,b,c,d){if(a){if((this.Accessories==null||this.Accessories=="")&&
(this.PSP==null||this.PSP=="")){alert(b);return false}if(this.PSP!=null&&this.PSP!="")if(this.PSP=="0")this.redirectToBasket(this.ParentProductId,this.Accessories,a,d);else if(this.PSPTermAccepted)this.redirectToBasket(this.ParentProductId,this.Accessories,a,d);else{typeof DisplayTermsNotAcceptedMessage!="function"?alert(c):DisplayTermsNotAcceptedMessage(c);return false}else this.Accessories!=null&&this.Accessories!=""&&this.redirectToBasket(this.ParentProductId,this.Accessories,a,d)}else{if((this.Accessories==
null||this.Accessories=="")&&(this.PSP==null||this.PSP=="")){alert(b);return false}if(this.PSP!=null&&this.PSP=="0")this.redirectToBasket(this.ParentProductId,this.Accessories,a,d);else if(this.PSP!=null&&this.PSP!=""&&!this.PSPTermAccepted){alert(c);return false}this.PSP!=null&&this.PSP!=""&&this.PSPTermAccepted&&this.redirectToBasket(this.ParentProductId,this.Accessories,a,d)}},ValidateAccessoriesAndWarranty:function(a,b){if((this.Accessories==null||this.Accessories==""||this.Accessories=="0")&&
(this.PSP==null||this.PSP==""||this.PSP=="0"))b.IsValid=false},ValidateWarranty:function(a,b){if(this.PSP!=null&&this.PSP!=""&&this.PSP!="0"&&!this.PSPTermAccepted)b.IsValid=false},redirectToBasketWithDefault:function(a,b){this.redirectToBasket(this.ParentProductId,this.Accessories,a,b)},redirectToBasket:function(a,b,c,d){var e=new Date;e.setDate(e.getDate()+1);document.cookie="AddToCartSet=true;expires="+e.toGMTString()+";path=/";document.cookie="PreviousShoppingUrl="+document.URL+";expires="+e.toGMTString()+
";path=/;";e="";if(b!="")e+="&Accessories="+encodeURIComponent(b);if(this.PSP!=""&&this.PSP!="0")e+="&PSP="+encodeURIComponent(this.PSP);if(d!=null&&d!="")e+="&pcname="+encodeURIComponent(d);this.DetourToWarranty&&(this.PSP=="0"||this.PSP=="")?$redirect("/Catalog/Warranty.aspx?SKU="+encodeURIComponent(a)+"&WarrantyMode=false"+e):$redirect("/Order/AddToCart.ashx?SKU="+encodeURIComponent(a)+"&AddParentSku="+encodeURIComponent(c)+e);return false},redirectToWishList:function(a,b){var c="";if(b!=null&&
b!="")c+="&pcname="+encodeURIComponent(b);if(window.location.search.indexOf("WLParentURL")<0){c+="&WLParentURL=";c+=encodeURIComponent(window.location.pathname+window.location.search)}var d="";d="/Order/OrderWishList.aspx?SKU="+encodeURIComponent(a)+c;$redirect(d);return false},redirectToPriceWatchList:function(a,b){var c="";if(b!=null&&b!="")c+="&pcname="+encodeURIComponent(b);if(window.location.search.indexOf("PWParentURL")<0){c+="&PWParentURL=";c+=encodeURIComponent(window.location.pathname+window.location.search)}var d=
"";d="/Marketing/PriceWatcher.aspx?SKU="+encodeURIComponent(a)+c;$redirect(d);return false},dispose:function(){this.DefaultToWarranty=this.Accessories=this.PSPTermAccepted=this.PSP=this.ParentProductId=null;Mccp.Basket.AddProduct.callBaseMethod(this,"dispose")}};Mccp.Basket.AddProduct.registerClass("Mccp.Basket.AddProduct",Sys.Component,Sys.IDisposable);typeof Sys!=="undefined"&&Sys.Application.notifyScriptLoaded();
function AddToCartButton(a){var b=a.getAttribute("ProductID"),c=a.getAttribute("InAccessoriesMode");a=a.getAttribute("PCName");if(b!="")if(c=="True"){basket.addAccessories(b);basket.redirectToBasket(basket.get_ParentProductId(),b,true,a)}else basket.redirectToBasket(b,basket.get_Accessories(),true,a)}function AddToWishListButton(a){return AddToWishListButton(a,"False")}
function AddToWishListButton(a,b){var c=a.getAttribute("ProductID"),d=a.getAttribute("PCName");c!=""&&basket.redirectToWishList(c,d,b);return false}function AddToPriceWatchListButton(a){return AddToPriceWatchListButton(a,"False")}function AddToPriceWatchListButton(a,b){var c=a.getAttribute("ProductID"),d=a.getAttribute("PCName");c!=""&&basket.redirectToPriceWatchList(c,d,b);return false}function AddPSPToCart(a){a=a.getAttribute("warrantyId");a!=""&&basket.set_PSP(a)}
function showMoreCards(a,b){$get(b).style.display="block";a.onclick=function(){return false};a.style.cursor="default";a.style.color="#CCC"}function ShowProcessingPageAfterValidate(a,b,c){if(window.postBackSource==null&&c!=null)window.postBackSource=c;ValidtionReset();if(Page_ClientValidate("")&&Page_ClientValidate("GiftCard")){ShowProcessingPage(a,b);return true}else{window.postBackSource=null;return false}}
function ShowProcessingPage(a,b){obj=$get(a);if(obj!=null)obj.style.display="none";obj=$get(b);if(obj!=null){var c=$getElementsByClassName("processing-image","img",$get(b))[0];obj.style.display="block";c.style.display="inline"}}function CountLeft(a,b,c){if(a.value.length>c)a.value=a.value.substring(0,c);else b.value=a.value.length}
function ToggleExpandOrCollapse(a,b,c,d){tabObj=$get(a);if(tabObj!=null){tabObj.style.fontWeight=d?"bold":"normal";imgObjs=tabObj.getElementsByTagName("img");if(d){if(c)imgObjs[0].src="../images/common/buttons/minus.gif"}else imgObjs[0].src="../images/common/buttons/plus.gif"}areaObj=$get(b);if(areaObj!=null)if(d){if(c)areaObj.style.display="block"}else areaObj.style.display="none"}
function TabSelected(a,b,c,d,e,f,g){ToggleExpandOrCollapse(b,e,false,false);ToggleExpandOrCollapse(c,f,false,false);ToggleExpandOrCollapse(a,d,g,true)}
function TogglePromotionsOnOff(a,b,c,d,e){targetControl=$get(c);if(targetControl!=null&&b!=null&&a!=null)if(targetControl.style.display=="none"){a.className="standardblock";b.src="/images/common/buttons/minus.gif";targetControl.style.display="block";b.parentNode.className=d;targetControl.Visible="false"}else{a.className="standardblockcollapse";b.src="/images/common/buttons/plus.gif";targetControl.style.display="none";b.parentNode.className=e;targetControl.Visible="true"}}
function ToggleOnOff(a,b){targetControl=$get(b);if(targetControl!=null&&a!=null)if(targetControl.style.display=="none"){a.src="/images/common/buttons/minus.gif";targetControl.style.display="block";a.parentNode.className="standardblock";targetControl.Visible="false"}else{a.src="/images/common/buttons/plus.gif";targetControl.style.display="none";a.parentNode.className="standardblockcollapse";targetControl.Visible="true"}}
function ToggleExpandOn(a,b){if($get("loadCount").value==0){targetControl=$get(b);if(targetControl!=null&&a!=null){targetControl.style.display="block";targetControl.Visible="false"}}$get("loadCount").value++}
function KioskPrint(a,b){if(b=="True")$get("Duplicate").style.display="block";if(a=="True")window.external.print();else{document.body.insertAdjacentHTML("beforeEnd",'<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>');if(WebBrowser1!=null){WebBrowser1.ExecWB(6,2,3);WebBrowser1.outerHTML=""}}if(b=="True")$get("Duplicate").style.display="none"}
function KioskAutoPrint(a,b){a=="False"&&document.body.insertAdjacentHTML("beforeEnd",'<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>');for(i=0;i<b;i++)if(a=="True")window.external.print();else WebBrowser1!=null&&WebBrowser1.ExecWB(6,2,3);WebBrowser1.outerHTML=""}function closepopup(){this.close()}function OnProcessing(){ShowProcessingPage("DivVbvContent","DivProcessing");document.aspnetForm.submit()}
function UpdateQuickCart(a,b,c){a=$get(a);if(userInformation.CartItems>0){if(a!=null){a.innerHTML=userInformation.CartItems+" "+(userInformation.CartItems>1?c:b);a.style.display="block"}}else if(a!=null){a.innerHTML="";a.style.display="none"}}
function UpdateQuickCartFromCookie(a,b,c){a=$get(a);if(readCookieName("CartItems")>0){if(a!=null){a.innerHTML=escape(readCookieName("CartItems"))+" "+(readCookieName("CartItems")>1?c:b);a.style.display="block"}}else if(a!=null){a.innerHTML="";a.style.display="none"}a.innerHTML=escape(readCookieName("CartItems"))+" "+(readCookieName("CartItems")>1?c:b)}
function CallupBankUrl(a,b,c,d){document.BankRequestForm.PaReq.value=c;document.BankRequestForm.MD.value=d;document.BankRequestForm.TermUrl.value=b;document.BankRequestForm.action=a;document.BankRequestForm.submit();window.focus()}function ValidateBankResponse(){parent.OnProcessing()}function PopupPrintBasket(){winStats="width=672,height=700,location=0,menubar=0,scrollbars=yes,status=0,toolbar=1";popUp("PrintableCart.aspx","_new",winStats);return false};
