

	
	function Form_Validator(theForm)
	{
		
				if (theForm.nome.value.replace(/^\s+|\s+$/g,"") == "")
				{
					alert("Inserisci il Nome");
					theForm.nome.focus();
					return (false);
				}
			
				var fieldvalue2 = theForm.nome.value;
				if(fieldvalue2.length > 100)
				{
					alert("Troppi caratteri inseriti");
					theForm.nome.focus();
					return false;
				}
			
				if (theForm.cognome.value.replace(/^\s+|\s+$/g,"") == "")
				{
					alert("Inserisci il Cognome");
					theForm.cognome.focus();
					return (false);
				}
			
				var fieldvalue3 = theForm.cognome.value;
				if(fieldvalue3.length > 100)
				{
					alert("Troppi caratteri inseriti");
					theForm.cognome.focus();
					return false;
				}
				
				if (theForm.citta.value.replace(/^\s+|\s+$/g,"") == "")
				{
					alert("Inserisci la Città");
					theForm.citta.focus();
					return (false);
				}
			
				var fieldvalue4 = theForm.citta.value;
				if(fieldvalue4.length > 100)
				{
					alert("Troppi caratteri inseriti");
					theForm.citta.focus();
					return false;
				}
				
				if (theForm.email.value.replace(/^\s+|\s+$/g,"") == "")
				{
					alert("Inserisci Email");
					theForm.email.focus();
					return (false);
				}
			
				validationPattern = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
				if( theForm.email.value != "" &&
				   !validationPattern.test(theForm.email.value)) {
					alert("E-mail non valida");
					theForm.email.focus();
					return false;
				}
			
				var fieldvalue6 = theForm.email.value;
				if(fieldvalue6.length > 100)
				{
					alert("Troppi caratteri inseriti");
					theForm.email.focus();
					return false;
				}
				
				
					var fieldvalue7 = document.getElementById('laurea').options[document.getElementById('laurea').selectedIndex].text; 
					
					//theForm.laurea.options[document.getElementById("laurea").selectedIndex].value;
				if(fieldvalue7 == "")
				{
					alert("Inserisci il titolo di Studio");
					theForm.laurea.focus();
					return false;
				}		
				
				var fieldvalue5 = theForm.occupazione.options[document.getElementById("occupazione").selectedIndex].text;
				if(fieldvalue5 == "")
				{
					alert("Inserisci la tua Occupazione");
					theForm.occupazione.focus();
					return false;
				}
				
				
			
				
				
				var fieldvalue8 = theForm.master.options[document.getElementById("master").selectedIndex].text;
				if(fieldvalue8 == "")
				{
					alert("Inserisci il Master");
					theForm.master.focus();
					return false;
				}
				
			
				
				
				
							
							
			
				
			
			
				
				
				if(theForm.consenso.checked == false)
				{
					alert("E' necessario il tuo consenso al trattamento dei dati");
					theForm.consenso.focus();
					return false;
				}
				
			
		return true;
	}
	
	
	function cancella() {
	document.Form.nome.value ="";
	document.Form.cognome.value ="";
	document.Form.citta.value ="";
	document.Form.email.value ="";
	document.Form.tel.value ="";
	document.Form.newsletter.checked = false;
	document.Form.occupazione.value ="";
	document.Form.master.value ="";
	document.Form.laurea.value ="";
	document.Form.provenienza.value ="";
	document.Form.consenso.checked= false;
	
	}
	
