<!--

	var valuta="Euro IVA COMPRESA ";
var valuta2="L. ";
var exch= .000516457;
var SecVal= 0;
var sepmigl=".";
var sepdec=",";
var PutDec= 1;
var PutDec2= 0;

			
	function MettiPunti(prezzo) {
		var newprice='';
		var oldprice=prezzo+'s';
		var lung=oldprice.length-1;
		oldprice=oldprice.substring(0,lung);
		while (lung>3) {
			newprice=sepmigl+oldprice.substring(lung-3,lung)+newprice;
			oldprice=oldprice.substring(0,lung-3);
			lung=oldprice.length;  
		}
		newprice=oldprice+newprice;
		return (newprice);
	}
	
	function alterError(value) {
		if (PutDec !=0) {
			if (value<=0.99) {
				newPounds = '0';
			} else {
				newPounds = parseInt(value);
			}
			newPence = Math.round((value - newPounds)* 100);
			if (newPence == 100) {newPence =0; newPounds ++;}
			if (eval(newPence) <= 9) newPence='0'+newPence;
			newString = MettiPunti(newPounds);
			if (eval(newPence) != 0) {
				newString= newString + sepdec + newPence;
			}
			else {
				newString= newString + sepdec + '00';
			}
		}
		else {
			newPounds = Math.round(value);
			newString = MettiPunti(newPounds);
		}
		return (newString);
	}

function ScriviTotale() {
		
                index = document.cookie.indexOf("eDbasket");
		countbegin = (document.cookie.indexOf("=", index) + 1);
        	countend = document.cookie.indexOf(";", index);
        	if (countend == -1) {
            		countend = document.cookie.length;
        	}
		fulllist = document.cookie.substring(countbegin, countend);
		totprice = 0;
		totiva = 0;
		
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
				thisitem = 1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = fulllist.substring(itemstart, itemend);
				itemtotal = 0;
				itemtotal = (eval(theprice*thequantity));
				itemtotaliva = 0;
				itemtotaliva = (eval(ivaitem*thequantity));
				temptotal = itemtotal * 100;
				totprice = totprice + itemtotal;
				totiva = totiva + itemtotaliva;
				itemlist=itemlist+1;
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) option1 = fulllist.substring(itemstart, i);
				if (thisitem==3) option2 = fulllist.substring(itemstart, i);
				if (thisitem==4) option3 = fulllist.substring(itemstart, i);
				if (thisitem==5) pesoitem = fulllist.substring(itemstart, i);
				if (thisitem==6) theprice = fulllist.substring(itemstart, i);
				if (thisitem==7) ivaitem = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		}
		document.write(valuta+alterError(totprice));
	}

function ScriviIva() {
		
                index = document.cookie.indexOf("eDbasket");
		countbegin = (document.cookie.indexOf("=", index) + 1);
        	countend = document.cookie.indexOf(";", index);
        	if (countend == -1) {
            		countend = document.cookie.length;
        	}
		fulllist = document.cookie.substring(countbegin, countend);
		totprice = 0;
		totiva = 0;
		
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
				thisitem = 1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = fulllist.substring(itemstart, itemend);
				itemtotal = 0;
				itemtotal = (eval(theprice*thequantity));
				itemtotaliva = 0;
				itemtotaliva = (eval(ivaitem*thequantity));
				temptotal = itemtotal * 100;
				totprice = totprice + itemtotal;
				totiva = totiva + itemtotaliva;
				itemlist=itemlist+1;
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) option1 = fulllist.substring(itemstart, i);
				if (thisitem==3) option2 = fulllist.substring(itemstart, i);
				if (thisitem==4) option3 = fulllist.substring(itemstart, i);
				if (thisitem==5) pesoitem = fulllist.substring(itemstart, i);
				if (thisitem==6) theprice = fulllist.substring(itemstart, i);
				if (thisitem==7) ivaitem = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		}
		document.write(valuta+alterError(totiva));
	}	

function ScriviQuantita() {
		
                index = document.cookie.indexOf("eDbasket");
		countbegin = (document.cookie.indexOf("=", index) + 1);
        	countend = document.cookie.indexOf(";", index);
        	if (countend == -1) {
            		countend = document.cookie.length;
        	}
		fulllist = document.cookie.substring(countbegin, countend);
		totprice = 0;
		totiva = 0;
		totQuant = 0;

		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
				thisitem = 1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = fulllist.substring(itemstart, itemend);
				totQuant = totQuant + thequantity *1;
				itemtotal = 0;
				itemtotal = (eval(theprice*thequantity));
				itemtotaliva = 0;
				itemtotaliva = (eval(ivaitem*thequantity));
				temptotal = itemtotal * 100;
				totprice = totprice + itemtotal;
				totiva = totiva + itemtotaliva;
				itemlist=itemlist+1;
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) option1 = fulllist.substring(itemstart, i);
				if (thisitem==3) option2 = fulllist.substring(itemstart, i);
				if (thisitem==4) option3 = fulllist.substring(itemstart, i);
				if (thisitem==5) pesoitem = fulllist.substring(itemstart, i);
				if (thisitem==6) theprice = fulllist.substring(itemstart, i);
				if (thisitem==7) ivaitem = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		}
		document.write(totQuant);
	}	

//-->

