function controlla(theForm)
{
if (theForm.nome.value == "")
  {
    alert("Inserire il proprio Nome, grazie.  ");
    theForm.nome.focus();
    return (false);
  }
if (theForm.email.value == "")
  {
    alert("Inserire 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("Inserire un'indirizzo E-mail valido, grazie.  ");
    theForm.email.focus();
    return (false);
  }
if (theForm.richiesta.selectedIndex < 1)
  {
    alert("Indicare la Richiesta, grazie.  ");
    theForm.richiesta.focus();
    return (false);
  }
if (theForm.richiesta.selectedIndex == 1 | theForm.richiesta.selectedIndex == 2)
  {
	if (theForm.giorno_arrivo.selectedIndex < 1)
  {
    alert("Indicare il Giorno di Arrivo, grazie.  ");
    theForm.giorno_arrivo.focus();
    return (false);
  }
   	if (theForm.mese_arrivo.selectedIndex < 1)
  {
    alert("Indicare il Mese di Arrivo, grazie.  ");
    theForm.mese_arrivo.focus();
    return (false);
  }
     if (theForm.anno_arrivo.selectedIndex < 1)
  {
    alert("Indicare l'Anno di Arrivo, grazie.  ");
    theForm.anno_arrivo.focus();
    return (false);
  }
	if (theForm.giorno_partenza.selectedIndex < 1)
  {
    alert("Indicare il Giorno di Partenza, grazie.  ");
    theForm.giorno_partenza.focus();
    return (false);
  }
	if (theForm.mese_partenza.selectedIndex < 1)
  {
    alert("Indicare il Mese di Partenza, grazie.  ");
    theForm.mese_partenza.focus();
    return (false);
  }
	if (theForm.anno_partenza.selectedIndex < 1)
  {
    alert("Indicare l'Anno di Partenza, grazie.  ");
    theForm.anno_partenza.focus();
    return (false);
  }  
  if (theForm.alloggio.selectedIndex < 1)
  {
    alert("Indicare la Tipologia di Alloggio, grazie.  ");
    theForm.alloggio.focus();
    return (false);
  }
  if (theForm.persone.selectedIndex < 1)
  {
    alert("Indicare il numero di Persone, grazie.  ");
    theForm.persone.focus();
    return (false);
  }
  
      if (theForm.anno_arrivo.selectedIndex > theForm.anno_partenza.selectedIndex)
  {
    alert("Attenzione! L'Anno di Partenza deve essere successivo a quello di Arrivo.  ");
    theForm.anno_partenza.focus();
    return (false);
  }

  if (theForm.mese_arrivo.value == theForm.mese_partenza.value)
  {
  if (theForm.giorno_arrivo.selectedIndex == theForm.giorno_partenza.selectedIndex)
  {
	  if (theForm.anno_arrivo.selectedIndex == theForm.anno_partenza.selectedIndex)
  {
  
    alert("Attenzione! Il Giorno di Arrivo e di Partenza non possono essere uguali.  ");
    theForm.giorno_partenza.focus();
    return (false);
  }
 }

    if (theForm.giorno_arrivo.selectedIndex > theForm.giorno_partenza.selectedIndex)
  {
		if (theForm.anno_arrivo.selectedIndex == theForm.anno_partenza.selectedIndex)
  {
    alert("Attenzione! Il Giorno di Partenza deve essere successivo a quello di Arrivo.  ");
    theForm.giorno_partenza.focus();
    return (false);
  }
 }
}
 
if (theForm.mese_arrivo.selectedIndex > theForm.mese_partenza.selectedIndex)
  {
    if (theForm.anno_arrivo.selectedIndex >= theForm.anno_partenza.selectedIndex)
  {
    alert("Attenzione! Il Mese di Partenza deve essere successivo a quello di Arrivo.  ");
    theForm.mese_partenza.focus();
    return (false);
  }
  }
}

if (theForm.richiesta.selectedIndex == 3)
  {
	if (theForm.note.value == "")
  {
    alert("Descrivere la propria Richiesta, grazie.  ");
    theForm.note.focus();
    return (false);
  }
}

return (true);
}