function qtyplusClick1(n,t){var i="";i=t.parentNode!=null?$("#ddlActualVolumePrice option:selected",t.parentNode).val():t;i.split("|")[7]!=undefined?i.split("|")[7]==1?($("#hdnSPStockid").val(i.split("|")[0]),$("#hdnRestrictedSPStockid").val(i.split("|")[1]),$("#hdnPreOrder").val(i.split("|")[7]),hdPinCode==""?ValidatePincode(n,"2"):i.split("|")[7]==1?ValidatePincode(n,"2"):(UpdateProductList1(n,"add",i.split("|")[0]),parseInt($("#spanQtyInCart"+i.split("|")[0]).html())>0?parseInt($("#spanQtyInCart"+i.split("|")[0]).html())==1&&$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","none"))):qtyplusclick2(n,i):i.split("|")[4]==1?($("#hdnSPStockid").val(i.split("|")[0]),$("#hdnRestrictedSPStockid").val(i.split("|")[1]),$("#hdnPreOrder").val(i.split("|")[4]),hdPinCode==""||hdPinCode==undefined?ValidatePincode(n,"2"):(UpdateProductList1(n,"add",i.split("|")[0]),parseInt($("#spanQtyInCart"+i.split("|")[0]).html())>0?parseInt($("#spanQtyInCart"+i.split("|")[0]).html())==1&&$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","none"))):qtyplusclick2(n,i)}function qtyplusclick2(n,t){var i="";i=t.parentNode!=null?$("#ddlActualVolumePrice option:selected",t.parentNode).val():t;i.split("|")[1]==1?($("#hdnSPStockid").val(i.split("|")[0]),hdPinCode==""||hdPinCode==undefined?ValidatePincode(n,"2"):(UpdateProductList1(n,"add",i.split("|")[0]),parseInt($("#spanQtyInCart"+i.split("|")[0]).html())>0?parseInt($("#spanQtyInCart"+i.split("|")[0]).html())==1&&$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","none"))):(UpdateProductList1(n,"add",i.split("|")[0]),parseInt($("#spanQtyInCart"+i.split("|")[0]).html())>0?$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","none"))}function qtyminusClick1(n,t){var i="";i=t.parentNode!=null?$("#ddlActualVolumePrice option:selected",t.parentNode).val():t;UpdateProductList1(n,"subtract",i.split("|")[0]);(n.target.parentNode.id=="spnMinus"||n.target.id=="btnCartMinus")&&$("#spanQtyInCart"+i.split("|")[0])!=null&&parseInt($("#spanQtyInCart"+i.split("|")[0]).html())>0&&$("#hdnIsMaxAmountReached").val()!=1&&$("#spanQtyInCart"+i.split("|")[0]).html(parseInt($("#spanQtyInCart"+i.split("|")[0]).html())-1);parseInt($("#spanQtyInCart"+i.split("|")[0]).html())>0?$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+i.split("|")[0]).parent().parent().parent().css("border","none")}function CheckIsCountOne(n){var t;return $.ajax({type:"POST",url:"/ProductList.aspx/CheckProductCount",dataType:"json",async:!1,data:JSON.stringify({sellerStockId:n}),contentType:"application/json; charset=utf-8",success:function(n){t=n.d},error:function(n,t,i){handleErrorMessage(n,i)}}),t}function removeProduct(n,t,i){UpdateProductList1(n,"remove",t);i.parentNode.parentNode.innerHTML="";i.id=="hrfRemove"&&$("#spanQtyInCart"+t)!=null&&($("#spanQtyInCart"+t).html(0),$("#spanQtyInCart"+t).parent().parent().parent().css("border","none"))}function qtyCartPlusClick1(n,t,i){var r=parseInt($("#txtCartCount",i.parentNode).val()),u=parseInt($("#spnPrice",i.parentNode).html().split("/")[0]);r<20?(r=r+1,qtyplusClick1(n,t),$("#hdnIsMaxAmountReached").val()!=1&&($("#txtCartCount",i.parentNode).val(r),$("#spnTotal",i.parentNode).html(r*u))):Materialize.toast("Sorry, the Maximum no.of product for single purchase reached.",4e3)}function qtyCartMinusClick1(n,t,i){var r=parseInt($("#txtCartCount",i.parentNode).val()),u=parseInt($("#spnPrice",i.parentNode).html().split("/")[0]);r>0?(r=r-1,$("#txtCartCount",i.parentNode).val(r),$("#spnTotal",i.parentNode).html(r*u),qtyminusClick1(n,t)):Materialize.toast("Sorry, this product is not added in your cart.",300)}function CheckIsUserLogged(){CheckIsUserLoggedIn()}function CheckIsUserLoggedIn(){$.ajax({type:"POST",url:"/Home.aspx/CheckIsUserLoggedIn",dataType:"json",data:"",contentType:"application/json; charset=utf-8",success:function(n){CheckIsUserVerifiedResponse(n)},error:function(n,t,i){handleErrorMessage(n,i)}})}function CheckIsUserVerifiedResponse(n){var i=$("#hdnRestrictedSPStockid").val(),t=$("#hdnSPStockid").val(),u=$("#hdnPreOrder").val(),r=$("#hdnPincode").val();u==1&&(n.d=="0"?i==1?r==""?ValidatePincode(event,"2"):(UpdateProductList1(event,"add",t),parseInt($("#spanQtyInCart"+selectedValue.split("|")[0]).html())>0?parseInt($("#spanQtyInCart"+selectedValue.split("|")[0]).html())==1&&$("#spanQtyInCart"+selectedValue.split("|")[0]).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+selectedValue.split("|")[0]).parent().parent().parent().css("border","none")):($("#PopUpPreOrderCheck").css("display","block"),$("#divPreOrderDeliveryAvail").css("display","block")):i==1?r==""?ValidatePincode(event,"2"):(UpdateProductList1(event,"add",t),parseInt($("#spanQtyInCart"+selectedValue.split("|")[0]).html())>0?parseInt($("#spanQtyInCart"+selectedValue.split("|")[0]).html())==1&&$("#spanQtyInCart"+selectedValue.split("|")[0]).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+selectedValue.split("|")[0]).parent().parent().parent().css("border","none")):UpdatePreOrderProductList("add",t))}function preorderContinue_Click(){$("#PopUpPreOrderCheck").css("display","none");var n=$("#hdnSPStockid").val();window.location.href="/login?PO="+n+""}function UpdatePreOrderProductList(n,t){var i=0;n=="add"?i=1:n=="subtract"?i=-1:n=="remove"&&(i=0);$.ajax({type:"POST",url:"/ProductList.aspx/UpdatePreOrderProductList",dataType:"json",async:!1,data:JSON.stringify({SellerStockId:t,Quantity:i}),contentType:"application/json; charset=utf-8",success:function(n){n.d.indexOf("Sorry")<0&&n.d!=null&&n.d!=""&&($("#spnPreOrderTotalCount").html(JSON.parse(n.d).Table1[0].TotalQuantity),Materialize.toast(JSON.parse(n.d).Table[0].ProductName+"    Add to pre order list.",300),$("#hdnPreOrder").val(""))},error:function(n,t,i){handleErrorMessage(n,i)}})}function showDeliveryMsg(){$("#lblDeliveryMsg").html("Sorry! The product you added is restricted for the address (pincode) you entered.You may not be able to add this product.  However, you may make a special request by clicking on the “Request Delivery” button below.")}function ValidatePincode(n,t){var i,r;$("#divDeliveryAvail").css("display","none");$("#divDeliveryNotAvail").css("display","none");t==1?(i=document.getElementById("txtPincode").value,$("#hdnPincode").val(i)):(hdPinCode=$("#hdnPincode").val(),hdPinCode==""?(i=document.getElementById("txtPincode").value,$("#hdnPincode").val(i)):i=hdPinCode);r=$("#hdnSPStockid").val();i!=""&&i.length==6?$.ajax({type:"POST",url:"/Home.aspx/ValidatePincode",dataType:"json",data:JSON.stringify({pincode:i,sellerProductStockId:r}),contentType:"application/json; charset=utf-8",async:!1,success:function(i){ValidatePincodeResponse(n,i,r,t)},error:function(n,t,i){handleErrorMessage(n,i)}}):i==""?$("#PopUpPincodeCheck").css("display","inline-table"):alert("Please enter valid 6 digit pincode.")}function ValidatePincodeResponse(n,t,i,r){if(t.d=="ErrorOccured"){alert("Some error occured. Please try again.");return}var u=$("#hdnPreOrder").val(),f=$("#hdnPincode").val();u==""||u=="0"?VaildatePincodeResponseForNormalProducts(n,t,i,r):JSON.parse(t.d).UserId==0?ValidatePincodeResponseForPreOrderProductBeforeLogin(n,t,i,r):ValidatePincodeResponseForPreOrderProductAfterLogin(n,t,i,r)}function VaildatePincodeResponseForNormalProducts(n,t,i,r){JSON.parse(t.d).Delivery!="undefined"&&JSON.parse(t.d).Delivery==1?r==2?JSON.parse(t.d).RestrictedDelivery!=0?(UpdateProductList1(n,"add",i),parseInt($("#spanQtyInCart"+i).html())>0?$("#spanQtyInCart"+i).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+i).parent().parent().parent().css("border","none")):JSON.parse(t.d).RestrictedDelivery==0?($("#PopUpPreOrderCheck").css("display","none"),$("#PopupPincodeCheck").css("display","block"),$("#divDeliveryNotAvail").css("display","block"),$("#divDeliveryAvail").css("display","none"),showDeliveryMsg()):($("#PopUpPreOrderCheck").css("display","block"),$("#divPreOrderDeliveryAvail").css("display","block"),$("#hdnRestrictedSPStockid").val("")):$("#divDeliveryAvail").css("display","block"):($("#PopUpPincodeCheck").css("display","inline-table"),$("#divDeliveryNotAvail").css("display","block"));JSON.parse(t.d).RestrictedDelivery==0?($("#divDeliveryNotAvail").css("display","block"),SaveRestrictedSPStockId(i),showDeliveryMsg(),$("#divDeliveryAvail").css("display","none")):$("#hdnRestrictedSPStockid").val("")}function ValidatePincodeResponseForPreOrderProductBeforeLogin(n,t,i,r){JSON.parse(t.d).Delivery==1?r==2?($("#divPreOrderDeliveryAvail").css("display","block"),$("#PopUpPreOrderCheck").css("display","block")):($("#divPreOrderProductLogin").css("display","block"),$("#divPreOrderDeliveryAvailable").css("display","block"),$("#btnPreOrderLogin").css("display","block")):($("#divDeliveryNotAvail").css("display","block"),$("#PopUpPreOrderCheck").css("display","block"),$("#divPreOrderDeliveryAvail").css("display","block"),$("#hdnRestrictedSPStockid").val(""))}function ValidatePincodeResponseForPreOrderProductAfterLogin(n,t,i,r){if(JSON.parse(t.d).Delivery==1)if(r==2)if(JSON.parse(t.d).RestrictedDelivery==0)$("#PopUpPreOrderCheck").css("display","none"),$("#PopupPincodeCheck").css("display","block"),$("#divDeliveryNotAvail").css("display","block"),$("#divDeliveryAvail").css("display","none"),showDeliveryMsg(),SaveRestrictedSPStockId(i);else{$("#PopUpPreOrderCheck").css("display","none");$("#PopupPincodeCheck").css("display","none");UpdatePreOrderProductList("add",i);var u=n.target.parentNode.parentNode.parentNode;$("#btnReserveNow",u).attr("style","display: none");$("#btnReserved",u).attr("style","display: inline-grid");$("#btnReserved",u).attr("style","background-color: #019779!important");$("#btnReserved",u).attr("style","padding: 5px 13px 5px 13px");$("#hdnRestrictedSPStockid").val("");$("#hdnPreOrder").val("")}else JSON.parse(t.d).RestrictedDelivery==0?($("#PopUpPreOrderCheck").css("display","none"),$("#PopupPincodeCheck").css("display","block"),$("#divDeliveryNotAvail").css("display","block"),$("#divDeliveryAvail").css("display","none"),showDeliveryMsg()):($("#PopUpPreOrderCheck").css("display","none"),$("#PopupPincodeCheck").css("display","block"),$("#divPreOrderPincodeResponse").css("display","block"),$("#hdnRestrictedSPStockid").val(""),$("#hdnPreOrder").val(""));JSON.parse(t.d).RestrictedDelivery==0?($("#PopUpPreOrderCheck").css("display","none"),$("#PopupPincodeCheck").css("display","block"),$("#divDeliveryNotAvail").css("display","block"),$("#divDeliveryAvail").css("display","none"),$("#divPreOrderProductLogin").css("display","none"),$("#divPreOrderDeliveryAvailable").css("display","none"),$("#btnPreOrderLogin").css("display","none"),SaveRestrictedSPStockId(i),showDeliveryMsg()):$("#hdnRestrictedSPStockid").val("")}function SaveRestrictedSPStockId(n){$.ajax({type:"POST",url:"/Home.aspx/SaveRestrictedSPStockId",dataType:"json",async:!1,data:JSON.stringify({sellerProductStockId:n}),contentType:"application/json; charset=utf-8",success:function(n){n.d!=""&&$("#hdnRestrictedSPStockid").val(n.d)},error:function(n,t,i){handleErrorMessage(n,i)}})}function pincodeContinue_Click(n,t){if(t==1){var i=$("#hdnSPStockid").val();UpdateProductList1(n,"add",$("#hdnSPStockid").val());$("#spanQtyInCart"+i)!=null&&parseInt($("#spanQtyInCart"+i).html())<20&&$("#hdnIsMaxAmountReached").val()!=1&&$("#spanQtyInCart"+i).html(parseInt($("#spanQtyInCart"+i).html())+1);parseInt($("#spanQtyInCart"+i).html())>0?$("#spanQtyInCart"+i).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+i).parent().parent().parent().css("border","none")}$("#PopUpPincodeCheck").css("display","none");hdPinCode=$("#hdnPincode").val()}function pincodeContinuePreOrder_Click(n){if(n==1){var t=$("#hdnSPStockid").val();UpdatePreOrderProductList("add",t)}$(".btnReserveNow"+t).attr("style","display: none");$(".btnReserved"+t).attr("style","display: block");$(".btnReserved"+t).attr("style","background-color: #019779!important");$(".btnReserved"+t).attr("style","padding: 5px 13px 5px 13px");$("#PopUpPincodeCheck").css("display","none");$("#divPreOrderPincodeResponse").css("display","none")}function UpdateProductList1(n,t,i){var r=0;t=="add"?r=1:t=="subtract"?r=-1:t=="remove"&&(r=0);$.ajax({type:"POST",url:"/ProductList.aspx/ManageCart",dataType:"json",async:!1,data:JSON.stringify({SellerStockId:i,Quantity:r}),contentType:"application/json; charset=utf-8",success:function(t){t.d.indexOf("Sorry")<0?((n.target.parentNode.id=="spnPlus"||n.target.id=="btnCartPlus")&&$("#spanQtyInCart"+i)!=null&&parseInt($("#spanQtyInCart"+i).html())<20&&$("#hdnIsMaxAmountReached").val()!=1&&$("#spanQtyInCart"+i).html(parseInt($("#spanQtyInCart"+i).html())+1),$("#spanNetTotal").html(parseFloat(JSON.parse(t.d).NetTotal).toFixed(2)),$("#spanCartCount").html(JSON.parse(t.d).TotalCount),$("#lblSumOfCart")!=null&&$("#lblSumOfCart").html(parseFloat(JSON.parse(t.d).NetTotal).toFixed(2)),parseInt(JSON.parse(t.d).TotalCount)==0?($("#lblEmpty").css("display","block"),$("#CartTotal").css("display","none"),$("#aBuyNow").css("display","none")):($("#lblEmpty").css("display","none"),$("#CartTotal").css("display","block"),$("#aBuyNow").css("display","block"),$("#lblSumOfCart").val(parseFloat(JSON.parse(t.d).NetTotal).toFixed(2))),parseInt(JSON.parse(t.d).Discount)!=0?(document.getElementById("lblDiscount").innerHTML=" &#8377; "+parseFloat(JSON.parse(t.d).Discount).toFixed(2),document.getElementById("lblDiscount").style.color="rgb(0, 150, 136)",document.getElementById("divcardiscount").style.display="block"):(document.getElementById("divcardiscount").style.display="none",document.getElementById("lblDiscount").innerHTML=""),$("#hdnIsMaxAmountReached").val("0")):(t.d.replace(/\s+/g,"").indexOf("Maximumorder")>0&&$("#hdnIsMaxAmountReached").val("1"),Materialize.toast(t.d,4e3))},error:function(n,t,i){handleErrorMessage(n,i)}})}function GetCartDetails1(){$.ajax({type:"POST",url:"/ProductList.aspx/GetCartDetails",dataType:"json",data:JSON.stringify({visitorId:""}),contentType:"application/json; charset=utf-8",success:function(n){bindCartDetails1(n)},error:function(n,t,i){handleErrorMessage(n,i)}})}function bindCartDetails1(n){var r=n.d.ProductList.length,t,i;if($("#tblCart").html(""),r!="0"){for(t=0;t<r;t++)i=$("#divCartProductListDesign").eq(0).clone(!0),$("#divCartProductList",i).css("display","block"),$("#divCartProductList",i).attr("ID","divCartProductList1"),$("#hrfRemove",i).attr("onclick","removeProduct(event,'"+n.d.ProductList[t].SellerProductStockId+"',this)"),$("#btnCartPlus",i).attr("onclick","qtyCartPlusClick1(event,'"+n.d.ProductList[t].SellerProductStockId+"' ,this )"),$("#btnCartMinus",i).attr("onclick","qtyCartMinusClick1(event,'"+n.d.ProductList[t].SellerProductStockId+"'  ,this )"),$("#imgProduct",i).attr("src","https://cdn1.Myrightbuy.com/images/"+n.d.ProductList[t].ImageName.replace("_Thumb","_m").replace("_Thump","_m")),$("#spnProductName",i).html(n.d.ProductList[t].ProductName),$("#spnPrice",i).html(n.d.ProductList[t].Price+" / "+n.d.ProductList[t].Volume),parseInt(n.d.ProductList[t].Quantity)>0?$("#spnTotal",i).html(parseInt(n.d.ProductList[t].Price)*parseInt(n.d.ProductList[t].Quantity)):$("#spnTotal",i).html(0),parseInt(n.d.ProductList[t].Quantity)>0?$(".txtqty",i).val(n.d.ProductList[t].Quantity):$(".txtqty",i).val(0),$("#tblCart").append(i);document.getElementById("CartTotal").style.display="block";document.getElementById("lblSumOfCart").innerHTML=parseFloat(n.d.NetTotal).toFixed(2);document.getElementById("spanCartCount").innerHTML=parseInt(n.d.TotalCount);document.getElementById("spanNetTotal")!=null&&(document.getElementById("spanNetTotal").innerHTML=parseFloat(n.d.NetTotal).toFixed(2));parseInt(n.d.Discount)!=0?(document.getElementById("lblDiscount").innerHTML=" &#8377; "+parseFloat(n.d.Discount).toFixed(2),document.getElementById("lblDiscount").style.color="rgb(0, 150, 136)",document.getElementById("divcardiscount").style.display="block"):(document.getElementById("divcardiscount").style.display="none",document.getElementById("lblDiscount").innerHTML="");document.getElementById("tblCart").style.borderTop="1px solid #FFB400";document.getElementById("aBuyNow").style.display="block";n.d.NetTotal==0&&(document.getElementById("aBuyNow").style.display="none",document.getElementById("lblEmpty").style.display="none")}else document.getElementById("lblEmpty").style.display="block",document.getElementById("divcardiscount").style.display="none"}function LoadFilters(){var n,t,i;(document.getElementById("divCategoryFilter").innerHTML.trim()==""||document.getElementById("divBrandFilter").innerHTML.trim()=="")&&(window.location.href.indexOf("q")==-1?(n="/ProductList.aspx/LoadFilterByCategory",t="{SelectedCategory: "+JSON.stringify(document.getElementById("hdnSelectedCategory").value)+"}"):(i=GetParameterValues("q"),n="/ProductList.aspx/LoadFilterByKeyword",t="{keyword: "+JSON.stringify(i)+"}"),$.ajax({type:"POST",url:n,dataType:"json",data:t,contentType:"application/json; charset=utf-8",success:function(n){BindCheckBoxList(n)},error:function(n,t,i){handleErrorMessage(n,i)}}))}function BindCheckBoxList(n){var t=JSON.parse(n.d);CreateCheckBoxList(t)}function CreateCheckBoxList(n){var i=$('<table id="chkItem"><\/table>'),r=$('<table id="chkBrand"><\/table>'),t=0;$(n).each(function(){this.Type==1?i.append($("<tr><\/tr>").append($("<td><\/td>").append($("<input>").attr({type:"checkbox",name:"chkItem",value:this.Value,id:"chklistitem"+t})).append($("<label>").attr({"for":"chklistitem"+t++}).text(this.Name)))):r.append($("<tr><\/tr>").append($("<td><\/td>").append($("<input>").attr({type:"checkbox",name:"chkBrand",value:this.Value,id:"chklistbrand"+t})).append($("<label>").attr({"for":"chklistbrand"+t++}).text(this.Name))))});document.getElementById("divCategoryFilter").innerHTML.trim()==""&&$("#divCategoryFilter").append(i);document.getElementById("divBrandFilter").innerHTML.trim()==""&&$("#divBrandFilter").append(r)}function toggleClick(n){$(n).find(".spnarrow").children("i").attr("class").trim().indexOf("arrow-drop-up")!=-1?($(n).find(".spnarrow").children("i").removeClass(),$(n).find(".spnarrow").children("i").addClass("mdi-navigation-arrow-drop-down right")):($(n).find(".spnarrow").children("i").removeClass(),$(n).find(".spnarrow").children("i").addClass("mdi-navigation-arrow-drop-up right"))}function btnFilterClick(){$("#dvProductList").html("");$(".slidediv").slideToggle();$("#divFilterFooter").toggle(500,null);$("#divCheckoutFooter").toggle(500,null);pageIndex=0;$("#hdnDivClear").val("");GetRecords()}function btnFilterCancelClick(){$(".slidediv").slideToggle();$("#divFilterFooter").toggle(500,null);$("#divCheckoutFooter").toggle(500,null)}function subcategoryClick(n){document.getElementById("dvProductList").innerHTML="";$.ajax({type:"POST",url:"/ProductList.aspx/ResetSubcategory",data:"{currentSelectedCategory: "+JSON.stringify(n[0].id)+",SelectedCategory: "+JSON.stringify(document.getElementById("hdnSelectedCategory").value)+"}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){n.d.split(":")[0]=="1"&&($("#hdnSelectedCategory").val(n.d.split(":")[1]),$("#hdfFltrItem").val(""),$("#hdfFltrBrand").val(""),$("#divBrandFilter").html(""),$("#divFilterSelectedItem").html(""),$("#divCategoryFilter").html(""));pageIndex=0;pageIndex==0&&(document.getElementById("dvProductList").innerHTML="",GetRecords())},error:function(n,t,i){handleErrorMessage(n,i)}})}function IsCartEmpty(){$.ajax({type:"POST",url:"/ProductList.aspx/IsCartEmpty",dataType:"json",data:"",contentType:"application/json; charset=utf-8",success:function(n){if(n.d=="0")return Materialize.toast("No products in your cart.",4e3),!1;window.location.href="/buy"},error:function(n,t,i){handleErrorMessage(n,i)}})}function btnTempMinusClick(n,t,i){var u=$(n.target).closest("tr"),r=parseInt($("#txtQuantity",u).text());r=r-1;r>=0?UpdateTemplateDetails("sub",u,t,r,i):alert("Sorry, you are unable to reduce count. you reached minimum product count.")}function btnTempPlusClick(n,t,i){var u=$(n.target).closest("tr"),r=parseInt($("#txtQuantity",u).text());r=r+1;r<21?UpdateTemplateDetails("add",u,t,r,i):alert("Sorry, this product count reached Max limit for single purchase.")}function removeTempProduct(n,t,i){$(n.target).closest(".itemFieldset").remove();var r=n.target.parentNode.parentNode.parentNode;$(n.target).closest("tr").remove();UpdateTemplateDetails("remove",r,t,0,i)}function UpdateTemplateDetails(n,t,i,r,u){$.ajax({type:"POST",url:"/TemplateDetails.aspx/UpdateTemplateDetails",dataType:"json",async:!1,data:JSON.stringify({productId:i,quantity:r,templateId:u}),contentType:"application/json; charset=utf-8",success:function(i){$(".itemFieldset").length<1&&($("#emptyP").css("display","block"),$("#btnBuy").css("display","none"));i.d.indexOf("Sorry")<0&&(parseInt(JSON.parse(i.d).Quantity)>=0?(n=="add"&&parseInt(JSON.parse(i.d).Quantity)>=0&&$("#txtQuantity",t).html(JSON.parse(i.d).Quantity),n=="sub"&&$("#txtQuantity",t).html(JSON.parse(i.d).Quantity),n=="remove"&&($(event.target).closest("tr").remove(),showPreOrderEmpty())):alert("Sorry, this product count reached Max limit for single purchase."))},error:function(n,t,i){handleErrorMessage(n,i)}})}function GetCartCount(n){n!=0&&$.ajax({type:"POST",url:"/ProductList.aspx/CheckProductCount",dataType:"json",data:JSON.stringify({sellerStockId:n}),contentType:"application/json; charset=utf-8",success:function(t){t.d!=null&&$("#spanQtyInCart"+n)[0]!=undefined&&($("#spanQtyInCart"+n).html()!=""&&$("#spanQtyInCart"+n).html(t.d),t.d>0?$("#spanQtyInCart"+n).parent().parent().parent().css("border","2px solid #FFB400"):$("#spanQtyInCart"+n).parent().parent().parent().css("border","none"))},error:function(n,t,i){handleErrorMessage(n,i)}})}function ddlOPTActualVolumePriceOnchange(n){var t,i;n=n||window.event;t=n.target.parentNode.parentNode.parentNode;$(".spanQuantityInCart",t).attr("style","display: initial");n.target.value.split("|")[7]=="1"?($(".tooltipped").tooltip({delay:50}),n.target.value.split("|")[8]=="1"?($("#btnReserveNow",t).attr("style","display: none"),$("#btnReserved",t).attr("style","display: inline-grid"),$("#btnReserved",t).attr("style","background-color: #019779!important"),$("#btnReserved",t).attr("style","padding: 5px 13px 5px 13px")):($("#spnPlus",t).attr("style","display: none"),$("#spnMinus",t).attr("style","display: none"),$("#btnReserveNow",t).attr("style","display: none"),$("#btnReserved",t).attr("style","display: none"),$(".spinner",t).attr("style","display: block"),$(".spinner",t).attr("style","float: right !important; margin-right: 88px !important"),GetIsAddToPreOrderStatus(n.target.value.split("|")[0],t)),$("#divOutofStock",t).attr("style","display: none"),$("#spnPlus",t).attr("style","display: none"),$("#spnMinus",t).attr("style","display: none"),$("#spnPlus",t).attr("onclick",""),$("#spnMinus",t).attr("onclick",""),$(".spanQuantityInCart",t).attr("style","display: none")):(n.target.value.split("|")[2]=="1"?($("#divOutofStock",t).attr("style","display: grid"),$("#spnPlus",t).attr("style","display: none"),$("#spnMinus",t).attr("style","display: none"),$("#spnPlus",t).attr("onclick",""),$("#spnMinus",t).attr("onclick",""),$("#btnReserveNow",t).attr("style","display: none"),$("#btnReserved",t).attr("style","display: none"),$(".spanQuantityInCart",t).attr("style","display: none")):($("#divOutofStock",t).attr("style","display: none"),$("#spnPlus",t).attr("style","display: inline-grid"),$("#spnMinus",t).attr("style","display: inline-grid"),$("#spnPlus",t).attr("onclick","qtyplusClick1(event,this)"),$("#spnMinus",t).attr("onclick","qtyminusClick1(event,this)"),$("#btnReserveNow",t).attr("style","display: none"),$("#btnReserved",t).attr("style","display: none")),i=n.target.value.split("|")[3],i!=""&&i!=null&&i>0&&n.target.value.split("|")[3]!="0"?($("#divOffer",t).attr("style","display: block"),$("#divOfferText",t).html(i+"% Off"),$("#divImgOffer",t).attr("style","display: block"),$("#divOfferSummary",t).attr("style","display: -webkit-inline-box"),$("#divOfferSummary",t).html(""),$("#divOfferSummary",t).append(n.target.value.split("|")[6]+" : &#8377;"+n.target.value.split("|")[5]+"&nbsp; <strike>&#8377;"+n.target.value.split("|")[4]+"<\/strike> <br />")):($("#divOffer",t).attr("style","display: none"),$("#divOfferSummary",t).attr("style","display: none")));$($(t).find(".spanQuantityInCart")).attr("ID","spanQtyInCart"+n.target.value.split("|")[0]);$($(t).find("#btnReserved")).attr("CLASS","btnReserved"+n.target.value.split("|")[0]+"  white waves-effect waves-light grey lighten-2");$($(t).find("#btnReserveNow")).attr("CLASS","btnReserveNow"+n.target.value.split("|")[0]+"  white waves-effect waves-light grey lighten-2");GetCartCount(n.target.value.split("|")[0])}function GetIsAddToPreOrderStatus(n,t){n!=0&&$.ajax({type:"POST",url:"/ProductList.aspx/CheckIsAddedPreOrder",dataType:"json",data:JSON.stringify({sellerStockId:n}),contentType:"application/json; charset=utf-8",success:function(n){JSON.parse(n.d).Table[0].IsAddedPreOrder==1?($("#btnReserveNow",t).attr("style","display: none"),$(".spinner",t).attr("style","display: none"),$("#btnReserved",t).attr("style","display: inline-grid"),$("#btnReserved",t).attr("style","background-color: #019779!important"),$("#btnReserved",t).attr("style","padding: 5px 13px 5px 13px")):($(".spinner",t).attr("style","display: none"),$("#btnReserved",t).attr("style","display: none"),$("#btnReserveNow",t).attr("style","display: inline-grid"),$("#btnReserveNow",t).attr("style","background-color: #019779!important"),$("#btnReserveNow",t).attr("style","padding: 5px 13px 5px 13px"))},error:function(n,t,i){handleErrorMessage(n,i)}})}function PreOrderCount(){$.ajax({type:"POST",url:"/ProductList.aspx/PreOrderLoadCount",dataType:"json",async:!1,data:"",contentType:"application/json; charset=utf-8",success:function(n){n.d!=null&&n.d!=""&&n.d!=0&&(JSON.parse(n.d).Table[0].Quantity!=0?($("#spnPreOrderTotalCount").css("display","block"),$("#spnPreOrderTotalCount").html(JSON.parse(n.d).Table[0].Quantity)):$("#spnPreOrderTotalCount").css("display","none"));$("#spnPreOrderTotalCount").css("display","block")},error:function(n,t,i){handleErrorMessage(n,i)}})}function handleErrorMessage(n,t){switch(!0){case n.status===0:alert("Please verify your network connection and referesh this page.");break;case n.status==404:alert("Some error occured. Please referesh and try again.");break;case n.status==401:alert("Some error occured. Please referesh and try again.");break;case n.status==500:alert("Some error occured. Please referesh and try again.");break;case t==="parsererror":alert("Some error occured. Please referesh and try again.");break;case t==="timeout":alert("Some error occured. Please referesh and try again.");break;case t==="abort":alert("Some error occured. Please referesh and try again.");break;default:alert("Some error occured. Please referesh and try again.")}t!=""&&n!=""&&$.ajax({type:"POST",url:"/Home.aspx/ErrorLog",dataType:"json",data:"{Error: "+JSON.stringify(t)+",ExceptionType: "+JSON.stringify($.parseJSON(n.responseText).ExceptionType)+",StackTrace: "+JSON.stringify($.parseJSON(n.responseText).StackTrace)+",Message: "+JSON.stringify($.parseJSON(n.responseText).Message)+",Status: "+JSON.stringify(n.status)+",Url: "+JSON.stringify("")+"}",contentType:"application/json; charset=utf-8",success:function(){alert("Error : :  "+n.responseText+", status : :  "+n.status+", url : :  "+JSON.stringify(ajaxSettings.url))},error:function(){return!1}})}function chktoastInitiated(n){if(toastInitiated=="false"){toastInitiated="true";var t=n;Materialize.toast(t,4e3,"",function(){toastInitiated="false"})}}function validate(){var i=document.getElementById("txtname").value,n=document.getElementById("txtpincode").value,r=document.getElementById("txtaddress").value,u=document.getElementById("txtlandmark").value,f=document.getElementById("txtcity").value,e=document.getElementById("ddlState").value,t=document.getElementById("txtphone").value;if(i=="")return chktoastInitiated("Enter Your Name"),!1;if(n=="")return chktoastInitiated("Enter Your Pincode"),!1;if(/^\d{6}$/.test(n)){if(r=="")return chktoastInitiated("Enter Your Address"),!1;if(u=="")return chktoastInitiated("Enter Your Landmark"),!1;if(f=="")return chktoastInitiated("Enter Your City"),!1;if(e=="0")return chktoastInitiated("Enter Your State"),!1;if(t=="")return chktoastInitiated("Enter Your Phone Number"),!1;if(!/^\d{10}$/.test(t))return chktoastInitiated("Invalid mobile No. "),!1}else return chktoastInitiated("Invalid Pincode No. "),!1}function capitalize(n,t){if(t&&t.length>=1){var i=t.charAt(0),r=t.slice(1);t=i.toUpperCase()+r}document.getElementById(n).value=t}function isNameKey(n){var t=n.which?n.which:event.keyCode;return t>64&&t<91||t>96&&t<123||t==32||t==46?!0:!1}function isNumberKey(n){var t=n.which?n.which:event.keyCode;return t>31&&(t<48||t>57)?!1:!0}function isPhoneNumberKey(n){var t=n.which?n.which:event.keyCode;return t>31&&(t<48||t>57)?!1:!0}function GetNameForURL(n){return n.toLowerCase().replace(/([~!@#$^&*º()_–+`{}\[\] \|:;'<>,. ])+/g,"-").replace(/^(-)+|(-)+$/g,"").replace(/([\- ])+/g,"-").replace("-/","/")}function validationforgotpassword(){var n=document.getElementById("txtEmail").value,t=document.getElementById("txtNewPassword").value;if(n==""||t==""){if(n=="")return chktoastInitiated("Please enter your EmailId"),document.getElementById("dvForgotPassword").style.display="block",!1;if(t=="")return chktoastInitiated("Please enter password"),document.getElementById("dvForgotPassword").style.display="block",!1}else if(!/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(n))return chktoastInitiated("Please enter valid EmailId"),document.getElementById("dvForgotPassword").style.display="block",!1}function GetSearchDiv(){document.getElementById("Searchdiv").style.display=="block"?document.getElementById("Searchdiv").style.display="none":(document.getElementById("Searchdiv").style.display="block",document.getElementById("txtSearch1").focus());document.getElementById("filterDiv")!=null&&document.getElementById("filterDiv").style.display=="block"&&(btnFilterCancelClick(),document.getElementById("Searchdiv").style.display="block",document.getElementById("txtSearch1").focus())}function ftxtSearchvalidate(n){var t=document.getElementById(n.id).value;if(t.trim()=="")return document.getElementById(n.id).focus(),!1;window.location.href="/search?q="+document.getElementById(n.id).value}function SetSearchFocus(){$("#menuIcon").trigger("click");document.getElementById("aSearchIcon").style.display=="none "?document.getElementById("txtSearch1").focus():(document.getElementById("Searchdiv").style.display="block",document.getElementById("txtSearch").focus())}function aHomeClick(){if(window.location.href==window.location.origin||window.location.href==window.location.origin+"/"||window.location.href.indexOf("home")!=-1)return!1;window.location.href="/"}var hdPinCode,toastInitiated;$(document).ready(function(){$(".showhide").on("click",function(){$("#divFilterFooter").toggle(500,null);$("#divCheckoutFooter").toggle(500,null);$(".slidediv").slideToggle()})});$(document).on("change","[type=checkbox]",function(){var n;this.attributes.name.value==="chkItem"&&($(this).is(":checked")?(document.getElementById("hdfFltrItem").value=document.getElementById("hdfFltrItem").value+","+$(this).val(),n=document.createElement("span"),n.innerHTML=$(this)[0].nextSibling.innerHTML,n.className="task-cat yellow darken-4",n.id=$(this)[0].id.replace("chklistitem","spanItem"),$("#divFilterSelectedItem:contains('"+$(this)[0].nextSibling.innerHTML+"')").length==0&&document.getElementById("divFilterSelectedItem").appendChild(n)):(document.getElementById("hdfFltrItem").value=document.getElementById("hdfFltrItem").value.replace(","+$(this).val(),""),document.getElementById($(this)[0].id.replace("chklistitem","spanItem")).remove()));this.attributes.name.value==="chkBrand"&&($(this).is(":checked")?(document.getElementById("hdfFltrBrand").value=document.getElementById("hdfFltrBrand").value+","+$(this).val(),n=document.createElement("span"),n.innerHTML=$(this)[0].nextSibling.innerHTML,n.className="task-cat yellow darken-4",n.id=$(this)[0].id.replace("chklistbrand","spanbrand"),$("#divFilterSelectedItem:contains('"+$(this)[0].nextSibling.innerHTML+"')").length==0&&document.getElementById("divFilterSelectedItem").appendChild(n)):(document.getElementById("hdfFltrBrand").value=document.getElementById("hdfFltrBrand").value.replace(","+$(this).val(),""),document.getElementById($(this)[0].id.replace("chklistbrand","spanbrand")).remove()))});$("#divScrollingMenu li").click(function(){subcategoryClick($(this).find("a"))});$(".spanIcon").click(function(){$(this).fadeOut(150);$(this).fadeIn(150)});$(document).ready(function(){$(window).scroll(function(){$(this).scrollTop()>250?$("#btnBackToTop").fadeIn():$("#btnBackToTop").fadeOut()});$("#btnBackToTop").click(function(){return $("#btnBackToTop").tooltip("hide"),$("body,html").animate({scrollTop:0},800),!1});$("#btnBackToTop").tooltip("show")});toastInitiated="false";$(function(){$("#txtSearch1").keypress(function(n){var t=n.which;if(t==13)$("#anchorSearch1").trigger("click");else return!0})});$(function(){$("#txtSearch").keypress(function(n){var t=n.which;if(t==13)$("#anchorSearch").trigger("click");else return!0})});$(function(){$("#txtPincode").keypress(function(n){var t=n.which;if(t==13)$("#aValidatePincode").trigger("click");else return!0})});$(document).ready(function(){$("#right-sidebar-nav").on("swipe",function(){alert("Swipe detected!")});$("#right-sidebar-nav").on("swipeleft",function(){alert("You swiped left!")});$("#right-sidebar-nav").on("swiperight",function(){alert("You swiped right!")})});$("#txtSearch").autocomplete({source:function(n,t){$.ajax({type:"POST",url:"/Home.aspx/GetKeyword",dataType:"json",data:JSON.stringify({keyword:document.getElementById("txtSearch").value}),contentType:"application/json; charset=utf-8",success:function(n){n?t(n.d):alert("Error")},error:function(){}})}});$("#txtSearch1").autocomplete({source:function(n,t){$.ajax({type:"POST",url:"/Home.aspx/GetKeyword",dataType:"json",data:JSON.stringify({keyword:document.getElementById("txtSearch1").value}),contentType:"application/json; charset=utf-8",success:function(n){n?t(n.d):alert("Error")},error:function(){}})}});$(function(){$(".showsearch").click(function(){$(".slidesearch").slideToggle()})});$(document).ready(function(){$.ajax({type:"POST",url:"/Home.aspx/UpdateCartCount",dataType:"json",data:"",contentType:"application/json; charset=utf-8",success:function(n){document.getElementById("spanCartCount")!=null&&(document.getElementById("spanCartCount").innerHTML=n.d)},error:function(){}})})