function check_case_new(){
	if(document.case_new.id_comune.selectedIndex==0){
		alert('Selezionare un Comune');
		return(false);
	}
	if(document.case_new.id_tipologia.selectedIndex==0){
		alert('Selezionare una Tipologia');
		return(false);
	}
	if(document.case_new.titolo.value.length<1){
		alert('Inserire un Titolo');
		return(false);
	}
	if(document.case_new.id_ubicazione.selectedIndex==0){
		alert('Inserire una Ubicazione');
		return(false);
	}
	if(document.case_new.stanze.selectedIndex==0){
		alert('Inserire numero di Stanze');
		return(false);
	}
}



function check_profilo(){
	if(document.profilo_form.nome.value.length<1){
		document.profilo_form.nome.focus();
		alert('Campo NOME richiesto');
		return(false);
	}
	if(document.profilo_form.cognome.value.length<1){
		document.profilo_form.cognome.focus();
		alert('Campo COGNOME richiesto');
		return(false);
	}
	if(document.profilo_form.recapito.value.length<1){
		document.profilo_form.recapito.focus();
		alert("Campo RECAPITO richiesto");
		return(false);
    }
	if(document.profilo_form.cognome.value.length<1){
		document.profilo_form.cognome.focus();
		alert('Campo COGNOME richiesto');
		return(false);
	}
	var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;	
	if (document.profilo_form.email.value.search(emailRegEx) == -1) {
		document.profilo_form.email.focus();
		alert("Campo E-MAIL richiesto");
		return(false);
    }
	if(document.profilo_form.telefono.value.length<1){
		document.profilo_form.telefono.focus();
		alert("Campo TELEFONO richiesto");
		return(false);
    }
	if(document.profilo_form.indirizzo.value.length<1){
		document.profilo_form.indirizzo.focus();
		alert("Campo INDIRIZZO richiesto");
		return(false);
    }
	if(document.profilo_form.citta.value.length<1){
		document.profilo_form.citta.focus();
		alert("Campo CITTA\' richiesto");
		return(false);
    }
	
	if(document.profilo_form.password.value.length<5){
		document.profilo_form.password.focus();
		alert("La PASSWORD deve essere lunga 5 caratteri almeno");
		return(false);
    }
	if(document.profilo_form.password.value.length>10){
		document.profilo_form.password.focus();
		alert("La PASSWORD deve essere lunga 10 caratteri massimo");
		return(false);
    }
	if(document.profilo_form.password2.value.length<5){
		document.profilo_form.password2.focus();
		alert("La password2 deve essere lunga 5 caratteri almeno");
		return(false);
    }
	if(document.profilo_form.password2.value.length>10){
		document.profilo_form.password2.focus();
		alert("La password2 deve essere lunga 10 caratteri massimo");
		return(false);
    }
	
	if(document.profilo_form.password.value != document.profilo_form.password2.value){
		document.profilo_form.password.focus();
		alert("Le PASSWORD devono coincidere");
		return(false);
    }
	
}






function check_tariffa(){
	if(document.tariffa_form.dal.value.length<1){
		document.tariffa_form.dal.focus();
		alert('Inserire data Inizio periodo');
		return(false);
	}
	if(document.tariffa_form.al.value.length<1){
		document.tariffa_form.al.focus();
		alert('Inserire data Fine periodo');
		return(false);
	}if( (document.tariffa_form.giorno.value.length<1) && (document.tariffa_form.weekend.value.length<1) && (document.tariffa_form.settimana.value.length<1) && (document.tariffa_form.mese.value.length<1) ){
		alert('Inserire almento una tariffa');
		return(false);
	}
}
