function Controllainput() {
  errore = "";
  offri = document.quest.Prodotti_servizi_offerti.value;
  clientela = document.quest.Clientela.value;
  rag_soc = document.quest.Ragione_sociale.value;
  nome = document.quest.Nome_cognome.value;
  tel = document.quest.Telefono.value;
  email = document.quest.email.value;
  var controllo=false;
  var mercato=false;
  var budget=false;
  if (offri == "") { 
     errore += "\nProdotti e servizi offerti"; 
  }
  if (clientela == "") { 
     errore += "\nTipologia di clientela"; 
  }
  // Controllo CHECKBOX1
		for (i=1;i<5;i++)
			{
			if 	((mercato) || (document.quest["Tipologia_di_mercato"+i].checked)){mercato=true}
			}
		if (!mercato)
			{
			controllo=true;
			errore += "\nTipologia di mercato";
			}
// Fine Controllo CHECKBOX1
// Controllo CHECKBOX2
		for (i=1;i<7;i++)
			{
			if 	((budget) || (document.quest["Dove_investi"+i].checked)){budget=true}
			}
		if (!budget) {
			controllo=true;
			errore += "\nInvestimento del budget pubblicitario";
			}
		if ((document.quest.Dove_investi6.checked) && (document.quest.Investimento_in_altro.value == "")){
			controllo=true;
			errore += "\nAltri tipi di investimento del budget";
		}
// Fine Controllo CHECKBOX2
  if (rag_soc == "") { 
     errore += "\nRagione sociale"; 
  }
  if (nome == "") { 
     errore += "\nNome e cognome"; 
  }
  if (tel == "") { 
     errore += "\nNumero di telefono"; 
  }
  if (email == "") { 
     errore += "\nIndirizzo email"; 
  }

  if (errore != "") {
    alert ("ATTENZIONE! Avete dimenticato di inserire:\n" + errore);
    return false;
  }
  Errore_email = check_email(document.quest.email.value);
  if (Errore_email != "") {
    alert ("\nL'indirizzo E-MAIL non e' corretto:" + Errore_email + "\n");
	return false;
  }

// Fine Controllo CHECKBOX
  if (document.quest.privacy.checked==false) {
    alert ("ATTENZIONE! Avete dimenticato di accettare l'informativa sulla privacy");
	return false;
  }
function check_email(email) {
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- Carattere chiocciola (@) mancante o in posizione errata"
}
else {
  for (var i=0; i<=nochar.length-1; i++) {
    if (email.indexOf(nochar.substring(i,i+1))!="-1") {
     errors+="\n- Hai digitato dei caratteri non ammessi"
     break
    }
  }
}
if (errors=="") {
  if ((first_letter==".") || (sx_chioc==".") || (dx_chioc==".") || (last_letter==".") || (Penultima_letter==".") ) {
     errors+="\n- Il punto (.) e' in posizione errata"
  }  
  else {
    for (var i=0; i<=email.length-1; i++) {
      if ((email.substring(i,i+1)==".") && (email.substring(i+1,i+2)==".")) {
        errors+="\n- Ci sono due caratteri punto (.) vicini"
        break
      }
      if ((email.substring(i,i+1)=="-") && (email.substring(i+1,i+2)=="-")) {
        errors+="\n- Ci sono due caratteri trattino (-) vicini"
        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- Non hai indicato il dominio (.it .com .net ecc..)"
  }
}
return errors
}
}