function Controllainput() {
  errore = "";
  nome = document.Contact.Name.value;
  cognome = document.Contact.Surname.value;
  email = document.Contact.Email.value;
  messaggio = document.Contact.Message.value;
  if (nome == "") { errore += "\nName"; }
  if (cognome == "") { errore += "\nSurname"; }
  if (email == "") { errore += "\nEmail"; }
  if (messaggio == "") { errore += "\nMessage"; }
  //check email
  if (email != "") {Errore_email = check_email(document.Contact.Email.value);}
  if (Errore_email != "") { errore += "\n\nThe E-MAIL address is incorrect:" + Errore_email + "\n"; } 
  //check errore
  if (errore != "") {
    alert ("WARNING! You forgot to enter:\n" + errore);
    return false;
  }
  //check privacy
  if (document.Contact.Privacy.checked==false) {
    alert ("WARNING! You forgot to accept the privacy notice.");
	return false;
  }
function check_email(email) {
/*
LEGENDA DEGLI ERRORI:
1) La chiocciola e' presente: come primo o ultimo carattere o ne sono state digitate piu' di una;
2) L'e-mail contiene uno o piu' caratteri non ammessi contenuti nella variabile nochar;
3) Il punto e' presente: come primo, ultimo o penultimo carattere, prima o dopo la chiocciola;
4) Ci sono 2 punti (..) oppure due trattini (--) vicini;
5) Non c'e' nessun punto dopo la chiocciola
*/
var errors=""
var i
// Posizione della chiocciola.
var chiocPos=email.indexOf("@")
// Insieme dei caratteri non ammessi in un e-mail.
var nochar="\\/^,;:+אטלעש'<>()%=?!| " + '"'
// Prima lettera dell'e-mail.
var first_letter=email.substring(0,1)
// Ultima lettera dell'e-mail.
var last_letter=email.substring(email.length-1,email.length)
// Penultima lettera dell'e-mail.
var Penultima_letter=email.substring(email.length-2,email.length-1)
// Lettera a sinistra della chiocciola.
var sx_chioc=email.substring(chiocPos-1,chiocPos)
// Lettera a destra della chiocciola.
var dx_chioc=email.substring(chiocPos+1,chiocPos+2)
if ((chiocPos<"1") || (chiocPos==(email.length-1)) || (chiocPos!=(email.lastIndexOf("@")))) {
errors+="\n- The @ is missing or in the wrong place"
}
else {
  for (var i=0; i<=nochar.length-1; i++) {
    if (email.indexOf(nochar.substring(i,i+1))!="-1") {
     errors+="\n- You typed in inadmissible characters"
     break
    }
  }
}
if (errors=="") {
  if ((first_letter==".") || (sx_chioc==".") || (dx_chioc==".") || (last_letter==".") || (Penultima_letter==".") ) {
     errors+="\n- The dot (.) is in the wrong place"
  }  
  else {
    for (var i=0; i<=email.length-1; i++) {
      if ((email.substring(i,i+1)==".") && (email.substring(i+1,i+2)==".")) {
        errors+="\n- There are two dots (.) near each other"
        break
      }
      if ((email.substring(i,i+1)=="-") && (email.substring(i+1,i+2)=="-")) {
        errors+="\n- There are two dashes (-) near each other"
        break
      }
    }
  }
}
PuntoDopoChioc = 0
if (errors=="") {
  for (var i=chiocPos+1; i<=email.length-3; i++) {
    if (email.substring(i,i+1)==".") {
      PuntoDopoChioc = 1
      break
    }
  }
  if (PuntoDopoChioc == 0) {
    errors+="\n- You did not specify the domain (.it .com .net etc.)"
  }
}
return errors
}
}