function format_curr(price) { var dec_sep=','; var tho_sep='.'; var tmp_price=Math.floor((price+0.0001)*100) + ''; var newprice=''; for (var g=tmp_price.length; g>0; g--) { if((tmp_price.length-g)==2) {newprice = dec_sep + newprice;} if((((tmp_price.length-g)-2) % 3) == 0 && (tmp_price.length-g)!=2) {newprice = tho_sep + newprice;} newprice = tmp_price.substr(g-1,1) + newprice; } if(newprice.length<=2) newprice='0'+dec_sep+newprice; if(newprice=='N.aN' || newprice=='N,aN') newprice='NaN'; return newprice; } function doCmdIFrame(operation,idprod,addquantity,defquantity,unit_prz,productname,codice,variant,idproductprice) { op=operation; var new_operation=''; if (typeof document.carrello.idorder!="undefined") order = document.carrello.idorder.value; else order=''; switch(operation){ case 'load': { callFrame(operation,order); timerID = setInterval(checkAction, 1000); break; } case 'insert': { callFrame(operation,order,'{'+idprod+'}','{'+addquantity+'}',unit_prz,escape(productname),variant,idproductprice); timerID = setInterval(checkAction, 1000); break; } case 'deleterow': { callFrame(operation,order,'{'+idprod+'}',0,0,0); timerID = setInterval(checkAction, 1000); break; } case 'update': { var itemlist = ''; var quantlist = ''; if(document.carrello.iditem.length!="undefined" || document.forms['carrello'].iditem.length!=0) { for(var w=0; w0) { sbbody.removeChild(sbbody.firstChild); } var contor=0; var id_item=iditem.split('¤'); var id_product=idproduct.split('¤'); var quant=quantity.split('¤'); var minquant=minquantity.split('¤'); var description=prodname.split('¤'); var code=codice.split('¤'); var unit_price=unitprice.split('¤'); var extra_price=extraprice.split('¤'); if(id_product.length>0) { for (var i=0; i