function Controllainput() {

var errore=0;
var ret = true;
var campiValori = { 
	"arrivo":"dd/mm/yyyy",
	"partenza":"dd/mm/yyyy",
	"nome":"",
	"cognome":"",
	"telefono":"", 
	"email":"",
	"fax":""
};




for (var campo in campiValori) {
		d = document.getElementById(campo);
	if( (d.value == '') || (d.value == campiValori[campo]) ) {
		d.style.background = '#F0E68C';
		errore++;
	}else {
		d.style.background = '#fff';	
	}
}
		
Errore_email = check_email(document.quest.email.value);
  if (Errore_email != "") {
	errore++;
	alert ("ATTENTION! Wrong E-mail address:" + Errore_email);
} 


if (document.quest.Privacy.checked==false) {
	errore++;
	document.quest.Privacy.style.background = '#F0E68C';
    alert ("ATTENTION! You forgot to accept the Privacy policy");
  }
  
 if(errore > 0) ret = false;

return(ret); 

  
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
}
}