function clone() { //alert("clone start"); //alert( typeof document.getElementById("t0") + " t0"); //alert( typeof document.getElementById("t1") + " t1" ); document.getElementById("t1").style.visibility='hidden'; document.getElementById("t2").style.visibility='hidden'; document.getElementById("t3").style.visibility='hidden'; document.getElementById("t4").style.visibility='hidden'; document.getElementById("t5").style.visibility='hidden'; document.getElementById("t0").style.visibility='hidden'; //alert( typeof document.getElementById("t0") + " t0_1"); //alert( typeof document.getElementById("t1") + " t1_1" ); var sbbody = document.getElementById("sb_body"); //alert('sbbody1 '+sbbody); //alert('sbbody2 '+sbbody.childNodes.length); var tbody0 = document.getElementById("t0"); var tbody1 = document.getElementById("t1"); var tbody2 = document.getElementById("t2"); var tbody3 = document.getElementById("t3"); var tbody4 = document.getElementById("t4"); var tbody5 = document.getElementById("t5"); //alert( typeof document.getElementById("t0") + " t0_2"); //alert( typeof document.getElementById("t1") + " t1_2" ) tp=0; //alert(typeof document.getElementById("sb_body")); while (sbbody.childNodes.length>0) { 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('¤'); var w_s=well_service.split('¤'); if(id_product.length>0 && id_product[0]!="") { for (var i=0; i '; } tmpRegEx = new RegExp( '\\_unitprice\\_','g' ); tmpStr = tmpStr.replace(tmpRegEx, unit_price[i]) ; tmpRegEx = new RegExp( '\\_price\\_','g' ); tmpStr = tmpStr.replace(tmpRegEx, '€ '+ pr_scont + format_curr(Number(unit_price[i]))+''); tmpRegEx = new RegExp( '\\_totalprice\\_','g' ); tmpprice = Number(extra_price[i]) + (Number(quant[i])*Number(unit_price[i])); tmpStr = tmpStr.replace(tmpRegEx, '€ ' + format_curr(tmpprice)); tmpRegEx = new RegExp( '\\_quant\\_','g' ); tmpStr = tmpStr.replace(tmpRegEx, quant[i]) ; tmpRegEx = new RegExp( '\\_minquant\\_','g' ); tmpStr = tmpStr.replace(tmpRegEx, minquant[i]) ; tmpRegEx = new RegExp( '\\_iditem\\_','g' ); tmpStr = tmpStr.replace(tmpRegEx, id_item[i]) ; tmpRegEx = new RegExp( '\\_fieldmaxlength\\_','g' ); tmpStr = tmpStr.replace(tmpRegEx,2) ; sbbody.rows[q].cells[p].innerHTML = tmpStr; } } tp=tp+(Number(quant[i]) * Number(unit_price[i])) + Number(extra_price[i]); } else { var tmp_q='_fieldmaxlength_'; sbbody.innerHTML=sbbody.innerHTML.replace('_fieldmaxlength_',2); sbbody.innerHTML=sbbody.innerHTML.replace('_fieldmaxlength_',2); sbbody.innerHTML=sbbody.innerHTML.replace('_codice_',code[i]); sbbody.innerHTML=sbbody.innerHTML.replace('_codice_',code[i]); sbbody.innerHTML=sbbody.innerHTML.replace('_name_', description[i]); sbbody.innerHTML=sbbody.innerHTML.replace('_description_', decodeURI(description[i])); sbbody.innerHTML=sbbody.innerHTML.replace('_unitprice_',unit_price[i]); sbbody.innerHTML=sbbody.innerHTML.replace('_price_','€ ' + format_curr(Number(unit_price[i]))); tmpprice = Number(extra_price[i]) + (Number(quant[i])*Number(unit_price[i])); sbbody.innerHTML=sbbody.innerHTML.replace('_totalprice_','€ ' + format_curr(tmpprice)); sbbody.innerHTML=sbbody.innerHTML.replace('_quant_',quant[i]); sbbody.innerHTML=sbbody.innerHTML.replace('_quant_',quant[i]); sbbody.innerHTML=sbbody.innerHTML.replace('_minquant_',minquant[i]); sbbody.innerHTML=sbbody.innerHTML.replace('_iditem_',id_item[i]); sbbody.innerHTML=sbbody.innerHTML.replace('_iditem_',id_item[i]); tp=tp+(Number(quant[i]) * Number(unit_price[i])) + Number(extra_price[i]); } } if (typeof document.carrello.idorder!="undefined") { order = document.carrello.idorder.value; var tot_shipexp = document.getElementById("fulltotal"); tot_shipexp.innerHTML="€ "+format_curr(tp); } } //alert("clone end"); } 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; //alert(op); 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()', 3000); break; } case 'insert': { callFrame(operation,order,'{'+idprod+'}','{'+addquantity+'}',unit_prz,escape(productname),variant,idproductprice); timerID = setInterval('checkAction()', 3000); break; } case 'deleterow': { callFrame(operation,order,'{'+idprod+'}',0,0,0); timerID = setInterval('checkAction()', 3000); break; } case 'update': { var itemlist = ''; var quantlist = ''; if(document.carrello.iditem.length!="undefined" || document.forms['carrello'].iditem.length!=0) { for(var w=0; w