var BASE_URL="";$(function(){$("#menu li:last").find("a").css("border","none");$("#category-sec li:last").find("a").css("border-bottom","none");$("#basic-combo").sexyCombo({emptyText:"All Category",skin:"custom"});$("a.buynow").click(function(){var _1=jQuery.parseJSON($(this).attr("data-pdetail"));adtoCart(_1);});$(".qty-input").click(function(){$(this).select();});$(".qty-input").change(function(){var id=$(this).attr("data-pid");var _2=$(this).val();$.post(BASE_URL+"/server.html",{pId:id,Qty:_2,"do-case":"updateCartItem"},function(_3){_3=jQuery.parseJSON(_3);$("#sub_"+id).html(_3.subTotal);$("#totalQ").html(_3.totalQty);$("#totalPrice").html(_3.totalPrice);});});$(".qty-input").live("blur",function(){var id=$(this).attr("data-pid");var _4=$(this).val();$.post(BASE_URL+"/server.html",{pId:id,Qty:_4,"do-case":"updateCartItem"},function(_5){_5=jQuery.parseJSON(_5);$("#sub_"+id).html(_5.subTotal);$("#totalQ").html(_5.totalQty);$("#totalPrice").html(_5.totalPrice);});});$(".del_cart").click(function(){var id=$(this).attr("data-pid");var _6=$(this);var _7=jQuery.parseJSON(updateQuantity(id));$.post(BASE_URL+"/server.html",{pId:id,"do-case":"deleteCartItem"},function(_8){var _9=_8.split("|");$("#totalPrice").html(_9[1]);$("#totalQ").html(_9[3]);_6.parent().parent().hide("slow",function(){_6.parent().parent().remove();});});});$("input[type='number']").numeric();$("#frmRegistration").submit(function(){var _a=$("#regEmail").val();var _b=$("#regCEmail").val();var _c=$("#regPassword").val();var _d=$("#regName").val();if(_a==_b){modalOverLay();$.post(BASE_URL+"/server.html",{"email":_a,"do-case":"validateEmail"},function(_e){if(_e==0){$.post(BASE_URL+"/server.html",{"email":_a,"password":_c,"name":_d,"type":"register","do-case":"userReg","mode":"normal"},function(_f){infotext(_f,"info");hideModalOverLay();});}else{infotext("You are trying to register with an existing email address. Are you already registerd? if you are try ","info");hideModalOverLay();}});}else{infotext("Email and Confirmation Email are not same. Please correct it.","error");}return false;});$("#frmLogin").submit(function(){var _10=$("#loginEmail").val();var _11=$("#loginpassword").val();if(_10!=""){modalOverLay();$.post(BASE_URL+"/server.html",{"email":_10,"password":_11,"do-case":"userReg","mode":"normal","type":"login"},function(_12){if(_12=="loggedIn"){document.location.href=BASE_URL+"/my-account.html";}else{infotext(_12,"warning");hideModalOverLay();}});}return false;});$("#frmForgot").submit(function(){var _13=$(this).serialize();var _14=$("#forgotEmail").val();if(_14!=""){modalOverLay();$.post(BASE_URL+"/server.html",_13,function(_15){$.get("/captcha.html",{},function(_16){$(".captcha").html(_16);});infotext(_15,"info");hideModalOverLay();});}return false;});$("#frmProfile").submit(function(){modalOverLay();var _17=$(this).serialize();$.post(BASE_URL+"/server.html",_17,function(_18){document.location.href=document.location.href;hideModalOverLay();});return false;});$("#frmSecurity").submit(function(){modalOverLay();var _19=$(this).serialize();$.post(BASE_URL+"/server.html",_19,function(_1a){document.location.href=document.location.href;hideModalOverLay();});return false;});$("#frmEmail").submit(function(){var _1b=$(this).serialize();modalOverLay();$.post(BASE_URL+"/server.html",_1b,function(_1c){var res=jQuery.parseJSON(_1c);infotext(res.msg,res.type);if(res.type=="success"){$("#frmEmail").parent().remove();}hideModalOverLay();});return false;});$(".dismiss").live("click",function(){$("#notification").fadeOut("slow",function(){$("ul.msg_displayer").children().remove();});});$(".error").live("blur",function(){if($(this).val()!=""){$(this).removeClass("error");}});});function adtoCart(_1d){var _1e={"id":0,"offer":0,"price":1,"offerPrice":0,"foreignPrice":1,"foreignOPrice":1,"qty":1,"redirect":true,"do-case":"addToCart"};for(var _1f in _1e){if(typeof _1d[_1f]=="undefined"){_1d[_1f]=_1e[_1f];}}modalOverLay();$.post(BASE_URL+"/server.html",_1d,function(_20){document.location.href="/cart.html";modalOverLay();modal_message("Product added successfully.","&nbsp;",true,"250","30",false);});};function updateQuantity(pid,qty){};function deleteCartItem(pid){};function logOut(_21){if(_21=="fb"){FB.logout();}$.post(BASE_URL+"/server.html",{"do-action":"logout"},function(_22){});};function show_edit(_23,_24){$(".editBox").slideUp();$(".editable").slideDown();$("#"+_24).slideUp("fast");$("#"+_23).slideDown("fast");};function infotext(msg,_25){if($("#notification").length==0){str="<div id=\"notification\" style=\"display: none;\"> <span class=\"dismiss\"><a title=\"dismiss this notification\">x</a></span><div class=\"msgHolder\"><ul class=\"msg_displayer\"><li class=\""+_25+"\">"+msg+"</li></ul></div></div>";$("body").append(str);$("#notification").fadeIn("slow");}else{$(".msg_displayer").append("<li class=\""+_25+"\">"+msg+"</li>");$("#notification").fadeIn("slow");}};function proccess(_26,_27){switch(_26){case 1:$("#billForm").show();if(_27){var c=$("#billForm input[type='text'].required").size();var _28=false;for(i=0;i<c;i++){if($("#billForm input[type='text'].required").eq(i).val()==""){_28=true;$("#billForm input[type='text'].required").eq(i).addClass("error");}}if(!_28){modalOverLay();if(_27==true){var _29=$("#frmBilling").serialize();$.post("/server.html",_29,function(_2a){if(_2a=="ok"){$("#billForm").hide();$("#shippForm").show();}});}hideModalOverLay();processSlider(_26+1,false);}else{infotext("Full information needed for billing. Please fill all fields. ","error");}}else{}break;case 2:$("#billForm").hide();if(_27){var c=$("#frmShipping input[type='text']").size();var _28=false;for(i=0;i<c;i++){if($("#frmShipping input[type='text']").eq(i).val()==""){_28=true;$("#frmShipping input[type='text']").eq(i).addClass("error");}}if(!_28){var _2b=$("#frmShipping").serialize();$.post("/server.html",_2b,function(_2c){if(_2c=="ok"){$("#shippForm").hide();$("#InstructionForm").show();processSlider(_26+1,false);}});}else{infotext("Full information needed for Shipping. Please fill all fields. ","error");}}else{$("#shippForm").show();}break;case 3:$("#InstructionForm").show();if(_27){if($("#InstructionForm input[name='giftCard']:checked").length>0){var _2d=$("#frmInstruction").serialize();$.post("/server.html",_2d,function(_2e){if(_2e=="ok"){$("#InstructionForm").hide();}$("#DetailConfirmation").show();document.location.href=document.location.href;});}else{infotext("Please select a giftcard. ","warning");}}break;case 4:$("#DetailConfirmation").show();break;}};function processSlider(_2f,set){for(i=0;i<_2f;i++){$("#proccessSlider a").eq(i).addClass("active");}if(set){$.post("/server.html",{"do-case":"setcheckoutFlow",flow:_2f},function(_30){$("#proccessSlider a").eq(_2f).addClass("active");});}};
