var SubTotal="0";var ToTalRowCount=0;var NoOfItems=null;var cartItemsAndSubTotal=null;var formatcurrency=null;var PHeight=null;var PWidth=null;function getCartItems(){try{serverRequest("getcartitems")}catch(B){var A=B.description}return false}function getCartItemsServer(cartItemsAndSubTotal1){try{var cartitems=null;var mycartarray=null;cartItemsAndSubTotal1=cartItemsAndSubTotal1.replace(/putq/g,'"');var splitRawData=cartItemsAndSubTotal1.split("~~SubTotal~~");if(splitRawData!=null&&splitRawData.length>0){cartitems=splitRawData[0];SubTotal=splitRawData[1];formatcurrency=splitRawData[2]}var rowArray=cartitems.split("~~Row~~");var objRowCount=eval(rowArray.length)-1;mycartarray=new Array(objRowCount);var objLblItemCount=document.getElementById("lblItemCount");if(objLblItemCount!=null){objLblItemCount.innerHTML=objRowCount+" Item(s)"}var tempRowCount=0;ToTalRowCount=0;for(tempRowCount=0;tempRowCount<objRowCount;tempRowCount++){mycartarray[tempRowCount]=new Array(3);var colArray=rowArray[tempRowCount].split("~~Coloumn~~");if(colArray!=null&&colArray.length>0){mycartarray[tempRowCount][0]=colArray[0];mycartarray[tempRowCount][1]=colArray[1];mycartarray[tempRowCount][2]=colArray[2];if(colArray[1].indexOf("Your cart is empty.")>0){ToTalRowCount=0;NoOfItems=null}else{ToTalRowCount++;NoOfItems=ToTalRowCount}}}if(IsFloatingCartEnabled=="1"){SetFCHeightAndWidth();BindDataSource(mycartarray)}GetSubTotal()}catch(ex){var exception=ex.description}return false}function BindDataSource(D){var G=null;var H=null;var I=[{key:"Image",width:50,resizeable:true,sortable:true,hidden:false},{key:"ItemDescritpion",width:150,resizeable:true,sortable:true,hidden:false},{key:"DeleteRow",width:20,resizeable:true,sortable:true,hidden:false}];H=new YAHOO.util.DataSource(D);H.responseType=YAHOO.util.DataSource.TYPE_JSARRAY;H.responseSchema={fields:["Image","ItemDescritpion","DeleteRow"]};var F={sortedBy:{key:"ItemDescritpion",dir:"asc"},draggableColumns:false};G=new YAHOO.widget.DataTable("complex",I,H,F);G.subscribe("rowClickEvent",G.onEventSelectRow);G.subscribe("cellDblclickEvent",G.onEventShowCellEditor);G.subscribe("editorBlurEvent",G.onEventSaveCellEditor);var C=function(J){var M=J.editor.getTdEl();var R=J.oldData;var Q=J.newData;var L=this.getTrEl(M);var K=YAHOO.util.Dom.getStyle(L.cells[0],"backgroundColor");var O="#ff0";var P=new YAHOO.util.ColorAnim(L.cells,{backgroundColor:{to:K,from:O},duration:2});var N=function(){P=null;YAHOO.util.Dom.setStyle(L.cells,"backgroundColor","")};P.onComplete.subscribe(N);P.animate()};G.subscribe("editorSaveEvent",C);var E=new TestObj("mytestobj1");var A=new ShowFloatingCart("mytestFC1",E);var B=new TestData("mydata1");E.event1.fire(B);return{oDS:H,oDT:G}}function DeleteCartItem(C){var A=Ignify.eCommerce.Web.Store.MasterTemplates.Ignify.Modules.SharedModules.FloatingCart.RemoveCartItem(C);if(A.value!=null&&A.value=="True"){try{getCartItems()}catch(D){var B=D.description}GetSubTotal()}}function GetSubTotal(){var E=document.getElementById("lblSubTotal");var D="";if(E!=null){if(SubTotal=="0"&&NoOfItems==null){var G=document.getElementById("lblItemCount");if(G!=null){G.innerHTML="0 Item(s)"}}else{if(SubTotal=="0"&&NoOfItems>0){var G=document.getElementById("lblItemCount");if(G!=null){G.innerHTML=NoOfItems+" Item(s)"}}}var C="0";try{if(parseFloat(SubTotal)<0){SubTotal="0"}if(formatcurrency!=null){C=formatcurrency}}catch(A){if(document.getElementById("hdnTempCurrencyCode")!=null){var B=document.getElementById("hdnTempCurrencyCode").value;if(B=="USD"&&SubTotal=="0"){C="$0.00"}}}E.innerHTML="<strong>Sub Total: "+C+"</strong>";var F=document.getElementById("lblItemSubTotal");if(F!=null){F.innerHTML=C}if(SubTotal=="0"&&NoOfItems==null){E.style.visibility="hidden";ControlVisibility(false)}else{E.style.visibility="";ControlVisibility(true)}}setTimeout("WipeMessage('lblShowProcess');",1)}function CheckoutWithPayPal(){var C=document.domain;var A=window.location.href;var B=Ignify.eCommerce.Web.Store.MasterTemplates.Ignify.Modules.SharedModules.FloatingCart.PayPalPreAuthorize(A,C);if(B.value!=null&&B.value.length>0){window.parent.location.href=B.value}return false}function RemoveAllCartItems(){var A=Ignify.eCommerce.Web.Store.MasterTemplates.Ignify.Modules.SharedModules.FloatingCart.RemoveAllCartItems();try{getCartItems()}catch(C){var B=C.description}GetSubTotal();return false}function callServer(A){setTimeout("SetMessage('Processing...','lblShowProcess');",1);setTimeout('serverRequest("'+A+'" ,"server context");',1)}function getResult(A,B){WipeMessage("lblMessage");getCartItemsServer(A)}function SetFCHeightAndWidth(){if(panel!=null){var ChkPHeight=CalcCheckoutPanelHeight();if(ToTalRowCount==0){PHeight="110";ChkPHeight=0;if(document.getElementById("InnerBody")!=null){document.getElementById("InnerBody").style.display="none"}}else{if(ToTalRowCount==1){PHeight="183";if(document.getElementById("InnerBody")!=null){document.getElementById("InnerBody").style.display="block"}}else{if(ToTalRowCount==2){PHeight="240";if(document.getElementById("InnerBody")!=null){document.getElementById("InnerBody").style.display="block"}}else{if(ToTalRowCount==3){PHeight="298";if(document.getElementById("InnerBody")!=null){document.getElementById("InnerBody").style.display="block"}}else{PHeight="353";if(document.getElementById("InnerBody")!=null){document.getElementById("InnerBody").style.display="block"}}}}}if(document.getElementById("hdnFCHeight")!=null){document.getElementById("hdnFCHeight").value=PHeight}panel.cfg.setProperty("Height",eval(PHeight-ChkPHeight)+"px")}}function CalcCheckoutPanelHeight(){var E=0;var C=GetControlVisibility(location.href);var D=C.split(";");if(D!=null&&D.length>0){var A=0;for(A=0;A<D.length;A++){var B=D[A].split(":");if(B!=null&&B.length>0){if(B[0]=="CheckoutButtons"){if(B[1]=="false"){E=43}else{E=0}}}}}return E}function TestObj(A){this.name=A;this.event1=new YAHOO.util.CustomEvent("event1",this)}function ShowFloatingCart(B,A){this.name=B;this.testObj=A;this.testObj.event1.subscribe(this.onEvent1,this)}ShowFloatingCart.prototype.onEvent1=function(B,A,C){if(IsFloatingCartEnabled!=null&&IsFloatingCartEnabled=="1"){if(panel!=null){panel.show();window.scrollTo(0,0);varFltCrtTimeOut=setTimeout("panel.hide();",3000)}}};function TestData(A){this.data=A};