// JavaScript Document
// Verifica campi modulo di richiesta collaborazione

function controllo(theForm)
{

if (theForm.nome.value == "")
  {
    alert("Inserisci il tuo Nome, grazie.  ");
    theForm.nome.focus();
    return (false);
  }
  
if (theForm.cognome.value == "")
  {
    alert("Inserisci il tuo Cognome, grazie.  ");
    theForm.cognome.focus();
    return (false);
  }

if(theForm.sesso[0].checked == false && theForm.sesso[1].checked == false)
  {
	alert("Specificare il sesso, grazie.   ");
    theForm.sesso[0].focus();
    return (false);
}
  
if (theForm.anni.value == "")
  {
    alert("Inserisci la tua etą, grazie.  ");
    theForm.anni.focus();
    return (false);
  }
  
if (theForm.residenza.value == "")
  {
    alert("Inserisci il tuo luogo di residenza, grazie.  ");
    theForm.residenza.focus();
    return (false);
  }
  
if (theForm.prov.value == "0")
  {
    alert("Seleziona la provincia, grazie.  ");
    theForm.prov.focus();
    return (false);
  }
  
if (theForm.telefono.value == "")
  {
    alert("Inserisci il tuo numero di telefono, grazie.  ");
    theForm.telefono.focus();
    return (false);
  }
  
if (theForm.email.value == "")
  {
    alert("Inserisci l'indirizzo e-mail, grazie.  ");
    theForm.email.focus();
    return (false);
  }
var imail=theForm.email.value;
var poschioccia=imail.indexOf("@");
var pospunto=imail.lastIndexOf(".");
var len=imail.length;
if ((poschioccia < 2)||(pospunto<poschioccia+2)||(pospunto==len-1))
  {
    alert("Inserisci un'indirizzo e-mail valido, grazie.  ");
    theForm.email.focus();
    return (false);
  }
  
if (theForm.titolo.value == "")
  {
    alert("Inserisci il tuo titolo di studio, grazie.  ");
    theForm.titolo.focus();
    return (false);
  }

if (theForm.impiego.value == "")
  {
    alert("Inserisci le attivitą e/o i tuoi impieghi lavorativi svolti, grazie.  ");
    theForm.impiego.focus();
    return (false);
  }

if (theForm.progetto.value == "")
  {
    alert("Descrivi come intendi collaborare o in che modo essere impiegato, grazie.  ");
    theForm.progetto.focus();
    return (false);
  }

if (theForm.accetto[0].checked == false)
  {
    alert("E' indispensabile accettare il trattamento dei dati personali, grazie.  ");
    return (false);
  }

return (true);
}
