function onObjPanierLoad(c){var d=$(c+"_table");d.observe("click",function(b){var a=b.findElement("td");if(a.getAttribute("name")=="delete"){if(confirm("Voulez vous vraiment supprimez cet article?")){params="action=3&idProd="+a.parentNode.getAttribute("datakey");var e=new Ajax.Request("OBJPanier.ajax",{method:"POST",postBody:params,onComplete:function(f){var h=f.responseJSON;a.parentNode.remove();updateTimbre(h.nbItem);updateTotal(d,c)}})}}})}function quantiteChange(h,e){var g=h.findElement("select");if(g.getAttribute("name")=="quantite"){params="action=4&idProd="+g.parentNode.parentNode.getAttribute("datakey")+"&quantite="+g.value;var a=new Ajax.Request("OBJPanier.ajax",{method:"POST",postBody:params,onComplete:function(c){var b=c.responseJSON;var f=h.findElement("tr");f.setAttribute("quantite",g.value);var d=parseFloat(f.getAttribute("pricevalue"))*parseInt(g.value);if($(e+"_"+f.getAttribute("datakey")+"_prix")){$(e+"_"+f.getAttribute("datakey")+"_prix").update(Math.round(d*100)/100)}updateTotal($(e+"_table"),e)}})}}function updateTimbre(b){if($("timbrePanier")){$("timbrePanier").update(b)}}function updateTotal(k,i){var h=k.down("tbody");var j=0;var l=0;for(var g=0;g<h.childNodes.length;g++){j=j+(parseFloat(h.childNodes[g].getAttribute("pricevalue"))*parseFloat(h.childNodes[g].getAttribute("quantite")));if(h.childNodes[g].getAttribute("tva")){l=l+(parseFloat(h.childNodes[g].getAttribute("tva"))*parseFloat(h.childNodes[g].getAttribute("quantite")))}}if($(i+"_tva")){$(i+"_tva").update(Math.round(l*100)/100);$(i+"_sstotal").update(Math.round(j*100)/100)}$(i+"_total").update(Math.round((j+l)*100)/100)};
