 function trim(stringa){
    while (stringa.substring(0,1) == ' '){
        stringa = stringa.substring(1, stringa.length);
    }
    while (stringa.substring(stringa.length-1, stringa.length) == ' '){
        stringa = stringa.substring(0,stringa.length-1);
    }
    return stringa;
}
 
  function Modulo() {
     // Variabili associate ai campi del modulo
	 var email = trim(document.modulo.email.value);
	 var nome = document.modulo.nome.value;
	 var cognome = document.modulo.cognome.value;
	 var condizsi = document.modulo.condizsi.checked;


     // Espressione regolare dell'email
     var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
        //Effettua il controllo sul campo azienda

		if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
           alert("Inserire un indirizzo email corretto.");
		   document.modulo.email.focus();
           document.modulo.email.select();
           return false;
        }
		
		
   		  else  if ((nome == "") || (nome == "undefined")) {
           alert("Il campo Nome è obbligatorio.");
           document.modulo.nome.focus();
           return false;
        }
   
        //Effettua il controllo sul campo COGNOME
        else if ((cognome == "") || (cognome == "undefined")) {
           alert("Il campo Cognome è obbligatorio.");
           document.modulo.cognome.focus();
           return false;
        }
				
		 				
				
		 else if ((condizsi == false)) {
           alert("Attenzione! Per registrarsi ai servizi riservati dello Studio Olivieri e' necessario autorizzare la modalità di trattamento dei dati personali. Grazie");
         
           return false;
        }			
							

 
        //INVIA IL MODULOs
        else {
           document.modulo.action = "iscrizione-news-letter.asp";
           document.modulo.submit();
        }
  }
