	//<script language="javascript">
	
	//funzione per controllare il campo vuoto
	function campoVuoto(campo,messaggio)
	{
		if(campo.value.trim() == ''){
			alert(messaggio);
			campo.focus();
			return (0);
		}
	}
	
	//funzione per controllare il valore con una regexp
	function campoRegExp(campo,exp,messaggio)
	{
		var reg = exp
		if(!reg.test(campo.value)){
			alert(messaggio);
			campo.focus();
			return (0);
		}
	}
	
	//funzione per controllare la selezione di una combo box
	function selectVuoto(campo,messaggio)
	{
		if(campo.value == "0"){
			alert(messaggio);
			campo.focus();
			return (0);
		}
	}
	
	//funzione per controllare la lunghezza di una textarea
	function maxChars(ogg,maxchars)
	{
		if (ogg.value.length > maxchars){
		  ogg.value=ogg.value.substr(0,maxchars);
		}
	}
	
	//funzione per il redirect temporizzato
	function redirect(url,secondi)
	{
		if(url!=''){
			if(secondi==''||isNaN(secondi)) secondi = 5;
			window.setTimeout("window.location='"+url+"'",secondi*1000);}
	}

	
	//caricamento di pagine con l'ewe
	var intervallo;
	var timeout;
	var xTim = 0;
	
	// funz per far comparire messaggio di caricamento
	function caricaEwe()
	{
		document.all.tabellaPrincipale.style.display = "none";
		intervallo = setInterval('incrementa(document.all.avviso)',90); // per incrementare i punti dopo la scritta
		var i = document.frm.length; // num dei campi del form
		var tempo = 600 * i; // tempo di ritardo prima di mostrare la tabelle del form 
		//alert(tempo);
		if (tempo > 4000) // se super ai 4 sec 
		{
			tempo = 4000;
		}
		timeout = setTimeout('mostraForm()',tempo); // avvia il timer
	}
	// funz per mostrare la tabelle del form e togliere la scritta
	function mostraForm()
	{
		clearInterval(intervallo);
		//clearTimeout(timeout);
		timeout = null;
		document.all.avviso.style.display = "none";
		document.all.tabellaPrincipale.style.display = "inline";
	}
	// funz per incrementare i punti dopo la scritta
	function incrementa(messaggio)
	{
		if(++xTim<=10) // se pił di 10 torna a capo
		{
			document.all.avviso.innerText = (messaggio.innerText+".");
		}
		else
		{
			document.all.avviso.innerText = "Caricamento in corso.";
			xTim=0;
		}
	}
	
	// random string
	function randomString(argLength) { 
		pool = new String("abcdefghijklmnopqrstuvwxyz123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); 
		var i = 0; 
		var passwd = " "; 

		while (i <= argLength) { 
			rand = parseFloat(Math.random()) * parseInt(pool.length); 
			passwd += pool.charAt(rand); 
			i++; 
		} 
		passwd = passwd.substring(1, 8); 
		return passwd 
	}

	//funzione per formattare il prezzo (3 decimali)
	function formattaPrezzo(thisone){
		var wd
		wd="w"
		var tempnum=thisone
			for (i=0;i<tempnum.length;i++){
				if (tempnum.charAt(i)=="."){
					wd="d"
					break
				}
			}
			if (wd=="w")
				return tempnum+".000"
			else{
				if (tempnum.charAt(tempnum.length-3)=="."){
					return tempnum+"0"
				}
				
				else{
					tempnum=Math.round(tempnum*1000)/1000;
					return tempnum;
				}
				
			}
	}

	//prezzo 2 decimali
	function formattaPrezzo2(thisone){
		var wd
		wd="w"
		var tempnum=thisone
			for (i=0;i<tempnum.length;i++){
				if (tempnum.charAt(i)=="."){
					wd="d"
					break
				}
			}
			if (wd=="w")
				return tempnum+".00"
			else{
				if (tempnum.charAt(tempnum.length-2)=="."){
					return tempnum+"0"
				}
				else{
					tempnum=Math.round(tempnum*100)/100
					return tempnum
				}
			}
	}	
	
	//trim di stringhe
	function stringTrim() 
	{
		return this.replace(/^\s+/, '').replace(/\s+$/, '');
	}
	
	String.prototype.trim = stringTrim;