function addtocart(a){a.preventDefault();li_barcode=$(this).data("barcode");if(!li_barcode){var b=$(this).data("errorid");b=b?b:"errorelement";$("#"+b).html("Please select a size");$("#"+b).show();$("#"+b).hide();$("#"+b).show(300);setTimeout(function(){$("#"+b).hide(300)},2E3);return!1}""!=li_barcode&&(a={a:"add"},a.i=li_barcode,a.q=1,a.p=1,loadpopup("addedtocart","/process-cart",a,function(){}))}
function changeitem(a){a.preventDefault();a={a:"change"};a.i=$(".sizesel.active").data("barcode");a.k=$(this).data("key");a.q=$(".qty").val();$.get("/process-cart",a,function(a){$("#cartcontent").html(a).removeClass("loading")});liftcurtain()}function removecartitem(a){a.preventDefault();a={a:"remove"};a.i=$(this).data("key");$.get("/process-cart",a,function(a){$("#cartcontent").html(a).removeClass("loading")})}
function updatequantity(a){a.preventDefault();if(""===$(this).val())return!1;a={a:"update"};a.i=$(this).data("key");var b=$(this).val();isNaN(b)?a.q=1:a.q=b;$.get("/process-cart",a,function(a){$("#cartcontent").html(a).removeClass("loading")})}function applydiscountcode(a){a.preventDefault();a={a:"applydiscountcode"};a.i=$("input[name=discountcode]").val();$.get("/process-cart",a,function(a){$("#cartcontent").html(a).removeClass("loading")})}
function choosegiftwrapping(a){a.preventDefault();a={a:"choosegiftwrap"};a.c=$("input[name=giftwrapoption]").is(":checked")?"yes":"no";$.get("/process-cart",a,function(a){$("#cartcontent").html(a).removeClass("loading")})}$(document).on("click",".addtocart",addtocart);$(document).on("click",".removecartitem",removecartitem);$(document).on("click",".changeitem",changeitem);$(document).on("input",".updatequantity",updatequantity);$(document).on("click",".applydiscountcode",applydiscountcode);
$(document).on("click",".choosegiftwrapping",choosegiftwrapping);