function check() {
var stato = true;
		//CAMPI OBBLIGATORI COPIARE QUESTE RIGHE
	
	if ((stato == true)&&(document.theform.nome.value == "")) {
		testo = "Campo nome obbligatorio";
		stato = false; 
		theform.nome.focus();    
	}
	
	if ((stato == true)&&(document.theform.cognome.value == "")) {
		testo = "Campo cognome obbligatorio";
		stato = false; 
		theform.cognome.focus();    
	}

	if ((stato == true)&&(document.theform.citta.value == "")) {
		testo = "Campo città obbligatorio";
		stato = false; 
		theform.citta.focus();    
	}
	
	
	if ((stato == true)&&(document.theform.email.value == "")) {
		testo = "Campo e-mail obbligatorio";
		stato = false; 
		theform.email.focus();    
	}

//privacy	
	if ((stato == true)&&(document.theform.privacy[1].checked)) {
		testo = "Per proseguire e' necessario\nacconsentire al trattamento dei dati\n(consenso privacy).";
		stato = false;     
	}
//privacy / fine
	
	//VALIDAZIONE E-MAIL
	if (theform.email.value!="")	{
		if ((theform.email.value.length<6)&&(stato==true)) {
			testo = "L'email inserita e' troppo corta.\n";
			stato = false;
			theform.email.focus();    	
		}
		if ((theform.email.value.indexOf('.')==-1)&&(stato==true)) {
			testo = "L'email inserita non e' valida.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email.focus();    	
		}
		if ((theform.email.value.indexOf('@')==-1)&&(stato==true)) {
			testo = "L'email inserita non e' valida.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email.focus();    	
		}
		if ((theform.email.value.indexOf('@')!=theform.email.value.lastIndexOf('@'))&&(stato==true)) {
			testo = "L'email inserita non e' valida.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email.focus();    	
		}
		if ((theform.email.value.indexOf(':')!=-1)&&(stato==true)) {
			testo = "L'email inserita non e' valida.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email.focus();    	
		}
		if ((theform.email.value.indexOf(' ')!=-1)&&(stato==true)) {
			testo = "L'email inserita non e' valida.\nNon utilizzare spazi.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email.focus();    	
		} 
	}
	
	
	if ((stato == true)&&(document.theform.telefono.value == "")) {
		testo = "Campo telefono obbligatorio";
		stato = false; 
		theform.telefono.focus();    
	}
	
	/*
	if ((stato == true)&&(document.theform.associazione.value == "")) {
		testo = "Campo iscritto all'associazione obbligatorio";
		stato = false; 
		theform.associazione.focus();    
	}
	*/
	
	if ((stato == true)&&(document.theform.login.value == "")) {
		testo = "Campo login obbligatorio";
		stato = false; 
		theform.login.focus();    
	}

	if ((stato == true)&&(document.theform.password.value == "")) {
		testo = "Campo password obbligatorio";
		stato = false; 
		theform.password.focus();    
	}
	
	if ((stato == true)&&(document.theform.password.value != document.theform.password2.value)) {
		testo = "La password è diversa";
		stato = false; 
		theform.password2.focus();    
	}
	
			//CONTROLLO CARATTERI VALIDI NEL LOGIN
	var valida = "0123456789qwertyuiopasdfghjklzxcvbnm_QWERTYUIOPASDFGHJKLZXCVBNM"; 	
		//aggiunggere il . o la ,
    var ok = "yes";
    var temp;

	for (var i=0; i<document.theform.login.value.length; i++) {
               temp = "" + document.theform.login.value.substring(i, i+1);
               if (valida.indexOf(temp) == "-1") ok = "no";
       }
               
      if (ok == "no") {
           testo = "Carattere non valido nel campo login, è possibile inserire solo caratteri alfanumerici e _.";
            document.theform.login.focus();     
			stato = false;
       }	
			
			//CONTROLLO CARATTERI VALIDI NEL password
	var valida = "0123456789qwertyuiopasdfghjklzxcvbnm_QWERTYUIOPASDFGHJKLZXCVBNM"; 	
		//aggiunggere il . o la ,
    var ok = "yes";
    var temp;

	for (var i=0; i<document.theform.password.value.length; i++) {
               temp = "" + document.theform.password.value.substring(i, i+1);
               if (valida.indexOf(temp) == "-1") ok = "no";
       }
               
      if (ok == "no") {
           testo = "Carattere non valido nel campo password, è possibile inserire solo caratteri alfanumerici e _.";
            document.theform.password.focus();     
			stato = false;
       }	
			
	
	/*
	if ((theform.login.value.indexOf(' ')!=-1)&&(stato==true)) {
			testo = "La USER ID inserita non e' valida.\nNon utilizzare spazi.\n";
			stato = false;
			theform.login.focus();    	
		} 
		
	if ((theform.password.value.indexOf(' ')!=-1)&&(stato==true)) {
			testo = "La password inserita non e' valida.\nNon utilizzare spazi.\n";
			stato = false;
			theform.password.focus();    	
		} 
		
	
	if ((stato == true)&&(document.theform.password.value == "")) {
		testo = "Campo password obbligatorio";
		stato = false; 
		theform.password.focus();    
	}
	*/
			/*/CONTROLLO NUMERI CAP
	var valida = "0123456789"; //aggiunggere il . o la ,
    var ok = "yes";
    var temp;

	for (var i=0; i<document.theform.cap.value.length; i++) {
               temp = "" + document.theform.cap.value.substring(i, i+1);
               if (valida.indexOf(temp) == "-1") ok = "no";
       }
               
      if (ok == "no") {
           testo = "Carattere non valido nel campo CAP, è possibile inserire solo numeri.";
            document.theform.cap.focus();     
			stato = false;
       }	
			//**************/
			


			
	

		
	if (stato == false){
		alert(" "+testo+" ")	}
		
		
		
return (stato)
}

