function CheckForm(form)
{
	// Se non selezionato PV controllo input PV e Ruolo ( per adesso no )
	if (form.PV.value == 0)
	{
		alert("Selezionare un Punto Vendita");		
		return false;
	}	
	
	if (form.Nome.value == "")
	{
		alert("Compilare il campo Nome");
        form.Nome.focus();
        form.Nome.select();		
		return false;
	} 
	
	if (form.Cognome.value == "")
	{
		alert("Compilare il campo Cognome");
        form.Cognome.focus();
        form.Cognome.select();		
		return false;
	} 	
	
	if (form.DataN.value == "")
	{
		alert("Compilare il campo Data di nascita");
        form.DataN.focus();
        form.DataN.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.DataN.value;
		  //check to see if in correct format
		  if(!objRegExp.test(strValue))
		  {
		    alert("Data non corretta!\n Il formato corretto è gg/mm/aaaa");
        	form.DataN.focus();
		    form.DataN.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.DataN.focus();
		  form.DataN.select();			  
		  return false; //any other values, bad date
		  }
	}
	
	if (form.Indirizzo.value == "")
	{
		alert("Compilare il campo Indirizzo");
        form.Indirizzo.focus();
        form.Indirizzo.select();		
		return false;
	} 	
	
	if (form.Cap.value == "")
	{
		alert("Compilare il campo Cap");
        form.Cap.focus();
        form.Cap.select();		
		return false;
	} 	
		
	if (form.Citta.value == "")
	{
		alert("Compilare il campo Città");
        form.Citta.focus();
        form.Citta.select();		
		return false;
	} 		

	if (form.Prov.value == 0)
	{
		alert("Selezionare una Provincia");		
		return false;
	}		

	if (form.Telefono.value == "")
	{
		alert("Compilare il campo Telefono");
        form.Telefono.focus();
        form.Telefono.select();		
		return false;
	} 		
	
	if (form.Email.value == "")
	{
		alert("Compilare il campo Email");
        form.Email.focus();
        form.Email.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.Email.value))
		{
	    	alert("L' indirizzo email inserito non è valido!");
			return false;
		}	
	}

	// Verifico che il campo email di conferma sia uguale a quello digitato
	if (form.Email.value != form.CEmail.value)
	{
		alert("Conferma Email non valida!");
        form.CEmail.focus();
        form.CEmail.select();		
		return false;
	}	
	
	if (form.Messaggio.value == "")
	{
		alert("Compilare il campo Curriculum");
        form.Messaggio.focus();
        form.Messaggio.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;
	}	
	
	return true;
}

function CheckForm2(form)
{
	if (form.Nome.value == "")
	{
		alert("Compilare il campo Nome");
        form.Nome.focus();
        form.Nome.select();		
		return false;
	} 
	
	if (form.Cognome.value == "")
	{
		alert("Compilare il campo Cognome");
        form.Cognome.focus();
        form.Cognome.select();		
		return false;
	} 	

	if (form.DataN.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.DataN.value;
		  //check to see if in correct format
		  if(!objRegExp.test(strValue))
		  {
		    alert("Data non corretta!\n Il formato corretto è gg/mm/aaaa");
        	form.DataN.focus();
		    form.DataN.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.DataN.focus();
		  form.DataN.select();			  
		  return false; //any other values, bad date
		  }
	}
	
	if (form.Indirizzo.value == "")
	{
		alert("Compilare il campo Indirizzo");
        form.Indirizzo.focus();
        form.Indirizzo.select();		
		return false;
	} 	
	
	if (form.Cap.value == "")
	{
		alert("Compilare il campo Cap");
        form.Cap.focus();
        form.Cap.select();		
		return false;
	} 	
		
	if (form.Citta.value == "")
	{
		alert("Compilare il campo Città");
        form.Citta.focus();
        form.Citta.select();		
		return false;
	} 		

	if (form.Prov.value == 0)
	{
		alert("Selezionare una Provincia");			
		return false;
	}		

	if (form.Telefono.value == "")
	{
		alert("Compilare il campo Telefono");
        form.Telefono.focus();
        form.Telefono.select();		
		return false;
	} 		
	
	if (form.Email.value == "")
	{
		alert("Compilare il campo Email");
        form.Email.focus();
        form.Email.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.Email.value))
		{
	    	alert("L' indirizzo email inserito non è valido!");
			return false;
		}		
	}
	
	// Verifico che il campo email di conferma sia uguale a quello digitato
	if (form.Email.value != form.CEmail.value)
	{
		alert("Conferma Email non valida!");
        form.CEmail.focus();
        form.CEmail.select();		
		return false;
	}	
	
	if (form.Messaggio.value == "")
	{
		alert("Compilare il campo Messaggio");
        form.Messaggio.focus();
        form.Messaggio.select();		
		return false;
	} 	
	
	if (form.TipoMessaggio.value == 0)
	{
		alert("Selezionare il tipo di messaggio");		
		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;
	}
	return true;
}

function CheckForm3(form)
{
	if (form.Nome.value == "")
	{
		alert("Compilare il campo Nome");
        form.Nome.focus();
        form.Nome.select();		
		return false;
	} 
	
	if (form.Cognome.value == "")
	{
		alert("Compilare il campo Cognome");
        form.Cognome.focus();
        form.Cognome.select();		
		return false;
	} 	
	
	if (form.DataN.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.DataN.value;
		  //check to see if in correct format
		  if(!objRegExp.test(strValue))
		  {
		    alert("Data non corretta!\n Il formato corretto è gg/mm/aaaa");
        	form.DataN.focus();
		    form.DataN.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.DataN.focus();
		  form.DataN.select();			  
		  return false; //any other values, bad date
		  }
	}	
	
	if (form.Email.value == "")
	{
		alert("Compilare il campo Email");
        form.Email.focus();
        form.Email.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.Email.value))
		{
	    	alert("L' indirizzo email inserito non è valido!");
			return false;
		}		
	}
	
	// Verifico che il campo email di conferma sia uguale a quello digitato
	if (form.Email.value != form.CEmail.value)
	{
		alert("Conferma Email non valida!");
        form.CEmail.focus();
        form.CEmail.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;
	}
	else
	{
		if (form.Privacy[0].checked==false && form.Privacy[1].checked==true)
		{
			alert("Per la registrazione è necessario dare\r\nil consenso al trattamento dei dati personali.\r\nGrazie");
			return false;		
		}
	}
		
	return true;
}

function CheckForm4(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.Cellulare.value == "")
	{
		alert("Compilare il campo Cellulare");
        form.Cellulare.focus();
        form.Cellulare.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.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;
	//}
	//else
	//{
	//	if (form.Privacy[0].checked==false && form.Privacy[1].checked==true)
	//	{
	//		alert("Per la registrazione è necessario dare\r\nil consenso al trattamento dei dati personali.\r\nGrazie");
	//		return false;		
	//	}
	//}
		
	return true;
}


