function isDate (day,month,year)
	{
	   if (day == 0) return false;
	   if (month == 0) return false;
	   month -= 1;
	   var test = new Date(year,month,day);
	   if ( ((year == test.getYear()) || (year == 1900 + test.getYear()))&&
			(month == test.getMonth())&&
			(day == test.getDate()) )
		   return true;
	   else
		   return false
	}

		function Form_Validator(theForm)
	{
	
	  if (theForm.Contatto_Nome.value == "")
	  {
	    alert("Inserire un valore per il campo \"Cognome e Nome\".");
	    theForm.Contatto_Nome.focus();
	    return (false);
	  }
	
	  if (theForm.Contatto_Nome.value.length < 4)
	  {
	    alert("Inserire un \"Cognome e Nome\" valido.");
	    theForm.Contatto_Nome.focus();
	    return (false);
	  }
	
	  if (theForm.Contatto_Provincia.value == "")
	  {
	    alert("Inserire un valore per il campo \"Provincia\".");
	    theForm.Contatto_Provincia.focus();
	    return (false);
	  }
	  
	  if ((theForm.Contatto_Telefono.value == "") && (theForm.Contatto_PostaElettronica.value == ""))
	  {
	    alert("Inserire un numero di \"Telefono\" o un'indirizzo \"e-mail\".");
	    theForm.Contatto_Telefono.focus();
		tel="KO"
	    return (false);
	  }
	
	  if ((theForm.Contatto_Telefono.value.length < 6) && (theForm.Contatto_Telefono.value.length > 0))
	  {
	    alert("Inserire un numero di  \"Telefono\" valido (o non inserirlo).");
	    theForm.Contatto_Telefono.focus();
	    return (false);
	  }
	
	  if ((theForm.Contatto_PostaElettronica.value != "") && (theForm.Contatto_PostaElettronica.value.search("@") == -1))
	  {
		alert("Inserisci un indirizzo di \"posta elettronica\" valido (o non inserirlo).");
		theForm.Contatto_PostaElettronica.focus();
		return (false);
	  }
	
	  if ((theForm.Contatto_PostaElettronica.value != "") && (theForm.Contatto_PostaElettronica.value.search(/\./) == -1))
	  {
		alert("Inserisci un indirizzo di \"posta elettronica\" valido (o non inserirlo).");
		theForm.Contatto_PostaElettronica.focus();
		return (false);
	  }
	
	  if (theForm.Contatto_DataNascita_gg.value.length < 1)
	  {
	    alert("Inserire un valore per il campo \"Giorno di Nascita\".");
	    theForm.Contatto_DataNascita_gg.focus();
	    return (false);
	  }
	  
	  if (theForm.Contatto_DataNascita_mm.value.length < 1)
	  {
	    alert("Inserire un valore per il campo \"Mese di Nascita\".");
	    theForm.Contatto_DataNascita_mm.focus();
	    return (false);
	  }
	
	  if (theForm.Contatto_DataNascita_aaaa.value.length < 4)
	  {
	    alert("Inserire un valore per il campo \"Anno di Nascita\".");
	    theForm.Contatto_DataNascita_aaaa.focus();
	    return (false);
	  }
	  
	    // controllo la data di nascita
		 var g = theForm.Contatto_DataNascita_gg.value;
		 var m = theForm.Contatto_DataNascita_mm.value;
		 var a = theForm.Contatto_DataNascita_aaaa.value;
		 if (g == '08') g = 8;
		 if (g == '09') g = 9;
		 if (m == '08') m = 8;
		 if (m == '09') m = 9;
		 var g = parseInt(g);
		 var m = parseInt(m);
		 var a = parseInt(a);
		 if (isNaN(g) || isNaN(m) || isNaN(a)) errore = true;
		 //if (!isDate(g,m,a)) errore = true;
		 var errore = !isDate(g,m,a);
		 var ora = new Date;
		 if (errore) {
		  alert('Attenzione: la data di nascita non è stata inserita correttamente');
		  theForm.Contatto_DataNascita_aaaa.focus();
		  return false;
		 }
	  // fine controllo la data di nascita
	  
	  
	  if (theForm.Contatto_TitoloStudio[0].selected)
	  {
	    alert("Selezionare il \"titolo di studio\".");
	    theForm.Contatto_TitoloStudio.focus();
	    return (false);
	  }
	  
	  if (theForm.file1.value == "")
	  {
	    alert("Allegare il proprio \"c.v. (curriculum vitae)\".");
	    theForm.file1.focus();
	    return (false);
	  }
	  
	  if (!( (theForm.file1.value.substr( (theForm.file1.value.length-3) , 3) == "doc") || (theForm.file1.value.substr( (theForm.file1.value.length-3) , 3) == "pdf") || (theForm.file1.value.substr( (theForm.file1.value.length-3) , 3) == "rtf") ))
	  {
	    alert("Sono accettati solo file \".doc / .pdf /.rtf\".");
	    theForm.file1.focus();
	    return (false);
	  }
	
	 if (!(theForm.consensoDati[0].checked))
	  {
	    alert("Per poter inviare la cadidatura dovete \"Fonirci il consenso \" per il trattamento dei vostri dati.");
	    return (false);
		theForm.consensoDati[0].focus();
	  }  
	
	  return (true);

	  theForm.Invia.disabled = true;
	  theForm.Invia.value = 'attendere...';
	  return (true);
	}

	function ChangeTitolo(theForm)
	{
	
	  if (!((theForm.Contatto_TitoloStudio.value == "Diploma") || (theForm.Contatto_TitoloStudio.value == "Laurea")))
	  {
	    for(i=theForm.Contatto_Titolo.options.length-1;i>=0;i--){
	      theForm.Contatto_Titolo.options [i] = null;
	      }
		theForm.Contatto_Titolo.disabled = true;
	    return (false);
	  }
	
	  if (theForm.Contatto_TitoloStudio.value == "Diploma")
	  {
	    for(i=theForm.Contatto_Titolo.options.length-1;i>=0;i--){
	      theForm.Contatto_Titolo.options [i] = null;
	      }
	    theForm.Contatto_Titolo.disabled = false;
		theForm.Contatto_Titolo.length = 30;
		theForm.Contatto_Titolo.options[1].text = "Maturità Classica";
	    theForm.Contatto_Titolo.options[2].text = "Maturità Scientifica";
	    theForm.Contatto_Titolo.options[3].text = "Maturità Linguistica";
	    theForm.Contatto_Titolo.options[4].text = "Maturità Artisitica";
	    theForm.Contatto_Titolo.options[5].text = "Diploma Magistrale";
	    theForm.Contatto_Titolo.options[6].text = "Diploma Analista Contabile";
	    theForm.Contatto_Titolo.options[7].text = "Diploma Perito Elettr.";
	    theForm.Contatto_Titolo.options[8].text = "Diploma Perito Chimico";
	    theForm.Contatto_Titolo.options[9].text = "Diploma Perito Telec.";
	    theForm.Contatto_Titolo.options[10].text = "Diploma Perito Meccanico";
	    theForm.Contatto_Titolo.options[11].text = "Diploma Perito Aeronautico";
	    theForm.Contatto_Titolo.options[12].text = "Diploma Perito Radiotecnico";
	    theForm.Contatto_Titolo.options[13].text = "Diploma Perito Metallurgico";
	    theForm.Contatto_Titolo.options[14].text = "Diploma Perito Elettronico";
	    theForm.Contatto_Titolo.options[15].text = "Diploma Perito Elettromeccanico";
	    theForm.Contatto_Titolo.options[16].text = "Diploma Perito Agrario";
	    theForm.Contatto_Titolo.options[17].text = "Altro Perito";
	    theForm.Contatto_Titolo.options[18].text = "Diploma Tecnico Alim.";
	    theForm.Contatto_Titolo.options[19].text = "Diploma Perito Informatico";
	    theForm.Contatto_Titolo.options[20].text = "Diploma Ragioneria";
	    theForm.Contatto_Titolo.options[21].text = "Diploma Commercio Estero";
	    theForm.Contatto_Titolo.options[22].text = "Diploma Perito Aziendale";
	    theForm.Contatto_Titolo.options[23].text = "Tecnico Industrie Meccaniche";
	    theForm.Contatto_Titolo.options[24].text = "Tecnico Industria Chimica";
	    theForm.Contatto_Titolo.options[25].text = "Tecnico Industria Elettrica";
	    theForm.Contatto_Titolo.options[26].text = "Tecnico Gestione Aziendale";
	    theForm.Contatto_Titolo.options[27].text = "Geometra";
	    theForm.Contatto_Titolo.options[28].text = "Altro Diploma Tecnico";
	    theForm.Contatto_Titolo.options[29].text = "Altro Diploma";
	    return (false);
	  }
	
	  if (theForm.Contatto_TitoloStudio.value == "Laurea")
	  {
	    for(i=theForm.Contatto_Titolo.options.length-1;i>=0;i--){
	      theForm.Contatto_Titolo.options [i] = null;
	      }
	    theForm.Contatto_Titolo.disabled = false;
		theForm.Contatto_Titolo.length = 39;
	    theForm.Contatto_Titolo.options[1].text = "Diploma Universitario Area Economica";
	    theForm.Contatto_Titolo.options[2].text = "Diploma Universitario Area Ingegneria";
	    theForm.Contatto_Titolo.options[3].text = "Diploma Universitario Area Scientifico Tecnologica";
	    theForm.Contatto_Titolo.options[4].text = "Diploma Universitario Area Umanistica";
	    theForm.Contatto_Titolo.options[5].text = "Laurea in Economia e Commercio";
	    theForm.Contatto_Titolo.options[6].text = "Laurea  in Scienze Politiche";
	    theForm.Contatto_Titolo.options[7].text = "Laurea  in Scienze Statistiche";
	    theForm.Contatto_Titolo.options[8].text = "Laurea  in Matematica";
	    theForm.Contatto_Titolo.options[9].text = "Laurea  in Fisica";
	    theForm.Contatto_Titolo.options[10].text = "Laurea in Chimica";
	    theForm.Contatto_Titolo.options[11].text = "Laurea in Informatica";
	    theForm.Contatto_Titolo.options[12].text = "Laurea in Lettere e Filosofia";
	    theForm.Contatto_Titolo.options[13].text = "Laurea in Lingue";
	    theForm.Contatto_Titolo.options[14].text = "Laurea in Giurisprudenza";
	    theForm.Contatto_Titolo.options[15].text = "Laurea in Sociologia";
	    theForm.Contatto_Titolo.options[16].text = "Laurea in Biologia";
	    theForm.Contatto_Titolo.options[17].text = "Laurea in Scienze Agrarie";
	    theForm.Contatto_Titolo.options[18].text = "Laurea in Preparazioni Alimentari";
	    theForm.Contatto_Titolo.options[19].text = "Laurea in Ing. Civile Trasporti";
	    theForm.Contatto_Titolo.options[20].text = "Laurea in Ing. Nucleare";
	    theForm.Contatto_Titolo.options[21].text = "Laurea in Ing. Civile";
	    theForm.Contatto_Titolo.options[22].text = "Laurea in Ing. Meccanica";
	    theForm.Contatto_Titolo.options[23].text = "Laurea in Elettrotecnica";
	    theForm.Contatto_Titolo.options[24].text = "Laurea in Ing. Elettronica";
	    theForm.Contatto_Titolo.options[25].text = "Laurea in Ing. Chimica";
	    theForm.Contatto_Titolo.options[26].text = "Laurea in Ing. Aeronautica";
	    theForm.Contatto_Titolo.options[27].text = "Laurea in Ing. Gestionale";
	    theForm.Contatto_Titolo.options[28].text = "Altra Laurea Economica";
	    theForm.Contatto_Titolo.options[29].text = "Laurea Economia Aziendale";
	    theForm.Contatto_Titolo.options[30].text = "Laurea Economia Marittima e dei Trasporti";
	    theForm.Contatto_Titolo.options[31].text = "Altra Laurea Ingegneria";
	    theForm.Contatto_Titolo.options[32].text = "Laurea Ingegneria delle Telecomunicazioni";
	    theForm.Contatto_Titolo.options[33].text = "Laurea Ingegneria Informatica";
	    theForm.Contatto_Titolo.options[34].text = "Laurea Scienze dell'Informazione";
	    theForm.Contatto_Titolo.options[35].text = "Altra Laurea Umanistica";
	    theForm.Contatto_Titolo.options[36].text = "Laurea in Psicologia";
	    theForm.Contatto_Titolo.options[37].text = "Laurea in Scienze della Comunicazione";
	    theForm.Contatto_Titolo.options[38].text = "Altra Laurea";  
	    return (false);
	  }
	}
