function CheckForm(form)
{
	if (form.NomeUtente.value == "")
	{
		alert("Compilare il campo Nome");
        form.NomeUtente.focus();
        form.NomeUtente.select();		
		return false;
	} 
	
	if (form.CognomeUtente.value == "")
	{
		alert("Compilare il campo Cognome");
        form.CognomeUtente.focus();
        form.CognomeUtente.select();		
		return false;
	} 	
	
	if (form.DtNascitaUtente.value == "")
	{
		alert("Compilare il campo Data di nascita");
        form.DtNascitaUtente.focus();
        form.DtNascitaUtente.select();		
		return false;
	} 	
	else
	{
		/* Validazione campo data */
		/************************************************
		DESCRIPTION: Validates that a string contains only
		    valid dates with 2 digit month, 2 digit day,
		    4 digit year. Date separator can be ., -, or /.
		    Uses combination of regular expressions and
		    string parsing to validate date.
		    Ex. dd/mmm/yyyy or dd-mm-yyyy or dd.mm.yyyy
		
		PARAMETERS:
		   strValue - String to be tested for validity
		
		RETURNS:
		   True if valid, otherwise false.
		
		REMARKS:
		   Avoids some of the limitations of the Date.parse()
		   method such as the date separator character.
		*************************************************/
		  var objRegExp = /^\d{1,2}(\/)\d{1,2}\1\d{4}$/ ;
		  var strValue = form.DtNascitaUtente.value;
		  //check to see if in correct format
		  if(!objRegExp.test(strValue))
		  {
		    alert("Data non corretta!\n Il formato corretto č gg/mm/aaaa");
        	form.DtNascitaUtente.focus();
		    form.DtNascitaUtente.select();				
			return false; //doesn't match pattern, bad date
		  }
		  else
		  {
		  	var Passa = false;
		    var strSeparator = strValue.substring(2,3) ;
		    var arrayDate = strValue.split(strSeparator); 
		    //create a lookup for months not equal to Feb.
		    var arrayLookup = { '01' : 31,'03' : 31, 
		                        '04' : 30,'05' : 31,
		                        '06' : 30,'07' : 31,
		                        '08' : 31,'09' : 30,
		                        '10' : 31,'11' : 30,'12' : 31}
		    var intDay = parseInt(arrayDate[0],10); 
		
		    //check if month value and day value agree
		    if(arrayLookup[arrayDate[1]] != null) {
		      if(intDay <= arrayLookup[arrayDate[1]] && intDay != 0)
			  	Passa = true; //return true; found in lookup table, good date
		    }
		    
		    //check for February (bugfix 20050322)
		    //bugfix  for parseInt kevin
		    //bugfix  biss year  O.Jp Voutat
		    var intMonth = parseInt(arrayDate[1],10);
		    if (intMonth == 2) { 
		       var intYear = parseInt(arrayDate[2]);
		       if (intDay > 0 && intDay < 29) {
		           Passa = true ; // return true;
		       }
		       else if (intDay == 29) {
		         if ((intYear % 4 == 0) && (intYear % 100 != 0) || 
		             (intYear % 400 == 0)) {
		              Passa = true; // year div by 4 and ((not div by 100) or div by 400) ->ok return true;
		         }   
		       }
		    }
		  }  
		  
		  if(Passa != true )
		  {
		  alert("Data non corretta!\n Il formato corretto č gg/mm/aaaa");
       	  form.DtNascitaUtente.focus();
		  form.DtNascitaUtente.select();			  
		  return false; //any other values, bad date
		  }
	}
	
	if (form.LuogoNascita.value == "")
	{
		alert("Compilare il campo Luogo di nascita");
        form.LuogoNascita.focus();
        form.LuogoNascita.select();		
		return false;
	} 
	
	if (form.CFUtente.value == "")
	{
		alert("Compilare il campo Codice Fiscale");
        form.CFUtente.focus();
        form.CFUtente.select();		
		return false;
	}
	else
	{
		var LenCF ;
		LenCF = form.CFUtente.value;
		if(LenCF.length != 16 )
		{
			alert("Codice Fiscale non corretto.");
        	form.CFUtente.focus();
        	form.CFUtente.select();		
			return false;			
		}
	} 			
	
	if (form.EmailUtente.value == "")
	{
		alert("Compilare il campo Email");
        form.EmailUtente.focus();
        form.EmailUtente.select();		
		return false;
	} 		
	else
	{
		// Inserire validazione del campo email
		var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
		if (!espressione.test(form.EmailUtente.value))
		{
	    	alert("L' indirizzo email inserito non č valido!");
			return false;
		}	
	}

	// Verifico che il campo email di conferma sia uguale a quello digitato
	if (form.EmailUtente.value != form.CEmail.value)
	{
		alert("Conferma Email non valida!");
        form.CEmail.focus();
        form.CEmail.select();		
		return false;
	}	
	
	//if (form.NickName.value == "")
	//{
	//	alert("Compilare il campo Nickname");
    //    form.NickName.focus();
    //    form.NickName.select();		
	//	return false;
	//}

	if (form.CittaRes.value == "")
	{
		alert("Compilare il campo Cittā di Residenza");
        form.CittaRes.focus();
        form.CittaRes.select();		
		return false;
	}	
	
	if (form.Password.value == "")
	{
		alert("Compilare il campo Password");
        form.Password.focus();
        form.Password.select();		
		return false;
	}	
	
	if (form.Privacy[0].checked==false && form.Privacy[1].checked==false)
	{
		alert("Prima di continuare per favore clicca su una delle due caselle\r\nsul consenso della privacy.\r\nGrazie");
		return false;
	}	
	
	if (form.Regolamento[0].checked==false)
	{
		alert("Per procedere prendere visione del regolamento.\r\nGrazie");
		return false;
	}	
	
	return true;
}

