// JavaScript Document/*
/*
function controllaData(valore)
{
//ASSEGNO AD UNA VARIABILE IL CONTENUTO DEL CAMPO TESTO valore=document.mioForm.campo.value
//ESTRAGGO I VALORE RELATIVI A GIORNO,MESE,ANNO

var conta = valore;
numero=valore.substr(0,2)
numero1=valore.substr(3,2)
numero2=valore.substr(6,4)
//estraggo le posizioni relative agli slash
primoslash=valore.substr(2,1)
secondoslash=valore.substr(5,1)
//CALCOLO LA LUNGHEZZA DELLE VARIABILE CHE CONTENGONO I NUMERI
primalunghezza=numero.length
secondalunghezza=numero1.length
terzalunghezza=numero2.length
//alert(numero + numero1 + numero2);
//alert(isNaN(numero)&&isNaN(numero1)&&isNaN(numero2)&&(conta.length==10)&&(primalunghezza==2)&&(primoslash=="/")&&(numero>=1)&&(numero<=31)&&(secondalunghezza==2)&&(secondoslash=="/")&&(numero1>=1)&&(numero1<=12)&&(terzalunghezza==4)&&(numero2>=1800)&&(numero2<=3000))
if (isNaN(numero)&&isNaN(numero1)&&isNaN(numero2)&&(conta.length==10)&&(primalunghezza==2)&&(primoslash=="/")&&(numero>=1)&&(numero<=31)&&(secondalunghezza==2)&&(secondoslash=="/")&&(numero1>=1)&&(numero1<=12)&&(terzalunghezza==4)&&(numero2>=1800)&&(numero2<=3000))
{
	return false;
}
	else
{
	return true;
}

} 
*/
function controllaData(valore)
{
	var re = new RegExp("^([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})$", "");
	var dt = valore.match(re);
	 
	  if (!dt ||                      // formato non valido
		  dt[1] < 1 || dt[1] > 31 ||  // giorno non corretto
		  dt[2] < 1 || dt[2] > 12 ||  // mese non corretto
		  dt[3] < 4)                  // anno non corretto (minore del 2004)
		{
		  /*alert("La data inserita non č corretta.\nInserire la data nel formato GG/MM/AAAA");
		  Qform.data.focus();
		  Qform.data.select();*/
		  return(true);
		}
	
	// Abilita l'invio del FORM  
	return(false);
}


function checkform(){

var mess = "";
	if (document.preventivo.txtNome.value.length==0){mess = mess + "Hai dimenticato di inserire il nome\n";}
	if (isNaN(document.preventivo.txtImporto.value)){mess = mess + "L'importo richiesto deve essere numerico\n";}
	if (isNaN(document.preventivo.txtStipendioMensile.value)){mess = mess + "Lo stipendio richiesto deve essere numerico\n";}
	if (document.preventivo.data_ass.value.length>0){
		if (controllaData(document.preventivo.data_ass.value)){mess = mess + "La data di assunzione deve essere nel formato ggmmaaaa \n";}
	}else{
		mess = mess + "La data di assunzione deve essere compilata \n";
	}
	if (document.preventivo.txtCogNome.value.length==0){mess = mess + "Hai dimenticato di inserire il Cognome\n";}
	if (document.preventivo.txtIndirizzo.value.length==0){mess = mess + "Hai dimenticato di inserire l'indirizzo\n";}
	if (document.preventivo.txtCap.value.length==0){mess = mess + "Hai dimenticato di inserire il Cap\n";}
	if (document.preventivo.txtCitta.value.length==0){mess = mess + "Hai dimenticato di inserire la Cittā\n";}
	if (document.preventivo.txtTelefono.value.length==0){mess = mess + "Hai dimenticato di inserire il telefono\n";}
	if (document.preventivo.data_nascita.value.length>0){
		if (controllaData(document.preventivo.data_nascita.value)){mess = mess + "La data di nascita deve essere nel formato ggmmaaaa \n";}
	}else{
		mess = mess + "La data di nascita deve essere compilata \n";
	}
	if (document.preventivo.ddlProvincia.value==0){mess = mess + "Hai dimenticato di selezionare la Provincia\n";}
	if (document.preventivo.ddlFinanziamento.value==0){mess = mess + "Hai dimenticato di selezionare il tipo di finanziamento\n";}
	if (document.preventivo.ddlTipoLavoro.value==0){mess = mess + "Hai dimenticato di selezionare la tua tipologia contrattuale\n";}
	if ((document.preventivo.txtEmail.value.indexOf('@') == -1)||(document.preventivo.txtEmail.value.indexOf('.') == -1)){mess = mess + "Dovete inserire un indirizzo email valido\n";} 
	if (document.preventivo.txtImporto.value.length==0){mess = mess + "Hai dimenticato di inserire l'importo del finanziamento\n";}
	if (document.preventivo.txtStipendioMensile.value.length==0){mess = mess + "Hai dimenticato di inserire il tuo stipendio mensile\n";}
	//if (document.form1.txtImporto.value==0){mess = mess + "Hai dimenticato di inserire lo stipendio\n";}
	if (document.preventivo.accetto.checked==false){mess = mess + "Devi accettare l'Informativa sulla Privacy";}

if (mess!="") {alert(mess);return false;}

if (mess==""){document.preventivo.submit();}


}
function apri(url){
	over12list = window.open(url, 'info', 'toolbar=NO, scrollbars=yes, width=650, height=450');
}