function CambioQuantita(obj) {	//alert(obj.value+" - "+obj.name);	// estraggo l'indice dal nome che  del tipo quantita_xx	arrTemp=obj.name.split("_"); 	NumeroRiga = arrTemp[1];	CalcolaTotaleRiga(obj.form,NumeroRiga);	CalcolaTotaleOrdine(obj.form);}function CalcolaTotaleRiga(FormObject,NumeroRiga) {	prezzo=eval("FormObject.prezzo_"+NumeroRiga+".value");	quantita=eval("FormObject.quantita_"+NumeroRiga+".value");		quantita=parseInt(quantita)?Math.abs(parseInt(quantita)):0;		if (quantita!=0) {		eval("FormObject.totale_"+NumeroRiga+".value=arrotonda(prezzo*quantita,3)");		eval("FormObject.quantita_"+NumeroRiga+".value=parseInt(quantita)");		} else {		eval("FormObject.totale_"+NumeroRiga+".value=''");		eval("FormObject.quantita_"+NumeroRiga+".value=''");			}}function CalcolaTotaleOrdine(FormObject) {	//alert("n:"+FormObject.numerorighe.value);	totale_imponibile=0;	totale_ordine=0;	totale_iva=0;	for (i=1;i<=FormObject.numerorighe.value;i++) {	// i valori sono riferiti alla riga		imponibile=eval("FormObject.imponibile_"+i+".value");		quantita=eval("FormObject.quantita_"+i+".value");		quantita=parseInt(quantita)?Math.abs(parseInt(quantita)):0;		aliquotaiva=eval("FormObject.aliquotaiva_"+i+".value");		prezzo=eval("FormObject.prezzo_"+i+".value"); //  quello ivato			eval("totale_imponibile+=imponibile*quantita");		eval("totale_iva+=(aliquotaiva/100)*imponibile*quantita");		eval("totale_ordine+=prezzo*quantita");	}	totale_imponibile=arrotonda(totale_imponibile,3);	totale_ordine=arrotonda(totale_ordine,3);	// Calcolo l'IVA come diferenza per evitare il problema dell'approssimazione con la somma calcolata	totale_iva=arrotonda(totale_ordine-totale_imponibile,3);	totale_spese=14.5;	totale_generale=tronca(totale_ordine+totale_spese,2);		FormObject.totale_imponibile.value=notazione(totale_imponibile);	FormObject.totale_iva.value=notazione(totale_iva);	FormObject.totale_ordine.value=notazione(totale_ordine);	FormObject.totale_spese.value=notazione(totale_spese);	FormObject.totale_generale.value=notazione(totale_generale);}function arrotonda(number,X) {// arrotondo number a X cifre decimali, defaults = 2    X = (!X ? 2 : X);    return Math.round(number*Math.pow(10,X))/Math.pow(10,X);}function tronca(number,X) {// tronca number a X cifre decimali, defaults = 2    X = (!X ? 2 : X);    return Math.floor(number*Math.pow(10,X))/Math.pow(10,X);}function notazione(number) {// formatta il numero con la , al posto del . secondo lo standard italiano    number=number+""; //trucco per convertire il numero a stringa    return number.replace(".",",");}function validaIntero(iString) {    // no leading 0s allowed    return (("" + parseInt(iString)) == iString);}function roundrecent(number) {if(!Number.prototype.toFixed) {  //alternative string parsing functionality or bail out}else {  y = x.toFixed(r);  // x is your number and r is number of places}}