function CheckForm2(form)
{
	if (form.Categoria.value == 0 ) 
	{
		alert("Selezionare una Categoria");
		return false;
	}
	
	if (form.SottoCategoria.value == 0 ) 
	{
		alert("Selezionare una Sotto Categoria");
		return false;
	}

	/* Controllo immissione categoria/sottocategoria */
	if(form.CntCatSub1.value == '99' && form.CntCatSub2.value == '99' && form.CntCatSub3.value == '99')
	{
		/* alert("TUTTO OK"); */
	}
	else
	{
		var ControlloInput ;
		ControlloInput = form.Categoria.value + form.SottoCategoria.value;
		if(form.CntCatSub1.value != '99')
		{
			if(form.CntCatSub1.value == ControlloInput )
			{
				alert("Attenzione\r\nCategoria e Sottocagoria\r\ngiā utilizzate");
				return false;
			}
		}
		
		if(form.CntCatSub2.value != '99')
		{
			if(form.CntCatSub2.value == ControlloInput )
			{
				alert("Attenzione\r\nCategoria e Sottocagoria\r\ngiā utilizzate");
				return false;
			}
		}
		
		if(form.CntCatSub3.value != '99')
		{
			if(form.CntCatSub3.value == ControlloInput )
			{
				alert("Attenzione\r\nCategoria e Sottocagoria\r\ngiā utilizzate");
				return false;
			}
		}				
	}	
	
	if (form.FILE1.value == "")
	{
		alert("Selezionare un file");
		return false;
	}	
		
	if (form.DataScatto.value != "")
	{
		/* Validazione campo data */
		/************************************************
		DESCRIPTION: Validates that a string contains only
		    valid dates with 2 digit month, 2 digit day,
		    4 digit year. Date separator can be ., -, or /.
		    Uses combination of regular expressions and
		    string parsing to validate date.
		    Ex. dd/mmm/yyyy or dd-mm-yyyy or dd.mm.yyyy
		
		PARAMETERS:
		   strValue - String to be tested for validity
		
		RETURNS:
		   True if valid, otherwise false.
		
		REMARKS:
		   Avoids some of the limitations of the Date.parse()
		   method such as the date separator character.
		*************************************************/
		  var objRegExp = /^\d{1,2}(\/)\d{1,2}\1\d{4}$/
		  var strValue = form.DataScatto.value;
		  //check to see if in correct format
		  if(!objRegExp.test(strValue))
		  {
		    alert("Data non corretta!\n Il formato corretto č gg/mm/aaaa");
        	form.DataScatto.focus();
		    form.DataScatto.select();				
			return false; //doesn't match pattern, bad date
		  }
		  else
		  {
		  	var Passa = false;
		    var strSeparator = strValue.substring(2,3) 
		    var arrayDate = strValue.split(strSeparator); 
		    //create a lookup for months not equal to Feb.
		    var arrayLookup = { '01' : 31,'03' : 31, 
		                        '04' : 30,'05' : 31,
		                        '06' : 30,'07' : 31,
		                        '08' : 31,'09' : 30,
		                        '10' : 31,'11' : 30,'12' : 31}
		    var intDay = parseInt(arrayDate[0],10); 
		
		    //check if month value and day value agree
		    if(arrayLookup[arrayDate[1]] != null) {
		      if(intDay <= arrayLookup[arrayDate[1]] && intDay != 0)
			  	Passa = true; //return true; found in lookup table, good date
		    }
		    
		    //check for February (bugfix 20050322)
		    //bugfix  for parseInt kevin
		    //bugfix  biss year  O.Jp Voutat
		    var intMonth = parseInt(arrayDate[1],10);
		    if (intMonth == 2) { 
		       var intYear = parseInt(arrayDate[2]);
		       if (intDay > 0 && intDay < 29) {
		           Passa = true ; // return true;
		       }
		       else if (intDay == 29) {
		         if ((intYear % 4 == 0) && (intYear % 100 != 0) || 
		             (intYear % 400 == 0)) {
		              Passa = true // year div by 4 and ((not div by 100) or div by 400) ->ok return true;
		         }   
		       }
		    }
		  }  
		  
		  if(Passa != true )
		  {
		  	alert("Data non corretta!\n Il formato corretto č gg/mm/aaaa");
       	  	form.DataScatto.focus();
		  	form.DataScatto.select();			  
		  	return false; //any other values, bad date
		  }
		  else
		  {	
		  	var DataControllo ;
			var DataImputata ;
			var Data_Array;
			DataControllo = new Date();
			DataImputata = form.DataScatto.value;
			Data_Array = DataImputata.split("/");
			DataImputata = Data_Array[1] + "/" + Data_Array[0] + "/" + Data_Array[2];
			DataImputata = new Date(DataImputata);
			if( DataImputata > DataControllo)
			{
		  		alert("Data non corretta!\n E' maggiore della data odierna.");
       	  		form.DataScatto.focus();
		  		form.DataScatto.select();			  
		  		return false; //any other values, bad date	
			}			
		  }
	}
	
	return true;
}
