function controlla(f) {

  var Cognome, Nome, Email, Via, Cap, Citta, Damese, Almese, Dagiorno, Algiorno;
  var numerotipo;

  Cognome=f.elements['cognome'].value;
  Nome=f.elements['nome'].value;
  Via=f.elements['via'].value;
  Cap=f.elements['cap'].value;
  Citta=f.elements['citta'].value;
  numerotipo=f.elements['tipo'].length;
  
Damese=f.elements['damese'].value;
Dagiorno=f.elements['dagiorno'].value;



Almese=f.elements['almese'].value;
Algiorno=f.elements['algiorno'].value;


  Email=f.elements['email'].value;
  
 
  if (Cognome=='') 
     {
       alert('Il Cognome è richiesto! \n Surname is required!');
       return false;
     }

  if (Nome=='') 
     {
       alert('Il Nome è richiesto! \n Name is required!');
       return false;
     }


  if (Via=='') 
     {
       alert('La via è richiesta! \n Address is required!');
       return false;
     }

  if (Cap=='') 
     {
       alert('Il cap è richiesto! \n Zip code is required!');
       return false;
     }

  if (Citta=='') 
     {
       alert('La citta/provincia è richiesta! \n Town is required!');
       return false;
     }
     
//inizio controllo email
	if ((Email.length<6)) {
      alert ('Email errata! Email error!')
      return false;
	}
	if (!((navigator.appName=='Netscape') && (navigator.appVersion.split(' ')[0]<5))) {
		result=Email.match(/^[\w_-]+(\.[\w_-]+)*@[\w_-]+(\.[\w_-]+)*\.[a-z]{2,4}$/)
		   if ((result==null) || (!(result[0].length==Email.length))) {
         		alert("Errore Email! Email error!");
         		return false;
       		}
	}
//Fine controllo email


  if (Damese>Almese) 
     {
        alert ('Mese di prenotazione/richiesta errato! \n Month of reservation information error!');
        return false;
     }
  
    
  if (Damese==Almese)
  	{
        if (Dagiorno > Algiorno)
           {         
             alert ('Data di prenotazione/richiesta errata! \n Date of reservation/information error!');
             return false;
           } 
   }

		var tipologiachecked;
		tipologiachecked=false;
		for (var scorri=0; scorri<numerotipo; scorri++) {

			if (f.elements['tipo'][scorri].checked) {
	   		tipologiachecked=true;
			}

		}

		if (!tipologiachecked) {
   			alert('Scegliere almeno una tipologia! \n Type of Typology is required!');
   			return false;
		}   
		 
if(!(Consenso=f.elements['consenso'].checked==true)){
  alert ('Necessario dare il consenso al trattamento dei dati!')
         return false;
      }

return true; 
}
