function formatPrice(t,e){var r=(t.toFixed(product.priceFormat.decimal)+" ").replace(".",product.priceFormat.separator)+product.priceFormat.symbol;return void 0===e||e<=t?r:""+(e.toFixed(product.priceFormat.decimal)+" ").replace(".",product.priceFormat.separator)+product.priceFormat.symbol+' '+r+""}function errorMsg(t,e){null!=t.data("timer")&&(window.clearTimeout(t.data("timer")),t.data("timer",null)),t.html(e).show(),t.data("timer",window.setTimeout(function(){t.fadeOut().data("timer",null)},2e3))}function cust(){product.error.cust&&delete product.error.cust;var t=$("#good_product_id");0=e.skus[t].degressivite.indexes[p][d]&&(u=d);if(null===u){o=null;break}o+=u*n,n*=e.skus[t].degressivite.indexes[p].length}if(null===o)throw{error:"degre"};c.unit_price=e.skus[t].degressivite.prices[o]*i*e.multi,c.degre_price=e.skus[t].degressivite.prices[o]}return c.max_price=Math.round(100*c.max_price)/100,c.unit_price=Math.round(100*c.unit_price)/100,c}function refreshComponentPrice(o,t,n,s,p,a){var u=null==o?product:product.skus[o],d=0,l=0;return $.each(t,function(t,e){var r=u.components[t],i={id:t,componentObject:r,obj:u,skuid:o,selected:!r.infos.optional||r.selected&&0t.unit_price?($(".reduc").show(),$(".max_price").text(formatPrice(t.max_price)),$(".reduc_price").text(formatPrice(t.max_price-t.unit_price)),$(".total_reduc_price").text(formatPrice((t.max_price-t.unit_price)*product.qty)),$(".reduc_percent").text((t.max_price-t.unit_price)/t.max_price*100)):$(".reduc").hide();var i=t.unit_price,c=0;product.componentsTree&&(i+=refreshComponentPrice(null,product.componentsTree,1,i,product.qty*product.packaging),product.id&&(i+=refreshComponentPrice(product.id,product.skus[product.id].componentsTree,1,i,product.qty*product.packaging))),$.each(product.fees,function(t,r){$.each(r.skus,function(t){if(r.var)var e=getPrice(t,r,product.qty,product.packaging);else e=getPrice(t,r,1,1);$("#f_"+t).parent().find("span.pr").html(formatPrice(e.degre_price,r.skus[t].maxPrice)),r.id==t&&(r.var?i+=e.unit_price:c+=e.unit_price)})}),$.each(product.options,function(t,r){$.each(r.skus,function(t){if(r.var)var e=getPrice(t,r,product.qty,product.packaging);else e=getPrice(t,r,1,1);$("#o_"+t).parent().find("span.pr").html(formatPrice(e.degre_price,r.skus[t].maxPrice)),r.selected&&r.id==t&&(r.var?i+=e.unit_price:c+=e.unit_price)})}),$.each(product.addcart,function(t,r){$.each(r.skus,function(t){var e=getPrice(t,r,r.qty,1);$("#a_"+t).parent().find("span.pr").html(formatPrice(e.degre_price,r.skus[t].maxPrice)),r.selected&&r.id==t&&(c+=e.unit_price*r.qty)})}),$(".total_unit_price").text(formatPrice(i)),$(".fix_add_price").text(formatPrice(c)),$(".total_price").text(formatPrice(i*product.qty+c));try{checkStock(),$(".ifOrderable").show(),$(".ifNotOrderable").hide(),$("body").triggerHandler("productRefreshOk")}catch(t){$(".ifOrderable").hide(),$(".ifNotOrderable").show(),$("body").triggerHandler("productRefreshStockError")}}}function quantityChange(){var t=parseInt($(this).val(),10);isNaN(t)||t<=0?(t=$(this).data("previous")?$(this).data("previous"):1,$(this).val(t)):$(this).data("previous",t),$(this).val(t),product.qty=t,$("body").triggerHandler("productChange")}function setMulti(t,e,r,i){if(t.multi=1,t.multipliers)for(var c=0;cproduct.skus[product.id].qty_max)throw{error:"qty_max",val:product.skus[product.id].qty_max};$.each(product.fees,function(t,e){check(e,{id:t,type:"fees"})}),$.each(product.options,function(t,e){e.selected&&check(e,{id:t,type:"options"})}),$.each(product.addcart,function(t,e){e.selected&&check(e,{id:t,type:"addcart"})})}function checkStock(){if(!product.skus[product.id].hors_stock){if(product.skus[product.id].qty<=0)throw{error:"hors_stock"};if(product.skus[product.id].qty