<!--

	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 sped = 0;
	var totprice = 0;
	var numclick = 0;
	var pagok = 1;
	var spediva = 0;
	var totiva = 0;
	var valuta="Euro ";
var valuta2="L ";
var exch= .000516457;
var SecVal= 0;
var sepmigl=".";
var sepdec=",";
var PutDec= 1;
var PutDec2= 0;


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("eDcliente");
    	 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 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 MostraCarrello() {
       document.Ordine.Dettaglio.value = "nessun articolo";
       var sfondocarrello = '#F7F7F7';
		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;
		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="#C6D6DE"><TD><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' +"Item" +'</FONT></b></TD><TD><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + "Options" +'</FONT></b></TD><TD align="right"><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Quantity"+'</FONT></b></TD><TD align="right"><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Price"+'</FONT></b></TD><td align="right"><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Total price"+'</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 = fulllist.substring(itemstart, itemend);
				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;

				document.write('<tr BGCOLOR="'+sfondocarrello+'"> <td><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+theitem+'</FONT></td>');
				option123 = '';
				if (option1 != '') {
					option123 = '<sup>1</sup>&nbsp;' + option1;
				}
				if (option2 != '') {
					if (option123 != '') {
						option123 = option123 + '<BR>';
					}
					option123=option123 + '<sup>2</sup>&nbsp;' + option2;
				}
				if (option3 != '') {
					if (option123 != '') {
						option123 = option123 + '<BR>';
					}
					option123=option123 + '<sup>3</sup>&nbsp;' + option3;
				}
				document.write('<td><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+option123+'</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: " + theitem + "   ";
				DettagliOrd=DettagliOrd+"\nVarianti:";
				DettagliOrd=DettagliOrd+"\n   1) " + option1 + "   ";
				DettagliOrd=DettagliOrd+"\n   2) " + option2 + "   ";
				DettagliOrd=DettagliOrd+"\n   3) " + option3 + "   ";
				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+"Item: " + theitem + "   ";
				if (option123 != '') {
					RiepilogoCliente= RiepilogoCliente+"\nOptions:";
				}
				if (option1 != '') {
					RiepilogoCliente= RiepilogoCliente+"\n   - " + option1 + "   ";
				}
				if (option2 != '') {
					RiepilogoCliente= RiepilogoCliente+"\n   - " + option2 + "   ";
				}
				if (option3 != '') {
					RiepilogoCliente= RiepilogoCliente+"\n   - " + option3 + "   ";
				}
				RiepilogoCliente= RiepilogoCliente+"\n";
				RiepilogoCliente= RiepilogoCliente+"Quantity: " + thequantity+"\n";
				RiepilogoCliente= RiepilogoCliente+"Price:   " + valuta + alterError(eval(theprice))+"\n";
				RiepilogoCliente= RiepilogoCliente+"Total price:   " + valuta + alterError(itemtotal)+"\n";
				if (1 == 0) {
					RiepilogoCliente= RiepilogoCliente+"VAT:   " + valuta + alterError(itemtotaliva)+"\n";
				}
				RiepilogoCliente= RiepilogoCliente+"------------------------\n";
				document.Ordine.Dettaglio.value=DettagliOrd;

                                if (sfondocarrello == '#F7F7F7') {
                                  sfondocarrello = '#FFFFFF';
                                } else {
                                  sfondocarrello = '#F7F7F7';
                                }

			} 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;
			}
		}

       if (itemlist==0) {
			document.writeln('<TR BGCOLOR="#F7F7F7"><TD colspan="5"><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"(Your shopping cart is empty)"+'</FONT></TD></TR>');
		}
		document.writeln('<tr BGCOLOR="#C6D6DE"><td colspan=4><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>'+"Order Total"+'</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 = 0;
		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="#C6D6DE"><td colspan=4><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + "VAT" + '</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>' + "Shipping" + '</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>' + "Shipping VAT" + '</FONT></td><td align=right nowrap><INPUT type="text" name="TXivaspese" SIZE="'+lungtesto+'" value="'+valuta+testocasella+'" onFocus="document.Ordine.TXspese.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="#C6D6DE"><td colspan=4><b><FONT COLOR="#000000" FACE="Arial,Helvetica" SIZE=-1>' + "Total" + '</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="">');

	}

	function SpeseSpedizione(importo, codicespese) {
		impord1=new Array(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);
impord2=new Array(60,60,60,60,60,60,60,60,0,0,0,0,0,0,0,0);
impspese2=new Array(6.50,6.50,6.50,6.50,6.50,6.50,6.50,6.50,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);

		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);
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);
imppeso2=new Array(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);
imppeso3=new Array(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);
imppeso4=new Array(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);
imppeso5=new Array(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);
imppeso6=new Array(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);
imppeso7=new Array(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);
imppeso8=new Array(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);
imppeso9=new Array(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);
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);

		
		
		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='11111000';
