usingNamespace("Biz.Shopping")["PageLoad"]={AsynCall:function(M,F){var B=$Url.BuildCurrentUrl("Ajax/Shopping/ShoppingPanel.aspx");var J="";var R;var O=$(M).attr("id");var L=$(M).attr("ref3");var H=$QueryString.Get("buytype");var K=H==""?"":"&buytype="+H;var C=H==""?"":"buytype="+H;if(O=="del1"){if(confirm($Resource.BuildContent("ShoppingCart_AsynCall_Del"))){J=$(M).attr("ref1");R="action=del&productno="+J+K}else{return}}else{if(L=="addNewItem"){J=$(M).attr("ref1");R="action=add&productno="+J+K}else{if(L=="updateItemQuantity"){J=$(M).attr("ref1");var P=$(M).attr("ref2");var A=$(M).val();if(P==A){return}var Q=parseInt(A);if(isNaN(Q)==true){alert(Web.Resource.BuildContent("ShoppingCart_CheckQty1"));$(M).val(P);M.focus();return}if(Q<=0){alert(Web.Resource.BuildContent("ShoppingCart_CheckQty2"));$(M).val(P);M.focus();return}var E=parseInt($(M).parent().prev().text());if(Q>E){alert(Web.Resource.BuildContent("ShoppingCart_CheckQty3"));$(M).val(P);M.focus();return}R="action=update&productno="+J+"&quantity="+Q+K}else{if(O=="applyCode1"){var N=$("#ticket").val();if(Web.Utils.String.IsNullOrEmpty(Web.Utils.String.Trim(N))==true){alert(Web.Resource.BuildContent("ShoppingCart_CheckPromotionCode"));$("#ticket").focus();return}R="action=apply&promotionCode="+N+K}else{if(O=="cancelCode1"){R="action=cancel"+K}else{if(O=="delGift1"){J=$(M).attr("ref1");R="action=giftdel&productno="+J+K}else{if(O=="itemGiftDel1"){J=$(M).parents("tr").find("input").attr("ref1");giftProductID=$(M).attr("ref1");R="action=itemgiftdel&productno="+J+"&giftDelID="+giftProductID+K}else{if(O=="moveOut1"){J=$(M).attr("ref1");R="action=moveout&productno="+J+K;F=F+"?action=add&productno="+J}else{if(O=="removeInventory1"||O=="removeInventory2"){$(M).parent().parent().parent().find("div li").each(function(){var S=$(this).attr("ref1");J+=S+","});J=Web.Utils.String.TrimEnd(J,",");R="action=del&productno="+J+K}else{if(O=="moveInventory1"||O=="moveInventory2"){$(M).parent().parent().parent().find("div li").each(function(){var S=$(this).attr("ref1");J+=S+","});J=Web.Utils.String.TrimEnd(J,",");R="action=moveout&productno="+J+K;F=F+"?action=add&productno="+J}else{if(O=="moveAirCondition1"||O=="moveCountrySide1"||O=="moveDCItem1"){J=$(M).attr("ref1");R="action=moveout&productno="+J+K;F=F+"?action=add&productno="+J}else{if(O=="removeAirCondition1"||O=="removeCountrySide1"||O=="removeDCItem1"){J=$(M).attr("ref1");R="action=del&productno="+J+K}else{if(O=="clearCart1"){if(confirm($Resource.BuildContent("ShoppingCart_ClearPrompt"))){R="action=clear"+K}}else{if(O=="checkOut1"){R="action=checkout"+K;F=F+"?"+C}else{if(O=="submitWarranty1"){var G=$(M).attr("ref1");var I=false;var D="";J=$(G).attr("ref1");$(G).find("input").each(function(S){I=$(this).attr("checked");if(I==true){D=$(this).attr("ref2")}});if(Web.Utils.String.IsNullOrEmpty(D)==true){alert($Resource.BuildContent("ShoppingCart_WarrantySelect"));return}if($(M).attr("ref2")==D){$(".hide").click();return}R="action=warrantymodify&productno="+J+"&warrantyID="+D+K}else{if(O=="warrantyDel1"){var G=$(M).attr("ref1");J=$(G).attr("ref1");R="action=warrantydel&productno="+J+K}}}}}}}}}}}}}}}}$.ajax({type:"GET",dataType:"html",url:B,cache:false,data:R,beforeSend:function(T){var U=document.location.href;if(U.lastIndexOf("?")>=0){U=U.substr(0,U.lastIndexOf("?"))}T.setRequestHeader("Referer",U);var S='<p class="process"><span>'+$Resource.BuildContent("PopupInfo")+"</span></p>";if(O=="applyCode1"){S='<p class="process" style="width:125px;margin:-2px 0px;"><span>'+$Resource.BuildContent("PopupInfo")+"</span></p>";$("#ticket").next("a").remove();$("#ticket").after(S)}else{if(O=="cancelCode1"){S='<p class="process" style="width:125px;margin:-2px 0px;"><span>'+$Resource.BuildContent("PopupInfo")+"</span></p>";$("#cancelCode1").after(S);$("#cancelCode1").remove()}else{if(O=="checkOut1"){$("#checkOut1").after(S);$("#checkOut1").remove()}else{if(O=="submitWarranty1"){$(M).after(S);$(M).remove()}else{if(L=="addNewItem"){S='<p class="process" style="width:125px;margin:-5px 0px;"><span>'+$Resource.BuildContent("PopupInfo")+"</span></p>";$(M).hide();$(M).after(S)}}}}}},success:function(S){Biz.Shopping.PageLoad.proccessed(S,F,R,O,L)},complete:function(S,T){if(L=="addNewItem"){$(".process").remove();$(M).show()}Biz.Common.PopCtrl.disablePopup()},error:function(){Biz.Common.PromptText.systemError()}})},proccessed:function(B,A,G,C,D){if(B=="CheckOut"){window.location=A;return}else{if(B=="Login"){var E=window.location.href;var F=E.indexOf("?");if(F>0){E=E.substring(0,F)}var H=$QueryString.Set("ReturnUrl",E+"?"+G);window.location=A+H;return}}var I=$(B);$("#shoppingPanel").html(I);if(C=="checkOut1"){window.scrollTo(0,0)}if(D=="updateItemQuantity"){$("#"+C).next("div").show();setTimeout("Biz.Shopping.PageLoad.ChangeQtyHide('"+C+"')",2000)}if(C=="moveOut1"){Biz.Common.OpenWindow.showbasket(A)}else{if(C=="moveAirCondition1"||C=="moveCountrySide1"||C=="moveDCItem1"){Biz.Common.OpenWindow.showbasket(A)}else{if(C=="moveInventory1"||C=="moveInventory2"){Biz.Common.OpenWindow.showbasket(A)}}}miniCart("","refresh")},ChangeQtyHide:function(A){$("#"+A).next("div").hide()}};usingNamespace("Biz.Shopping")["Accounting"]={post:function(A,E,B,G,D){var F="";var C=$("#campusAgent")[0].checked;if(C){F=$("#txtCampusAgentCustomerID").val()}$.ajax({type:"post",dataType:"html",url:$Url.BuildCurrentUrl("Ajax/Order/AjaxAccountingForCheckOut.aspx"),timeout:30000,data:{CustomerUsedPointAmount:E,IsUsedPrePay:B,OrderMemo:escape(G),IsUsedPoint:D,CampusAgentCustomerID:escape(F)},beforeSend:function(H){Biz.Common.Loading.showAreaCenter(A)},success:function(H,I){Biz.Shopping.Accounting.proccessed(A,H)},complete:function(H,I){Biz.Common.Loading.removeLoading(A)},error:function(){Biz.Common.PromptText.systemError()}})},proccessed:function(A,D){var C=$(D);var E="";var B="";$.each(C,function(F,G){if(G.id=="serverErrorInfo"){E=G.value}if(G.id=="returnLoginUrl"){B=G.value}});if(!$String.IsNullOrEmpty(B)){window.location.href=B;return}if($String.IsNullOrEmpty(E)){A.empty().append(D)}else{alert(E)}},getData:function(){var B=$("#salesOrderBalancePanel");var D=B.find("#point").val();if(!$String.IsNullOrEmpty(D)){if(!Biz.Common.Validation.isInteger(D)){var E=$Resource.BuildContent("CheckOut_Balance_CustomerInputPoint_NotifyMsg");alert(E);return null}}else{var E=$Resource.BuildContent("CheckOut_Balance_CustomerInputPoint_NotifyMsg");alert(E);return null}var C=typeof($("#ownMoney")[0])=="undefined"?false:$("#ownMoney")[0].checked;var F=$("#orderMemo").val();var A={JQueryObj:B,CustomerUsedPointAmount:D,IsUsedPrePay:C,OrderMemo:F};return A},save:function(){var A=Biz.Shopping.Accounting.getData();if(A!=null&&A.customerUsedPointAmount!="0"){var B=$Resource.BuildContent("CheckOut_Balance_CustomerInputPoint_Msg");alert(B);Biz.Shopping.Accounting.post(A.JQueryObj,A.CustomerUsedPointAmount,A.IsUsedPrePay,A.OrderMemo,true)}},refresh:function(D){var A=$("#salesOrderBalancePanel");var C=A.find("#customerUsedPointAmount").html();if(!Biz.Common.Validation.isInteger(C)){C=0}var B=D.checked;var E=$("#orderMemo").val();Biz.Shopping.Accounting.post(A,C,B,E,false)}};usingNamespace("Biz.Shopping")["CreateSalesOrder"]={post:function(E){var D=$("#customerUsedPointAmount")[0].innerHTML;var A=typeof($("#ownMoney")[0])=="undefined"?false:$("#ownMoney")[0].checked;var G=$("#orderMemo").val();var F="";var C=$("#campusAgent")[0].checked;if(C){F=$("#txtCampusAgentCustomerID").val();F=$String.Trim(F)}var B=$("#personID").val();$.ajax({type:"post",dataType:"html",url:$Url.BuildCurrentUrl("Ajax/Shopping/CreateSalesOrder.aspx"),timeout:100000,data:{CustomerUsedPointAmount:D,IsUsedPrePay:A,OrderMemo:escape(G),CampusAgentCustomerID:escape(F),PersonID:B},beforeSend:function(H){Biz.Common.Loading.showForRemoveElement($(E))},success:function(H,I){Biz.Shopping.CreateSalesOrder.proccessed(H,E)},complete:function(H,I){},error:function(){Biz.Common.PromptText.systemError();Biz.Common.Loading.removeLoadingForShowElement($(E))}})},proccessed:function(D,E){var C=$(D);var F="";var A=null;var B="";$.each(C,function(G,H){if(H.id=="serverErrorInfo"){F=H.value}else{if(H.id=="returnURL"){A=H.value}else{if(H.id=="returnLoginUrl"){B=H.value}}}});if(!$String.IsNullOrEmpty(B)){window.location.href=B;return}if(!$String.IsNullOrEmpty(F)){alert(F);Biz.Common.Loading.removeLoadingForShowElement($(E))}if(!$String.IsNullOrEmpty(A)){window.location.href=A}}};usingNamespace("Biz.Shopping")["ValidationCustomerForCheckOut"]={checked:function(){var B=window.location.href;var A=null;if(A==null){window.location.href=$WebsiteConfig.UrlPathMappings.SSLSite[0]+"Shopping/Login.aspx?ReturnUrl="+B}}};

