<!--

	document.writeln('<style>');
	document.writeln('<!--');
	document.writeln('.txtbold {');
	document.writeln('text-align: right; font-family: Arial,Helvetica; font-weight: bold');
	document.writeln('}');
	document.writeln('.txtplain {');
	document.writeln('text-align: right; font-family: Arial,Helvetica; font-weight: plain');
	document.writeln('}');
	document.writeln('//-->');
	document.writeln('</style>');
	
	var DettagliOrd="";
	var RiepilogoCliente="\n------------------------\n";
	var ordinetot = 0;
	var totalquantity = 0;
	var sped = 0;
	var totprice = 0;
	var numclick = 0;
	var pagok = 1;
	var spediva = 0;
	var totiva = 0;
	var impsconto = 0;
	var impscontoiva = 0;

	var valuta="Euro ";
var valuta2="L ";
var exch= .000516457;
var SecVal= 0;
var sepmigl=".";
var sepdec=",";
var PutDec= 1;
var PutDec2= 0;
var scimp = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
var scperc = new Array( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);


	nc = "eDenter_basket";
	newItemList = "";
	

function GetCookie(name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
            var j = i + alen;
            if (document.cookie.substring(i, j) == arg)
                return GetCookieVal (j);
            i = document.cookie.indexOf(" ", i) + 1;
            if (i == 0) break; 
          }
        return null;
        }

    function GetCookieVal (offset) {
        var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1)
            endstr = document.cookie.length;
        return unescape(document.cookie.substring(offset, endstr));
        }
    
    function GetCookieInfo(pos) {
    	 var ordine=GetCookie("eDenter_cliente");
    	 if (ordine == null) {
    	 	return "";
    	 }
    	 else {
    	 	var n=0;
			var fine=-1;    	 	
    	 	while (n < pos) {
    	 		inizio=fine + 1;
    	 		n = n + 1;
    	 		fine=ordine.indexOf("!", inizio);
    	 		if (fine == -1) {
    	 			fine=ordine.length;
    	 		}
    	 	}
    	 	
    	 	ordine=ordine.substring(inizio, fine);
    	 	return unescape(ordine);
    	 }
    }
	
	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 ConvertiValuta2(value) {
		if (PutDec !=0) {
			value = Math.round(value * 100) / 100;
		}
		else {
			value = Math.round(value);
		}
		value2 = value / exch;
		if (PutDec2 !=0) {
			if (value2<=0.99) {
				newPounds = '0';
			} else {
				newPounds = parseInt(value2);
			}
			newPence = Math.round((value2 - 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(value2);
			newString = MettiPunti(newPounds);
		}
		return (newString);
	}

	function Arrotonda(value) {
		if (PutDec !=0) {
			arrvalue = Math.round(value * 100) / 100;
		}
		else {
			arrvalue = Math.round(value);
		}
		return (arrvalue);
	}

	function InterpretaCodice(testo) {
		if (testo != "") {
			testo = testo.replace("%5B","[");
			testo = testo.replace("%5D","]");
			testo = testo.replace("%7C","|");
			testo = testo.replace("%25","%");
			testo = testo.replace("%3F","?");
			testo = testo.replace("%23","#");
			testo = testo.replace("%3D","=");
			testo = testo.replace("%3C","<");
			testo = testo.replace("%3E",">");
			return (testo);
		}
		else {
			return ("");
		}
	}
	
	function MostraCarrello(l) {
	        document.Ordine.Dettaglio.value = "nessun articolo";
	        var sfondocarrello = '#FFFFFF';
		nc = "eDenter_basket" + l;
		index = document.cookie.indexOf(nc);
		countbegin = (document.cookie.indexOf("=", index) + 1);
        	countend = document.cookie.indexOf(";", index);
        	if (countend == -1) {
            		countend = document.cookie.length;
        	}
		if (index == -1) {
			countbegin = 0;
			countend = 0;
		}
		fulllist = document.cookie.substring(countbegin, countend);
		totprice = 0;
		totiva = 0;
		totpeso = 0;
		document.writeln('<INPUT TYPE="hidden" name="Spese_sped" value=0>');
		document.writeln('<TABLE WIDTH="100%" BORDER=0 CELLPADDING="2">');
		document.writeln('<TR BGCOLOR="#CECECE"><TD><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' +"Article" +'</FONT></b></TD><TD><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + "Variantes" +'</FONT></b></TD><TD align="right"><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Quantité"+'</FONT></b></TD><TD align="right"><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Prix unitaire"+'</FONT></b></TD><td align="right"><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Prix total"+'</FONT></b></td></TR>');
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
                        
			if (fulllist.substring(i,i+1) == '[') {
				thisitem = 1;
				itemstart = i+1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = unescape(fulllist.substring(itemstart, itemend));
				if (thequantity * 1>= scq2 && scq2 > -1) {
					theprice = theprice * imp2;
					ivaitem = ivaitem * imp2;
				} else if (thequantity * 1 >= scq1 && scq1 > -1) {
					theprice = theprice * imp1;
					ivaitem = ivaitem * imp1;
				}
				totalquantity = totalquantity + thequantity;
				itemtotal = 0;
				itemtotal = (eval(theprice*thequantity));
				itemtotaliva = 0;
				itemtotaliva = (eval(ivaitem*thequantity));
				itemtotalpeso = 0;
				itemtotalpeso = (eval(pesoitem*thequantity));
				temptotal = itemtotal * 100;
				totprice = totprice + itemtotal;
				totiva = totiva + itemtotaliva;
				totpeso = totpeso + itemtotalpeso;
				itemlist=itemlist+1;

				newItemList = newItemList + "[" + escape(theitem) + "|";
				newItemList = newItemList + escape(thecode) + "|";
				newItemList = newItemList + escape(codeitem) + "|";
				newItemList = newItemList + escape(artid) + "|";
				newItemList = newItemList + escape(option1) + "|";
				newItemList = newItemList + escape(option2) + "|";
				newItemList = newItemList + escape(option3) + "|";
				newItemList = newItemList + escape(option4) + "|";
				newItemList = newItemList + escape(theprice) + "|";
				newItemList = newItemList + escape(alq) + "|";
				newItemList = newItemList + escape(ivaitem) + "|";
				newItemList = newItemList + escape(itemtotal) + "|";
				newItemList = newItemList + escape(itemtotaliva) + "|";
				newItemList = newItemList + escape(thequantity) + "]";

				document.write('<tr BGCOLOR="'+sfondocarrello+'"> <td><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + thecode + ' ' + theitem+'</FONT></td>');
				option1234 = '';
				option1234 = '';
				if (option1 != '') {
					option1234 = option1;
				}
				if (option2 != '') {
					if (option1234 != '') {
						option1234 = option1234 + '<BR>';
					}
					option1234=option1234 + option2;
				}
				if (option3 != '') {
					if (option1234 != '') {
						option1234 = option1234 + '<BR>';
					}
					option1234=option1234 + option3;
				}
				if (option4 != '') {
					if (option1234 != '') {
						option1234 = option1234 + '<BR>';
					}
					option1234=option1234 + option4;
				}
				document.write('<td><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+option1234+'</FONT></td>');
				document.writeln('<td align=right><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+thequantity+'</FONT></td><td align=right><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+alterError(eval(theprice))+'</FONT></td><td align=right><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+alterError(itemtotal)+'</FONT></td></tr>');
				DettagliOrd=document.Ordine.Dettaglio.value;
				if (DettagliOrd=="nessun articolo") {
					DettagliOrd=" \n \n"
				}
				DettagliOrd=DettagliOrd+"Articolo: " + thecode + " " + theitem + "   ";
				if (option1234 != '') {
					DettagliOrd=DettagliOrd+"\nVarianti:";
					if (option1 != '') DettagliOrd=DettagliOrd+"\n   1) " + option1 + "   ";
					if (option2 != '') DettagliOrd=DettagliOrd+"\n   2) " + option2 + "   ";
					if (option3 != '') DettagliOrd=DettagliOrd+"\n   3) " + option3 + "   ";
					if (option4 != '') DettagliOrd=DettagliOrd+"\n   4) " + option4 + "   ";
				}
				DettagliOrd=DettagliOrd+"\n";
				DettagliOrd=DettagliOrd+"Quantità: " + thequantity+"\n";
				DettagliOrd=DettagliOrd+"Prezzo:   " + alterError(eval(theprice))+"\n";
				DettagliOrd=DettagliOrd+"Totale:   " + alterError(itemtotal)+"\n";
				DettagliOrd=DettagliOrd+"Iva:   " + alterError(itemtotaliva)+"\n------------------------\n";
				document.Ordine.Dettaglio.value=DettagliOrd;
				
				RiepilogoCliente=RiepilogoCliente+"Article: " + thecode + " " + theitem + "   ";
				if (option1234 != '') {
					RiepilogoCliente= RiepilogoCliente+"\nVariantes:";
				}
				if (option1 != '') {
					RiepilogoCliente= RiepilogoCliente+"\n   - " + option1 + "   ";
				}
				if (option2 != '') {
					RiepilogoCliente= RiepilogoCliente+"\n   - " + option2 + "   ";
				}
				if (option3 != '') {
					RiepilogoCliente= RiepilogoCliente+"\n   - " + option3 + "   ";
				}
				if (option4 != '') {
					RiepilogoCliente= RiepilogoCliente+"\n   - " + option4 + "   ";
				}
				RiepilogoCliente= RiepilogoCliente+"\n";
				RiepilogoCliente= RiepilogoCliente+"Quantité: " + thequantity+"\n";
				RiepilogoCliente= RiepilogoCliente+"Prix unitaire:   " + valuta + alterError(eval(theprice))+"\n";
				RiepilogoCliente= RiepilogoCliente+"Prix total:   " + valuta + alterError(itemtotal)+"\n";
				if (1 == 0) {
					RiepilogoCliente= RiepilogoCliente+"TVA:   " + valuta + alterError(itemtotaliva)+"\n";
				}
				RiepilogoCliente= RiepilogoCliente+"------------------------\n";
				document.Ordine.Dettaglio.value=DettagliOrd;

                                if (sfondocarrello == '#FFFFFF') {
                                  sfondocarrello = '#FFFFFF';
                                } else {
                                  sfondocarrello = '#FFFFFF';
                                }

			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = unescape(fulllist.substring(itemstart, i));
				if (thisitem==2) thecode = unescape(fulllist.substring(itemstart, i));
				if (thisitem==3) artid = unescape(fulllist.substring(itemstart, i));
				if (thisitem==4) option1 = unescape(fulllist.substring(itemstart, i));
				if (thisitem==5) option2 = unescape(fulllist.substring(itemstart, i));
				if (thisitem==6) option3 = unescape(fulllist.substring(itemstart, i));
				if (thisitem==7) option4 = unescape(fulllist.substring(itemstart, i));
				if (thisitem==8) pesoitem = unescape(fulllist.substring(itemstart, i));
				if (thisitem==9) theprice = unescape(fulllist.substring(itemstart, i));
				if (thisitem==10) ivaitem = unescape(fulllist.substring(itemstart, i));
				if (thisitem==11) codeitem= unescape(fulllist.substring(itemstart, i));
				if (thisitem==12) scq1 = unescape(fulllist.substring(itemstart, i));
				if (thisitem==13) imp1 = unescape(fulllist.substring(itemstart, i));
				if (thisitem==14) scq2 = unescape(fulllist.substring(itemstart, i));
				if (thisitem==15) imp2 = unescape(fulllist.substring(itemstart, i));
				if (thisitem==16) artlink = unescape(fulllist.substring(itemstart, i));
				if (thisitem==17) alq = unescape(fulllist.substring(itemstart, i));
				if (thisitem==18) acqid = unescape(fulllist.substring(itemstart +1, i -1));
				thisitem++;
				itemstart=i+1;
			}
		}

	       if (itemlist==0) {
			document.writeln('<TR BGCOLOR="#FFFFFF"><TD colspan="5"><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"(Votre panier est vide)"+'</FONT></TD></TR>');
		}
		document.writeln('<tr BGCOLOR="#CECECE"><td colspan=4><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Coût total"+'</FONT></b></td><td align=right nowrap><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+valuta+alterError(totprice)+'</FONT></b></td></tr>');

		scp = 1;
		if (scl > 0) {
			scp = 1 - scl;
			scp = Math.round(scp * 100) / 100;
		} else if (totprice * 1 > scimp[l] && scperc[l] * 1 < 1) {
			scp = scperc[l];
		}
		if (scp < 1) {
			newtotprice = totprice * scp;
			impsconto = totprice - newtotprice;
			totprice = newtotprice;
			newtotiva = totiva * scp;
			impscontoiva = totiva - newtotiva;
			totiva = newtotiva;
			

			DettagliOrd= DettagliOrd + "Sconto:" + '-' + alterError(impsconto) + "\n";
			DettagliOrd= DettagliOrd + "Sconto IVA:" + '-' + alterError(impscontoiva) + "\n";
			DettagliOrd= DettagliOrd + "------------------------\n";

			RiepilogoCliente= RiepilogoCliente + "Escompte:" + '-' +valuta + alterError(impsconto) + "\n";
			if (1 == 0) {
				RiepilogoCliente= RiepilogoCliente + "Escompte (TVA):" + '-' +valuta + alterError(impscontoiva) + "\n";
			}

			RiepilogoCliente= RiepilogoCliente+"------------------------\n";

			document.writeln('<tr BGCOLOR="#FFFFFF"><td colspan=4><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Escompte"+'</FONT></td><td align=right nowrap><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+ '-' +alterError(impsconto)+'</FONT></td></tr>');

			document.writeln('<tr BGCOLOR="#CECECE"><td colspan=4><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Total escompté"+'</FONT></b></td><td align=right nowrap><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+valuta+alterError(totprice)+'</FONT></b></td></tr>');

		}

		ivadapagare = totiva;
		

		ivadapagare = Arrotonda(ivadapagare);
		totiva = Arrotonda(totiva);
		document.Ordine.Totale_No_Spedizione.value=alterError(totprice);
		ordinetot = Math.ceil(totprice);
		supeso = 1;
		if (supeso == 0) {
			sped=SpeseSpedizione(totprice,1);
		}
		else {
			sped=SpeseSpedizionePeso(totpeso,1);
		}
		spediva=sped* 0
		

		spediva = Arrotonda(spediva);
		testocasella=alterError(totprice + sped + ivadapagare + spediva);
		lungtesto=testocasella.length + valuta.length + 2;
		if (1 == 0) {
			document.writeln('<tr BGCOLOR="#CECECE"><td colspan=4><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + "TVA" + '</FONT></b></td><td align=right nowrap><INPUT type="text" name="TXiva" SIZE="'+lungtesto+'" value="'+valuta+alterError(totiva)+'" onFocus="document.Ordine.TXiva.blur()" class="txtbold"></td></tr>');
		}
		testocasella=alterError(sped);
		document.writeln('<tr BGCOLOR="'+sfondocarrello+'"><td colspan=4><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + "Frais de port" + '</FONT></td><td align=right nowrap><INPUT type="text" name="TXspese" SIZE="'+lungtesto+'" value="'+valuta+testocasella+'" onFocus="document.Ordine.TXspese.blur()" class="txtplain"></td></tr>');

		if (1 == 0) {	
			testocasella=alterError(spediva);
			document.writeln('<tr BGCOLOR="'+sfondocarrello+'"><td colspan=4><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + "TVA Frais de port" + '</FONT></td><td align=right nowrap><INPUT type="text" name="TXivaspese" SIZE="'+lungtesto+'" value="'+valuta+testocasella+'" onFocus="document.Ordine.TXivaspese.blur()" class="txtplain"></td></tr>');
		}
		else {
			spediva=0;
		}
		document.Ordine.Spese_sped.value=alterError(sped);
		document.Ordine.Totale_Iva.value=alterError(totiva + spediva);
		document.Ordine.Totale_Ordine.value=alterError(totprice + sped + totiva + spediva);
		testocasella=alterError(totprice + sped + totiva + spediva);
		lungtesto=testocasella.length + valuta.length + 2;
		document.writeln('<tr BGCOLOR="#CECECE"><td colspan=4><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + "Montant" + '</FONT></b></td><td align=right nowrap><b><INPUT type="text" name="TXtotale" SIZE="'+lungtesto+'" value="'+valuta+testocasella+'" onFocus="document.Ordine.TXtotale.blur()" class="txtbold"></td></tr>');
		if (SecVal ==1) {
		testocasella=ConvertiValuta2(totprice + sped + totiva + spediva);
		document.writeln('<tr BGCOLOR="'+sfondocarrello+'"><td colspan=4 align=right><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1></FONT></td><td align=right nowrap><INPUT type="text" name="TXtotaleVal2" SIZE="'+lungtesto+'" value="('+valuta2+testocasella+')" onFocus="document.Ordine.TXtotaleVal2.blur()" class="txtplain"></td></tr>');
		}
		document.writeln('</TABLE>');
		document.writeln('<INPUT type="hidden" name="Riepilogo" value="">');
		document.writeln('<INPUT type="hidden" name="Process" value="">');
		document.writeln('<INPUT type="hidden" name="Orderdetails" value="">');

	}

	function SpeseSpedizione(importo, codicespese) {
		impord1=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspese1=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
impord2=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspese2=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
impspese3=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);


		if (importo>impord2[codicespese-1]) {
			return impspese3[codicespese-1];
		}
		else {
 			 if (importo>impord1[codicespese-1] && impord2[codicespese-1]) {
			 	return impspese2[codicespese-1];
			 }
			 else {
			 	  return impspese1[codicespese-1];
			 }
		}

	}
	
	function SpeseSpedizionePeso(peso, codicespese) {
		imppeso1=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp1=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
imppeso2=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp2=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
imppeso3=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp3=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
imppeso4=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp4=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
imppeso5=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp5=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
imppeso6=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp6=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
imppeso7=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp7=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
imppeso8=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp8=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
imppeso9=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
impspp9=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);
impspp10=new Array(0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);

		
		if (peso>imppeso9[codicespese-1]) {
			return impspp10[codicespese-1];
		}
		
		if (peso>imppeso8[codicespese-1]) {
			return impspp9[codicespese-1];
		}

		if (peso>imppeso7[codicespese-1]) {
			return impspp8[codicespese-1];
		}

		if (peso>imppeso6[codicespese-1]) {
			return impspp7[codicespese-1];
		}

		if (peso>imppeso5[codicespese-1]) {
			return impspp6[codicespese-1];
		}

		if (peso>imppeso4[codicespese-1]) {
			return impspp5[codicespese-1];
		}

		if (peso>imppeso3[codicespese-1]) {
			return impspp4[codicespese-1];
		}

		if (peso>imppeso2[codicespese-1]) {
			return impspp3[codicespese-1];
		}

		if (peso>imppeso1[codicespese-1]) {
			return impspp2[codicespese-1];
		}
		
		return impspp1[codicespese-1];

	}
	

	function SpedPaese() {
		
		var SpOk='10000000';
var IvaOk='10000000';
		selnum = document.Ordine.LSStato.selectedIndex ;
		selzona = document.Ordine.LSStato.options[selnum].value;
		document.Ordine.Stato.value=document.Ordine.LSStato.options[selnum].text;
		selpag = document.Ordine.Pagamento.selectedIndex ;
		tipospese=(selzona*1) + (selpag*8);
		msg = IvaOk.substring(selzona-1,selzona);
		if (msg == '1') {
			totiva = ivadapagare;
		}
		else {
			totiva = 0;
		}
		if (document.Ordine.TXiva) {
			document.Ordine.TXiva.value=valuta + alterError(totiva);
		}
		msg = SpOk.substring(tipospese-1,tipospese);
		if (msg == '1') {
			pagok = 1;
			supeso = 1;
			if (supeso == 0) {
				sped=SpeseSpedizione(totprice,tipospese);
			}
			else {
				sped=SpeseSpedizionePeso(totpeso,tipospese);
			}
			document.Ordine.TXspese.value=valuta + alterError(sped);
			msg = IvaOk.substring(selzona-1,selzona);
			if (msg == '1') {
				spediva = sped* 0;
				spediva = Arrotonda(spediva);
			}
			else {
				spediva = 0;
			}
			if (document.Ordine.TXivaspese) {
				document.Ordine.TXivaspese.value=valuta + alterError(spediva);
			}
			else {
				spediva = 0;
			}
			document.Ordine.TXtotale.value=valuta + alterError(sped + totprice + totiva + spediva);
			if (SecVal == 1) {
				document.Ordine.TXtotaleVal2.value=valuta2 + ConvertiValuta2(sped + totprice + totiva + spediva);
			}
		}
		else {
			pagok = 0;
			NoPag();
		}
	}
	
	function NoPag() {
		selnum = document.Ordine.LSStato.selectedIndex ;
		msg2 = document.Ordine.LSStato.options[selnum].text;
		selpag = document.Ordine.Pagamento.selectedIndex ;
		msg1 = document.Ordine.Pagamento.options[selpag].text;
		msg= "Ce mode de livraison/paiement" + ' "' + msg1 + '" ' + "ne s'applique pas aux expéditions vers" + " " + msg2;
		msg = msg + "\n" + "Pour passer la commande il faut entrer un autre mode de paiement/livraison";
		window.alert (msg);
	}
	
	function checkForm() {
		
		SpedPaese();
		var obbl_rsoc = 0;
		var obbl_piva = 0;
		var obbl_tel = 0;
		var obbl_magg = 1;
		//

		var ok = 1;
		var campoerrato = "nessuno";
		var campo="";
		if (numclick > 0) {
			ok=0;
			return false;
		}
		
		if (pagok == 0) {
			NoPag();
			ok=0;
			return false;
		}
	   	if (ordinetot <  0) {
			window.alert("Le minimum montant de la commande (hors du frais de port) est de" + " " + valuta + alterError( 0) + ": " + "la commande ne peut pas être envoyée!");
			ok=0;
			return false;
		}
		if (totalquantity <  1) {
			window.alert("Quantité minimale:" + " " +  1 + ": " + "la commande ne peut pas être envoyée!");
			ok=0;
			return false;
		}
		if (obbl_magg == 1 && document.Ordine.Maggiorenne.checked == false) {
			window.alert("Pour passer la commande il faut certifier d'être âgé de plus de 18 ans.");
			ok = 0;
			return false;
		}

		if (obbl_tel == 1) {
			campo=document.Ordine.Telefono.value;
			if (campo.length < 4) {
				campoerrato="Téléphone";
				ok=0;
			}
		}
		
		campo=document.Ordine.Email.value;
		if (campo.length < 8) {
			campoerrato="e-mail";
			ok=0;
		}
		if (campo.indexOf("@") < 1) {
			campoerrato="e-mail";
			ok=0;
		}
		if (campo.indexOf("!") > -1) {
			campoerrato="e-mail";
			ok=0;
		}
		if (campo.indexOf("=") > -1) {
			campoerrato="e-mail";
			ok=0;
		}
		if (campo.indexOf(";") > -1) {
			campoerrato="e-mail";
			ok=0;
		}
		if (campo.indexOf(".") < 1) {
			campoerrato="e-mail";
			ok=0;
		}
		
		campo=document.Ordine.Localita.value;
		if (campo.length < 2) {
			campoerrato="Ville";
			ok=0;
		}
		
		campo=document.Ordine.Cap.value;
		if (campo.length < 4) {
			campoerrato="Code postal";
			ok=0;
		}
		
		campo=document.Ordine.Indirizzo.value;
		if (campo.length < 8) {
			campoerrato="Adresse";
			ok=0;
		}
		
		if (obbl_piva == 1) {
			campo=document.Ordine.IVA_CF.value;
			if (campo.length < 2) {
				campoerrato="Numéro de TVA";
				ok=0;
			}
		}

		if (obbl_rsoc == 1) {
			campo=document.Ordine.Ragione_Sociale.value;
			if (campo.length < 2) {
				campoerrato="Société";
				ok=0;
			}
		}

		campo=document.Ordine.Nome.value;
		if (campo.length < 2) {
			campoerrato="Nom et prénom";
			ok=0;
		}
		if (campo.indexOf("!") > -1) {
			campoerrato="Nom et prénom";
			ok=0;
		}
		if (campo.indexOf("=") > -1) {
			campoerrato="Nom et prénom";
			ok=0;
		}
		if (campo.indexOf(";") > -1) {
			campoerrato="Nom et prénom";
			ok=0;
		}

		if (ok == 0) {
			window.alert("Le champ" + " '" + campoerrato + "' " + "n'à pas été saisi correctement" + ": " + "la commande ne peut pas être envoyée!");
			return false;
		}
		else {
			CompletaOrdine();
			SalvaDati();
			document.cookie = "eDenter_ris=_l2; path=/";
			document.Ordine.Dettaglio.value=DettagliOrd;
			RiepilogoCliente= RiepilogoCliente+"Frais de port:   " + valuta + alterError(sped)+"\n";
			if (1 == 0) {
			RiepilogoCliente= RiepilogoCliente+"TVA Frais de port:   " + valuta + alterError(spediva)+"\n";
			}
			RiepilogoCliente= RiepilogoCliente+"------------------------\n";
			RiepilogoCliente= RiepilogoCliente+"Montant:   " + valuta + alterError(totprice + sped + totiva + spediva)+"\n";
			RiepilogoCliente= RiepilogoCliente+"------------------------\n";
			document.Ordine.Riepilogo.value=RiepilogoCliente;
			document.Ordine.Process.value = newItemList;
			lordo = totprice + sped + totiva + spediva;
			newItemList = escape(totprice) + "|" + escape(totiva) + "|" + escape(sped) + "|" + escape(spediva) + "|" + escape(lordo) + "|" + escape(impsconto) + "|" + escape(impscontoiva);
			document.Ordine.Orderdetails.value = newItemList;
			numclick=numclick+1;
			return true;
		}
	}
	
	function SvuotaDati() {
		document.cookie = "eDenter_cliente=.";
		self.location = "order_l2.php";
	}

	function SalvaDati() {
		dato = document.Ordine.Nome.value;
		dati = escape(dato) + "!";
		dato = document.Ordine.Ragione_Sociale.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.IVA_CF.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Indirizzo.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Cap.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Localita.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Denominazione_spedizione.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Indirizzo_spedizione.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Cap_spedizione.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Localita_spedizione.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Stato.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Email.value;
		dati = dati + escape(dato) + "!";
		dato = document.Ordine.Telefono.value;
		dati = dati + escape(dato);
		dati1 = "eDenter_shipping=" + dati;
		dati1 = dati1 + "; path=/";
		document.cookie = dati1;
	}
	
	function CaricaDati() {
		SpedPaese();
		if (GetCookieInfo(1) == "" || GetCookieInfo(1) == ".") {
			return null;
		}
		else {
			document.Ordine.Nome.value = GetCookieInfo(1);
			document.Ordine.Ragione_Sociale.value = GetCookieInfo(2);
			document.Ordine.IVA_CF.value = GetCookieInfo(3);
			document.Ordine.Indirizzo.value = GetCookieInfo(4);
			document.Ordine.Cap.value = GetCookieInfo(5);
			document.Ordine.Localita.value = GetCookieInfo(6);
			document.Ordine.Denominazione_spedizione.value = GetCookieInfo(7);
			document.Ordine.Indirizzo_spedizione.value = GetCookieInfo(8);
			document.Ordine.Cap_spedizione.value = GetCookieInfo(9);
			document.Ordine.Localita_spedizione.value = GetCookieInfo(10);
			document.Ordine.Email.value = GetCookieInfo(12);
			document.Ordine.Telefono.value = GetCookieInfo(13);
			tStato = GetCookieInfo(11);
			for (nOpSt = 0; nOpSt < document.Ordine.LSStato.options.length; nOpSt++) {
				vStato=document.Ordine.LSStato.options[nOpSt].text
				if (vStato == tStato) {
					document.Ordine.LSStato.selectedIndex = nOpSt;
					document.Ordine.Stato.value= tStato;
					SpedPaese();
				}
			}
		}
	}

	function CompletaOrdine() {
		mailaddress=document.Ordine.Email.value;
		pagtext=document.Ordine.Pagamento.selectedIndex;
		nomecliente=document.Ordine.Nome.value;
		document.Ordine.Totale_No_Spedizione.value=alterError(totprice);
		document.Ordine.Spese_sped.value=alterError(sped);
		document.Ordine.Totale_Iva.value=alterError(totiva + spediva);
		document.Ordine.Totale_Ordine.value=alterError(totprice + sped + totiva + spediva);
		selnum = document.Ordine.LSStato.selectedIndex ;
		document.Ordine.Stato.value=document.Ordine.LSStato.options[selnum].text;

		tipopag="1";
		if (pagtext == 1) {
			tipopag="2";
		}
		if (pagtext == 2) {
			tipopag="3";
		}
		if (pagtext == 3) {
			tipopag="4";
		}
		importo=totprice + sped + totiva + spediva;
		importotemp=Math.round(importo * 100);
		importo=importotemp / 100;
		index = document.cookie.indexOf(nc);
		countbegin = (document.cookie.indexOf("=", index) + 1);
		countend = document.cookie.indexOf(";", index);
		if (countend == -1) {
			countend = document.cookie.length;
		}
		document.cookie="eDenter_modulo="+ document.cookie.substring(countbegin, countend) + "; path=/";
		document.cookie ="eDenter_ordine=" + "!" + tipopag + "!" + importo + "!" + mailaddress + "!" + nomecliente + "; path=/";
	}		


//-->


