function add_cart(a){a&&$.ajax({type:"POST",cache:!1,url:"/store/store_cart/add_product/"+a,success:function(){0==$(".store_cart").length?linkJS("/cart"):reloadCart(a)}})}
function reloadCart(a){0!=$(".store_cart").length&&(idBox=$(".store_cart").parent().attr("id"),idd=idBox.split("_"),id=idd[1].split("-"),$.ajax({type:"POST",cache:!1,url:"/store/store_cart/loadBoxCart/"+id[0],success:function(d){$("#store_AddCart_"+a).effect("transfer",{to:$(".store_cart"),className:"store_transfer"},500);setTimeout(function(){$("#"+idBox).replaceWith(d)},300)}}))}
function reloadPrice(){var a=$(".storePriceBundle:checked");prezzo=0;a.each(function(){prezzo+=parseInt($(this).attr("rel"))});$(".store_price").find("span").html(format_number(prezzo,2))}function reloadShippingPayments(a){void 0==a&&(a=0);nation=$("#store_nation").val();$("#store_shipping_payments").load("/store/store_cart/shipping_payments/"+a+"/0/"+nation+"/print")}
function reloadCoupon(){var a=$("#store_coupon").val();nation=$("#store_nation").val();$.ajax({type:"POST",cache:!1,data:"coupon="+a,url:"/store/store_cart/update_coupon/"+a,success:function(a){"error"==a?alert("Non valido"):linkJS("/cart")}})}
function updateCart(a,d){var c=$("#qty_"+a).val();nation=$("#store_nation").val();1==d?c++:-1==d&&c--;$.ajax({type:"POST",cache:!1,data:"qty="+c,url:"/store/store_cart/update_product/"+a,success:function(){$("#store_cart_row_"+a).effect("highlight");$("#center").load("/store/store_cart/index/0/true/0/0/"+nation);0!=$(".store_cart").length&&reloadCart()}})}
function deleteCart(a){nation=$("#store_nation").val();$.ajax({type:"POST",cache:!1,url:"/store/store_cart/delete_product/"+a,success:function(){$("#store_cart_row_"+a).effect("highlight");$("#center").load("/store/store_cart/index/0/true/0/0/"+nation)}})}function store_view_login(){$("#store_cart_order_form_login").show();$("#store_cart_order_form_registration").hide();$("#store_form_submit_send").hide()}
function store_view_registration(){$("#store_cart_order_form_login").hide();$("#store_cart_order_form_registration").toggle();$("#store_form_submit_send").show()}$(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 format_number(a,d){if(isNaN(a))return 0;if(""==a)return 0;var c=(new String(a)).split("."),e=parseFloat(c[0]),b="";1<c.length?(b=new String(c[1]),b=""+parseFloat(c[1])/Math.pow(10,b.length-d),b=""+(e+Math.round(parseFloat(b))/Math.pow(10,d)),c=b.indexOf("."),-1==c&&(b+=".",c=b.indexOf("."))):(b=new String(e),b+=".",c=b.indexOf("."));for(;b.length<=c+d;)b+="0";return b}function fontsize(a){"100%"==a?$("body").css("font-size","12px"):$("body").css("font-size",a)};