var IvaOk='1000';
		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*4);
		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 = 0;
			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= "The following payment/shipping option:" + ' "' + msg1 + '" ' + "cannot be applied to orders coming from" + " " + msg2;
		msg = msg + "\n" + "Please select a different payment/shipping option";
		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 <  30) {
			window.alert("Minimum order amount (shipping not included) is" + " " + valuta + alterError( 30) + ": " + "your oder cannot be sent!");
			ok=0;
			return false;
		}
		if (document.Ordine.Maggiorenne.checked == false && obbl_magg == 1) {
			window.alert("You must be of legal age (18+) to place your order");
			ok = 0;
			return false;
		}

		if (obbl_tel == 1) {
			campo=document.Ordine.Telefono.value;
			if (campo.length < 4) {
				campoerrato="Telephone";
				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="City (State)";
			ok=0;
		}
		
		campo=document.Ordine.Cap.value;
		if (campo.length < 4) {
			campoerrato="Zip code";
			ok=0;
		}
		
		campo=document.Ordine.Indirizzo.value;
		if (campo.length < 8) {
			campoerrato="Address";
			ok=0;
		}
		
		if (obbl_piva == 1) {
			campo=document.Ordine.IVA_CF.value;
			if (campo.length < 2) {
				campoerrato="Vat number / Tax code";
				ok=0;
			}
		}

		if (obbl_rsoc == 1) {
			campo=document.Ordine.Ragione_Sociale.value;
			if (campo.length < 2) {
				campoerrato="Company";
				ok=0;
			}
		}

		campo=document.Ordine.Nome.value;
		if (campo.length < 2) {
			campoerrato="Name and surname";
			ok=0;
		}
		if (campo.indexOf("!") > -1) {
			campoerrato="Name and surname";
			ok=0;
		}
		if (campo.indexOf("=") > -1) {
			campoerrato="Name and surname";
			ok=0;
		}
		if (campo.indexOf(";") > -1) {
			campoerrato="Name and surname";
			ok=0;
		}

		if (ok == 0) {
			window.alert("" + " '" + campoerrato + "' " + "field has not been properly filled in" + ": " + "your oder cannot be sent!");
			return false;
		}
		else {
			codice=CodiceOrdine();
			SalvaDati();
			document.cookie = "eDris=; path=/";
			document.Ordine.Codice_Ordine.value=codice;
			document.Ordine.Dettaglio.value=DettagliOrd;
			RiepilogoCliente= RiepilogoCliente+"Shipping:   " + valuta + alterError(sped)+"\n";
			if (1 == 0) {
			RiepilogoCliente= RiepilogoCliente+"Shipping VAT:   " + valuta + alterError(spediva)+"\n";
			}
			RiepilogoCliente= RiepilogoCliente+"------------------------\n";
			RiepilogoCliente= RiepilogoCliente+"Total:   " + valuta + alterError(totprice + sped + totiva + spediva)+"\n";
			RiepilogoCliente= RiepilogoCliente+"------------------------\n";
			document.Ordine.Riepilogo.value=RiepilogoCliente;
			numclick=numclick+1;
			return true;
		}
	}
	
	function SvuotaDati() {
		document.cookie = "eDcliente=.";
		self.location = "order.htm";
	}

	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);
		if (document.Ordine.Memo.checked == true) {
			dati1 = "eDcliente=" + dati;
			dati1 = dati1 + "; expires=";
			dato = new Date(2010,12,31);
			dato = dato.toGMTString();
			dati1 = dati1 + dato + ";";
			document.cookie = dati1;
		}
		dati1 = "eDshipping=" + 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 CodiceOrdine() {
		risultato=Codice1();
		if (risultato=="" || risultato=="0") {
		   risultato = Codice2();
		}
		if (risultato=="" || risultato=="0") {
		   risultato = Codice3();
		}
		if (risultato=="" || risultato=="0") {
		   risultato = "G50000"; 
		}
		document.Ordine.Codice_Ordine.value=risultato;
		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("eDbasket");
		countbegin = (document.cookie.indexOf("=", index) + 1);
		countend = document.cookie.indexOf(";", index);
		if (countend == -1) {
			countend = document.cookie.length;
		}
		document.cookie="eDmodulo="+ document.cookie.substring(countbegin, countend) + "; path=/";
		document.cookie ="eDordine" + "=" + risultato + "!" + tipopag + "!" + importo + "!" + mailaddress + "!" + nomecliente + "; path=/";
		return risultato;
	}		

	function Codice1() {
	   simboli = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		base=35;
		vTime=new Date();
		risultato="";
		numero=vTime.getTime();
		while (numero >0) {
			  n1=numero/base;
			  n1=Math.floor(n1);
			  n2=n1*base;
			  n=numero-n2;
			  risultato = simboli.substring(n, n+1) + risultato;
			  numero=n1;
		}
		return risultato;
	}
	
	function Codice2() {
		simboli = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		base=35;
		risultato = "G5";
		for (numero = 1; numero <= 6; numero++) {
		   	n2 = Math.random();
		   	n1 = n2*(base - 1);
		   	n=Math.floor(n1);
		   	risultato = risultato + simboli.substring(n, n+1);
		}	   
		return risultato;
	}
	
	function Codice3() {
		simboli = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		caratteri="ZYXWVUTSRQPONMLKJIHGFEDCBA9876543210 ";
		base=35;
		risultato = "G8";
		varnome1=document.Ordine.Nome.value + "abc";
		varnome=varnome1.toUpperCase();
		vartotale1=document.Ordine.Totale_No_Spedizione.value;
		vartotale1=vartotale1 + "def";
		vartotale=vartotale1.toUpperCase();
		for (numero = 1; numero <= 3; numero++) {
			character=varnome.substring(numero - 1, numero);
		   	n2 = caratteri.indexOf(character);
		   	if (n2 > 35 || n2 < 0) {
		   		n2=1;
		   	}
		   	risultato = risultato + simboli.substring(n2, n2+1);
		   	character=vartotale.substring(numero - 1, numero);
		   	n2 = caratteri.indexOf(character);
		   	if (n2 > 35 || n2 < 0) {
		   		n2=1;
		   	}
			risultato = risultato + simboli.substring(n2, n2+1);
		}	   
		return risultato;
	}

//-->


