function GetEnterKey(controlID){var e=document.getElementById(controlID);if(e&&typeof(e.click)=="undefined"){e.click=function(){var result=true;if(e.onclick){result=e.onclick()}if(typeof(result)=="undefined"||result){eval(e.href)}}}}function RemoveDefaultValue(B,A){if(B!=null){if(B.value==A){B.value=""}}}function SetDefaultValue(B,A){if(B!=null){if(Trim(B.value)==""){B.value=A}}}function Trim(A){if(A!=""){while(A.substring(0,1)==" "){A=A.substring(1,A.length)}while(A.substring(A.length-1,A.length)==" "){A=A.substring(0,A.length-1)}return A}else{return A}}function SetQtyHiddenValue(B,C){alert(B+"#"+C);if(document.getElementById(C).value!=""){B=B+"_"+document.getElementById(C).value;var A=new Array();A=B.split("~");B=getDomainName()+A[1]}else{var A=new Array();A=B.split("~");B=getDomainName()+A[1]}document.location.href=B}function SetQtyHiddenValueMyWishList(C,D,A){alert(C+"#"+D);if(document.getElementById(D).value!=""){C=C+"_"+document.getElementById(D).value;var B=new Array();B=C.split("~");C=getDomainName()+B[1]}else{var B=new Array();B=C.split("~");C=getDomainName()+B[1]}removecartitem(A);document.location.href=C}function getDomainName(){var A;A=window.location.href;if(A.indexOf("PublicStore")>=0){if(A.indexOf("https")>=0){A="https://"+document.domain+"/publicstore"}else{A="http://"+document.domain+"/publicstore"}}else{if(A.indexOf("https")>=0){A="https://"+document.domain}else{A="http://"+document.domain}}return A}function checkdate(D){var F=/^\d{2}\/\d{2}\/\d{4}$/;var E=false;if(!F.test(D.value)){alert("Invalid Date Format. Please correct and submit again.")}else{var G=D.value.split("/")[0];var C=D.value.split("/")[1];var B=D.value.split("/")[2];var A=new Date(B,G-1,C);if((A.getMonth()+1!=G)||(A.getDate()!=C)||(A.getFullYear()!=B)){alert("Invalid Day, Month, or Year range detected. Please correct and submit again.")}else{E=true}}if(E==false){D.select()}return E}function Print(){alert("Operation Completed")}function Check(){for(var A=0;A<document.forms[0].elements.length;A++){strElement=document.forms[0].elements[A].id;if(strElement.substring(strElement.length-12,strElement.length)=="chkSelectAll"){CheckAll(document.forms[0].elements[A],"chkItemId")}}}function ChkItemSelected(){var A=false;for(var B=0;B<document.forms[0].elements.length;B++){strElement=document.forms[0].elements[B].id;if(strElement.substring(strElement.length-9,strElement.length)=="chkItemId"){if(document.forms[0].elements[B].checked){A=true}}}if(A==false){alert("Please select any item to clear.");return false}return true}var dw_event={add:function(D,C,B,A){A=A||false;if(D.addEventListener){D.addEventListener(C,B,A)}else{if(D.attachEvent){D.attachEvent("on"+C,B)}}},remove:function(D,C,B,A){A=A||false;if(D.removeEventListener){D.removeEventListener(C,B,A)}else{if(D.detachEvent){D.detachEvent("on"+C,B)}}},DOMit:function(A){A=A?A:window.event;A.tgt=A.srcElement?A.srcElement:A.target;if(!A.preventDefault){A.preventDefault=function(){return false}}if(!A.stopPropagation){A.stopPropagation=function(){if(window.event){window.event.cancelBubble=true}}}return A}};var viewport={getWinWidth:function(){this.width=0;if(window.innerWidth){this.width=window.innerWidth-18}else{if(document.documentElement&&document.documentElement.clientWidth){this.width=document.documentElement.clientWidth}else{if(document.body&&document.body.clientWidth){this.width=document.body.clientWidth}}}},getWinHeight:function(){this.height=0;if(window.innerHeight){this.height=window.innerHeight-18}else{if(document.documentElement&&document.documentElement.clientHeight){this.height=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){this.height=document.body.clientHeight}}}},getScrollX:function(){this.scrollX=0;if(typeof window.pageXOffset=="number"){this.scrollX=window.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollLeft){this.scrollX=document.documentElement.scrollLeft}else{if(document.body&&document.body.scrollLeft){this.scrollX=document.body.scrollLeft}else{if(window.scrollX){this.scrollX=window.scrollX}}}}},getScrollY:function(){this.scrollY=0;if(typeof window.pageYOffset=="number"){this.scrollY=window.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){this.scrollY=document.documentElement.scrollTop}else{if(document.body&&document.body.scrollTop){this.scrollY=document.body.scrollTop}else{if(window.scrollY){this.scrollY=window.scrollY}}}}},getAll:function(){this.getWinWidth();this.getWinHeight();this.getScrollX();this.getScrollY()}};var Tooltip={followMouse:true,offX:8,offY:12,tipID:"tipDiv",showDelay:100,hideDelay:200,ready:false,timer:null,tip:null,init:function(){if(document.createElement&&document.body&&typeof document.body.appendChild!="undefined"){if(!document.getElementById(this.tipID)){var A=document.createElement("DIV");A.id=this.tipID;document.body.appendChild(A)}this.ready=true}},show:function(B,A){if(this.timer){clearTimeout(this.timer);this.timer=0}this.tip=document.getElementById(this.tipID);if(this.followMouse){dw_event.add(document,"mousemove",this.trackMouse,true)}this.writeTip("");this.writeTip(A);viewport.getAll();this.positionTip(B);this.timer=setTimeout("Tooltip.toggleVis('"+this.tipID+"', 'visible')",this.showDelay)},writeTip:function(A){if(this.tip&&typeof this.tip.innerHTML!="undefined"){this.tip.innerHTML=A}},positionTip:function(C){if(this.tip&&this.tip.style){var A=C.pageX?C.pageX:C.clientX+viewport.scrollX;var B=C.pageY?C.pageY:C.clientY+viewport.scrollY;if(A+this.tip.offsetWidth+this.offX>viewport.width+viewport.scrollX){A=A-this.tip.offsetWidth-this.offX;if(A<0){A=0}}else{A=A+this.offX}if(B+this.tip.offsetHeight+this.offY>viewport.height+viewport.scrollY){B=B-this.tip.offsetHeight-this.offY;if(B<viewport.scrollY){B=viewport.height+viewport.scrollY-this.tip.offsetHeight}}else{B=B+this.offY}this.tip.style.left=A+"px";this.tip.style.top=B+"px"}},hide:function(){if(this.timer){clearTimeout(this.timer);this.timer=0}this.timer=setTimeout("Tooltip.toggleVis('"+this.tipID+"', 'hidden')",this.hideDelay);if(this.followMouse){dw_event.remove(document,"mousemove",this.trackMouse,true)}this.tip=null},toggleVis:function(C,A){var B=document.getElementById(C);if(B){B.style.visibility=A}},trackMouse:function(A){A=dw_event.DOMit(A);Tooltip.positionTip(A)}};Tooltip.offX=4;Tooltip.offY=4;Tooltip.followMouse=false;Tooltip.timerId=0;function doTooltip(C,B){if(typeof Tooltip=="undefined"||!Tooltip.ready){return}Tooltip.clearTimer();var A=document.getElementById?document.getElementById(Tooltip.tipID):null;if(A&&A.onmouseout==null){A.onmouseout=Tooltip.tipOutCheck;A.onmouseover=Tooltip.clearTimer}Tooltip.show(C,B)}function hideTip(){if(typeof Tooltip=="undefined"||!Tooltip.ready){return}Tooltip.timerId=setTimeout("Tooltip.hide()",300)}Tooltip.tipOutCheck=function(B){B=dw_event.DOMit(B);var A=B.relatedTarget?B.relatedTarget:B.toElement;if(this!=A&&!contained(A,this)){Tooltip.hide()}};function hideTipImmediate(){if(typeof Tooltip=="undefined"||!Tooltip.ready){return}Tooltip.timerId=setTimeout("Tooltip.hide()",0)}function contained(B,A){if(!B){return}while(B=B.parentNode){if(B==A){return true}}return false}Tooltip.clearTimer=function(){if(Tooltip.timerId){clearTimeout(Tooltip.timerId);Tooltip.timerId=0}};Tooltip.unHookHover=function(){var A=document.getElementById?document.getElementById(Tooltip.tipID):null;if(A){A.onmouseover=null;A.onmouseout=null;A=null}};dw_event.add(window,"unload",Tooltip.unHookHover,true);function setFocusOnFirstElement(){var A,B;if(document.forms[0].elements.length!=null){for(A=0;A<document.forms[0].elements.length;A++){if(document.forms[0].elements[A].id=="HiddenForSetFocus"||B==A){if(document.forms[0].elements[A+1]!=null&&document.forms[0].elements[A+1]!="undefined"){if(document.forms[0].elements[A+1].disabled||document.forms[0].elements[A+1].type=="hidden"){B=A+1}else{if(((document.forms[0].elements[A+1].type=="text")||(document.forms[0].elements[A+1].type=="checkbox")||(document.forms[0].elements[A+1].type=="radio")||(document.forms[0].elements[A+1].type=="textarea")||(document.forms[0].elements[A+1].type.substring(0,6)=="select"))&&(!document.forms[0].elements[A+1].disabled)){document.forms[0].elements[A+1].focus();break}else{}}}}}}}function CheckAll(C,D){var A=document.aspnetForm;var B=C.checked;for(i=0;i<A.length;i++){e=A.elements[i];if(e.type=="checkbox"&&e.name.indexOf(D)!=-1){e.checked=B}}}var arrcounter=0;var PopupCont=0;var arrCodeQty=new Array(50);var strAddToCartQuery="";var IsBackOrderEnabled;var isStockWatchListEnabled;var IsOutofStockchkEnabled;var BaseURL;var RedirecttoShopCart;var DisplayInventory;var UserSessionValue;function SetConfigValues(D,C,B,A,E){IsBackOrderEnabled=D;isStockWatchListEnabled=C;IsOutofStockchkEnabled=B;BaseURL=A;RedirecttoShopcart=E}function SetConfigurationValues(E,D,B,A,F,C){IsBackOrderEnabled=E;isStockWatchListEnabled=D;IsOutofStockchkEnabled=B;BaseURL=A;RedirecttoShopcart=F;DisplayInventory=C}function SetUserSession(A){UserSessionValue=A}function Additem(){if(PopupCont<arrcounter){var A=arrCodeQty[PopupCont].split("`");if(DisplayInventory=="True"){if(IsBackOrderEnabled=="0"){if(parseInt(A[1])<parseInt(A[2])){straddtocart=A[0]+"_"+A[1];AddItemToCart(straddtocart)}else{straddtocart=A[0]+"_"+A[2];AddItemToCart(straddtocart)}}else{straddtocart=A[0]+"_"+A[2];AddItemToCart(straddtocart)}}else{straddtocart=A[0]+"_"+A[2];AddItemToCart(straddtocart)}}else{if(strAddToCartQuery!=""||strAddToCartQuery.length!=0){AddItemToCart("Redirect")}}}function ShowPopUp(H){var D='<div class="pop_sku_outer"> <div class="pop_sku_inner" id="PopupContentDiv">'+GetContenHTML(H)+"</div></div>";var C=document.getElementById("popupHead");if(!C){var F=document.documentElement.clientHeight;var A=document.documentElement.clientWidth;var E=parseInt((150)/2)+document.documentElement.scrollLeft;var G=parseInt((300)/2)+document.documentElement.scrollTop;var C=document.createElement("div");C.setAttribute("id","popupHead");C.className="popupdivContainer";var B=document.createElement("span");B.innerHTML=D;C.appendChild(B);C.style.top=G+"px";document.getElementsByTagName("body")[0].appendChild(C)}return false}function GetContenHTML(strvalue){var arrCartItem=strvalue.split("`");var Code=arrCartItem[0];var SKUCode=arrCartItem[1];var StockQty=arrCartItem[2];var Qty=arrCartItem[3];var cntHTML='<div><div class="popup_cancel" ><input id="btnCancel" class="float_right"  type="button" value="X"  onclick="javascript:closePopUp();"/></div><div class="pop_innertext">';if(eval(Qty)>eval(StockQty)){if(IsBackOrderEnabled=="1"){if(isStockWatchListEnabled=="1"&&IsOutofStockchkEnabled=="1"){if(eval(StockQty)<1){cntHTML=cntHTML+"<strong>Available quantity for the item "+SKUCode+" is '0'.</strong><br/><p><strong>You can either continue to add this item to your cart or <br/> you can track the item on your stock watch list and be notified when it is in stock. </strong></p><p><br/></p>";cntHTML=cntHTML+'<table cellpadding="2" cellspacing="2" align="center" ><tr><td><input id="btnAddtoCart" type="button" class="add2cart_m" onclick="javascript:AddItemToCart(\''+Code+"_"+Qty+"');\"/></td></tr><tr>";cntHTML=cntHTML+'<td><input id="btnAddtoSW" type="button"  class="add2stockwatchlist_intab" onclick="javascript:AddItemtoStockWatchList(\''+SKUCode+"','"+Qty+"');\"/></td></tr></table>"}else{if(parseInt(Qty)>parseInt(StockQty)){var RemainQty=parseInt(Qty)-parseInt(StockQty);cntHTML=cntHTML+"<p><strong>Available quantity for the item "+SKUCode+" is "+StockQty+", remaining quantity '"+RemainQty+"' will be added to your stock watch list.</br></strong></p><p><br/></p>";cntHTML=cntHTML+'<table cellpadding="2" cellspacing="2"  align="center"><tr><td><input id="btnAddtoCart" type="button" class="add2entireqtycart_intab"  onclick="javascript:AddItemToCart(\''+Code+"_"+Qty+"');\"/></td></tr><tr>";cntHTML=cntHTML+'<td><input id="btnAddtoSW" type="button" class="add2onlyavailableqtycart_intab"  onclick="javascript:AddToCartwithStockWatch(\''+Code+"','"+StockQty+"','"+RemainQty+"','"+SKUCode+"');\"/></td></tr></table>"}else{cntHTML=cntHTML+Code+"_"+Qty}}}else{cntHTML=cntHTML+Code+"_"+Qty}}else{if(IsBackOrderEnabled=="0"){if(isStockWatchListEnabled=="1"&&IsOutofStockchkEnabled=="1"){if(eval(StockQty)<1){cntHTML=cntHTML+"<p><strong>Item "+SKUCode+" added is currently not available, however you can track the item on your stock watch list and be notified when it is in stock. </br></strong></p>";cntHTML=cntHTML+'<table cellpadding="2" cellspacing="2"  align="center"><tr><td><input id="btnAddtoCart" type="button" class="cancel"   onclick="javascript:Cancel()"/></td></tr><tr>';cntHTML=cntHTML+'<td><input id="btnAddtoSW" type="button" class="add2stockwatchlist_intab"   onclick="javascript:AddItemtoStockWatchList(\''+SKUCode+"','"+Qty+"');\"/></td></tr></table>"}else{if(eval(Qty)>eval(StockQty)){var RemainQty=parseInt(Qty)-parseInt(StockQty);cntHTML=cntHTML+"<p><strong>Available quantity for the item "+SKUCode+" is '"+StockQty+"', remaining quantity '"+RemainQty+"' will be added to your stock watch list. </br></p>";cntHTML=cntHTML+'<table cellpadding="2" cellspacing="2"  align="center"><tr><td><input id="btnAddtoCart" class="cancel" type="button"  onclick="javascript:Cancel()" width="87" height="20"/></td></tr><tr>';cntHTML=cntHTML+'<td><input id="btnAddtoSW"  class="add2onlyavailableqtycart_intab" type="button"  onclick="javascript:AddToCartwithStockWatch(\''+Code+"','"+StockQty+"','"+RemainQty+"','"+SKUCode+"');\"/></td></tr></table>"}}}else{alert("Item Added is back ordered, Available quantity for item "+SKUCode+" is "+StockQty+"");return false}}}}else{cntHTML=cntHTML+Code+"_"+Qty}cntHTML=cntHTML+"</div></div>";return cntHTML}function AddItemToCart(D){if(D=="Redirect"){if(RedirecttoShopcart==0){setTimeout("ShowProcessing('Adding to your cart, please wait...')",1000);var C=BaseURL+"Basket/Purchase.aspx?skus="+strAddToCartQuery+"&closewin=0";postRequest(C);if(UserSessionValue=="True"){if(panel!=null){setTimeout("getCartItems()",1000);ClearAllMessages();if(document.getElementById("lblShowMessage")!=null){setTimeout("document.getElementById('lblShowMessage').innerHTML ='Item(s) added successfully.';",1000)}}setTimeout("StopProcessing()",1000)}else{var A=document.getElementById("hdnGetRedirectURL").value;A=A.replace("~","../");window.location.href=A}strAddToCartQuery=""}else{setTimeout("window.opener.ShowProcessing('Adding to your cart, please wait...')",1000);var C=BaseURL+"Basket/Purchase.aspx?skus="+strAddToCartQuery+"&closewin=0";window.opener.postRequest(C);if(UserSessionValue=="True"){if(window.opener.panel!=null){setTimeout("window.opener.getCartItems()",1000);if(document.getElementById("lblShowMessage")!=null){setTimeout("document.getElementById('lblShowMessage').innerHTML ='Item added successfully.';",1000)}}setTimeout("window.opener.StopProcessing()",1000)}else{var A=document.getElementById("hdnGetRedirectURL").value;A=A.replace("~","../");window.opener.location.href=A}strAddToCartQuery=""}return true}else{if(strAddToCartQuery==""){strAddToCartQuery=D}else{strAddToCartQuery=strAddToCartQuery+";"+D}PopupCont=PopupCont+1;closePopUp();var B=setTimeout("Additem()",300)}return false}function AddItemtoStockWatchList(A,B){returnVal=Ignify.eCommerce.Web.Store.MasterTemplates.Ignify.Modules.SharedModules.ProductSkusMultiModule.AddItemtoStockWatchList(A,B);PopupCont=PopupCont+1;closePopUp();var C=setTimeout("Additem()",300);return false}function AddToCartwithStockWatch(E,C,A,D){E=E+"_"+C;returnVal=Ignify.eCommerce.Web.Store.MasterTemplates.Ignify.Modules.SharedModules.ProductSkusMultiModule.AddItemtoStockWatchList(D,A);if(strAddToCartQuery==""){strAddToCartQuery=E}else{strAddToCartQuery=strAddToCartQuery+";"+E}PopupCont=PopupCont+1;closePopUp();var B=setTimeout("Additem()",300)}function closePopUp(){var A=document.getElementById("popupHead");if(!A){return}A.parentNode.removeChild(A)}function Cancel(){PopupCont=PopupCont+1;closePopUp();var A=setTimeout("Additem()",300)}function ValidateSKUforStockWatchlist(Code,Qty,StockQty,IsBackOrderEnabled,isStockWatchListEnabled,IsOutofStockchkEnabled,baseurl,SKUCode){if(eval(Qty)>eval(StockQty)){if(IsBackOrderEnabled=="1"){if(isStockWatchListEnabled=="1"&&IsOutofStockchkEnabled=="1"){if(eval(StockQty)<1){var win=window.open("../catalog/PopupMessage.aspx?Code= "+Code+"&Qty="+Qty+"&StockQty="+StockQty+"&SKUCode="+SKUCode+"&Backorder=FB&BO=True","StockWatch","height=250,width=800,scrollbars=no,screenX=250,screenY=250,left=250,top=250");win.focus()}else{if(eval(Qty)>eval(StockQty)){var win=window.open("../catalog/PopupMessage.aspx?Code= "+Code+"&Qty="+Qty+"&StockQty="+StockQty+"&SKUCode="+SKUCode+"&&Backorder=PB&BO=True","StockWatch","height=250,width=800,scrollbars=no,screenX=250,screenY=250,left=250,top=250");win.focus()}else{str=Code+"_"+Qty;setTimeout("ShowProcessing('Adding to your cart, please wait...')",1000);var url=baseurl+"Basket/Purchase.aspx?skus="+str;postRequest(url);if(panel!=null){setTimeout("getCartItems()",1000)}setTimeout("StopProcessing()",1000)}}}else{str=Code+"_"+Qty;setTimeout("ShowProcessing('Adding to your cart, please wait...')",1000);var url=baseurl+"Basket/Purchase.aspx?skus="+str;postRequest(url);if(panel!=null){setTimeout("getCartItems()",1000)}setTimeout("StopProcessing()",1000)}}else{if(IsBackOrderEnabled=="0"){if(isStockWatchListEnabled=="1"&&IsOutofStockchkEnabled=="1"){if(eval(StockQty)<1){var win=window.open("../catalog/PopupMessage.aspx?Code= "+Code+"&Qty="+Qty+"&StockQty="+StockQty+"&SKUCode="+SKUCode+"&&Backorder=FB&BO=False","StockWatch","height=250,width=800,scrollbars=no,screenX=250,screenY=250,left=250,top=10");win.focus()}else{if(eval(Qty)>eval(StockQty)){var win=window.open("../catalog/PopupMessage.aspx?Code= "+Code+"&Qty="+Qty+"&StockQty="+StockQty+"&SKUCode="+SKUCode+"&&Backorder=PB&BO=False","StockWatch","height=250,width=800,scrollbars=no,screenX=250,screenY=250,left=250,top=10");win.focus()}}}else{alert("Item Added is back ordered, Available quantity for item "+SKUCode+" is "+StockQty+"");return false}}}}else{str=Code+"_"+Qty;setTimeout("ShowProcessing('Adding to your cart, please wait...')",1000);var url=baseurl+"Basket/Purchase.aspx?skus="+str;postRequest(url);if(panel!=null){setTimeout("getCartItems()",1000)}setTimeout("StopProcessing()",1000)}return false};
