function Controllainput() {

errore = "";
Cognome = document.quest.Cognome.value;
Nome = document.quest.Nome.value;
Indirizzo = document.quest.Indirizzo.value;
Citta = document.quest.Citta.value;
email = document.quest.email.value;
telefono = document.quest.telefono.value;
//Numero_Copie = document.quest.Numero_Copie.value;

if (  (document.quest.LA_FORZA.value=="") && 
	  (document.quest.LA_LIBERTA_NELLE_PROFESSIONI_NELL_ARTE_NELL_IMPRESA.value=="") && 
	  (document.quest.CINA_NUOVE_VIE_PER_LE_PROFESSIONI.value=="") && 
	  (document.quest.LA_VITA_INTELLETTUALE_PROFESSIONI_ARTI_IMPRESA_IN_ITALIA_E_NEL_PIANETA.value=="") && 
	  (document.quest.LE_PROFESSIONI_L_IMPRESA_L_INGEGNO_LA_CULTURA_QUALE_INTEGRAZIONE_QUALE_AVVENIRE.value=="") ) {
	alert ("ATTENZIONE! Avete dimenticato di scegliere una Pubblicazione");
	return false;
}

if (Cognome == "") {errore += "\nIl cognome";}
if (Nome == "") {errore += "\nIl nome";}
if (Indirizzo == "") {errore += "\nL'indirizzo completo";}
if (Citta == "") {errore += "\nLa citta'";}
if (email == "") {errore += "\nL'indirizzo e-mail";}
if (telefono == "") {errore += "\nIl numero di telefono";}

Errore_email = check_email(document.quest.email.value);
if (Errore_email != "") {
    errore += "\n\nL'indirizzo E-MAIL non ט corretto:" + Errore_email + "\n";
}
if (errore != "") {alert ("ATTENZIONE! Avete dimenticato di inserire:\n" + errore);
    return false;
}

  var controllo=false;
  var Pagamento=true;
  for (i=0;i<2;i++)
			{
			(document.quest.Pagamento[i].checked)?Pagamento=false:null
			}
			if (Pagamento)
				{
				controllo=true;
				alert("ATTENZIONE! Avete dimenticato di selezionare la modalita' di pagamento");
				}
  
if (document.quest.Privacy.checked==false) {alert ("ATTENZIONE! Avete dimenticato di accettare l'informativa sulla Privacy");
	return false;
}

var mailtosplit = email;
var at = mail.indexOf("@");
mit1 = mail.slice(0, at-1);
dom = mail.slice(at+1, mail.length);
punto = dom.indexOf(".");
mit2 = dom.slice(0, punto-1);
mit3 = dom.slice(punto+1, dom.length);

document.quest.MIT1.value = mit1;
document.quest.MIT2.value = mit2;
document.quest.MIT3.value = mit3;

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
}
}
