function check_form(theForm) {
	
if (theForm.cognome.value == "") {
    alert("Compilare il campo Cognome");
    theForm.cognome.focus();
    return (false);
  }
  

if (theForm.nome.value == "") {
    alert("Compilare il campo Nome");
    theForm.nome.focus();
    return (false);
  }
  
if (theForm.user.value == "") {
    alert("Compilare il campo User name");
    theForm.user.focus();
    return (false);
  }


if (theForm.pass1.value == "") {
    alert("Compilare il campo Password");
    theForm.pass1.focus();
    return (false);
  }
  
if (document.getElementById('pass1').value.length < 6 ) {
    alert("il campo Password deve essere lungo almeno 6 caratteri");
    theForm.pass1.focus();
    return (false);
  }
  
if (theForm.pass2.value == "") {
    alert("Compilare il campo Riscrivi la password");
    theForm.pass2.focus();
    return (false);
  }

if (document.getElementById('pass2').value.length < 6) {
    alert("il campo Riscrivi Password deve essere lungo almeno 6 caratteri");
    theForm.pass2.focus();
    return (false);
  }

if (theForm.pass1.value != theForm.pass2.value) {
    alert("I campi Password e Riscrivi password non corrispondono");
    theForm.pass2.focus();
    return (false);
  } 
  
if (theForm.nome_az.value == "") {
    alert("Compilare il campo Nome azienda");
    theForm.nome_az.focus();
    return (false);
  }
    
if (theForm.indirizzo.value == "") {
    alert("Compilare il campo Indirizzo");
    theForm.indirizzo.focus();
    return (false);
  }
  
if (theForm.citta.value == "") {
    alert("Compilare il campo Cittā");
    theForm.citta.focus();
    return (false);
  }

if (theForm.cap.value == "") {
    alert("Compilare il campo Cap");
    theForm.cap.focus();
    return (false);
  }
  
if (document.getElementById('cap').value.length < 5 ) {
    alert("Il campo Cap č composto di 5 cifre");
    theForm.cap.focus();
    return (false);
  }

if (isNaN(document.getElementById('cap').value)) {
    alert("il campo CAP richiede SOLO numeri");
    theForm.cap.focus();
    return (false);
  } 

if (theForm.tel_az.value == "") {
    alert("Compilare il campo Telefono aziendale");
    theForm.tel_az.focus();
    return (false);
  }
  
if (isNaN(document.getElementById('tel_az').value)) {
    alert("il campo Telefono aziendale richiede SOLO numeri");
    theForm.tel_az.focus();
    return (false);
  }
  
if (theForm.email.value == "") {
    alert("Compilare il campo E-mail");
    theForm.email.focus();
    return (false);
  }
  
if (theForm.email.value.length < 7) {
    alert("L'indirizzo e-mail deve contenere almeno 6 caratteri");
    theForm.email.focus();
    return (false);
  }
 
if (theForm.email.value.indexOf("@") == -1) {
    alert("l'indirizzo e-mail non contiene il carattere @");
    theForm.email.focus();
    return (false);
  }
 
if (theForm.email.value.indexOf(".") == -1) {
    alert("l'indirizzo e-mail non contiene estensioni");
    theForm.email.focus();
    return (false);
  }

    return (true);
}


function check_login(theForm) {
	
if (theForm.user.value == "") {
    document.getElementById('errore').innerHTML="Compilare il campo User";
    theForm.user.focus();
    return (false);
  }
  

if (theForm.password.value == "") {
    document.getElementById('errore').innerHTML="Compilare il campo Password";
    theForm.password.focus();
    return (false);
  }

    return (true);
}
