function add_cart(id){if(id){$.ajax({type: "POST",cache: false,url: '/store/store_cart/add_product/'+id,success: function(data){if($(".store_cart").length == 0){linkJS("/cart");}else{reloadCart(id);}}});}}function reloadCart(idp){if($(".store_cart").length != 0){idBox = $(".store_cart").parent().attr("id");idd = idBox.split("_"); id= idd[1].split("-"); $.ajax({type: "POST",cache: false,url: '/store/store_cart/loadBoxCart/'+id[0],success: function(data){$('#store_AddCart_'+idp).effect('transfer', { to: $(".store_cart"), className: "store_transfer" }, 500);setTimeout(function() {$('#'+idBox).replaceWith(data); }, 300);}}); } }function reloadShippingPayments(ship,pay){if(ship==undefined)ship = 0;nation= $("#store_nation").val();$('#store_shipping_payments').load('/store/store_cart/shipping_payments/'+ship+'/0/'+nation+'/print');}function reloadCoupon(){ var coupon = $("#store_coupon").val();nation= $("#store_nation").val(); $.ajax({type: "POST",cache: false,data : "coupon="+coupon,url: '/store/store_cart/update_coupon/'+coupon,success: function(data){if(data == 'error') alert('Non valido');elselinkJS("/cart");}});}function updateCart(idp,num){ var qty = $("#qty_"+idp).val();nation= $("#store_nation").val();if(num==1){ qty++; }else if(num==-1){qty--; } $.ajax({type: "POST",cache: false,data : "qty="+qty,url: '/store/store_cart/update_product/'+idp,success: function(data){$("#store_cart_row_"+idp).effect('highlight');$("#center").load("/store/store_cart/index/0/true/0/0/"+nation);}});}function deleteCart(idp){nation= $("#store_nation").val();$.ajax({type: "POST",cache: false,url: '/store/store_cart/delete_product/'+idp,success: function(data){$("#store_cart_row_"+idp).effect('highlight');$("#center").load("/store/store_cart/index/0/true/0/0/"+nation);}});}$(document).ready(function() {$('.store_menu_category-parent').find('a:first').removeAttr('href').append('<span>+</span>');$(".store_menu_category-parent").click(function(){$(this).find('ul:first').show();});$('.store_menu_category-parent').bind({mouseenter: function() {$(this).find('span:first').show();},mouseleave: function() {$(this).find('span:first').hide();}});});function fontsize(size) {if(size == '100%'){$("body").css("font-size",'12px');}else{$("body").css("font-size",size);}}
