// ====================================================================
//                      FUNZIONI DI VALIDAZIONE FORM
//                  copyright Antares di Sbrana Saverio
// ====================================================================

function checkFormContatti(elemento)
{	
	if(conSeVuoto(elemento.Nome))
	{
		erroreMsg("Inserire il nome",elemento.Nome)
		return false;
	}
	if(conSeVuoto(elemento.Cognome))
	{
		erroreMsg("Inserire il cognome",elemento.Cognome)
		return false;
	}
	if(conSeVuoto(elemento.Email))
	{
		erroreMsg("Inserire l'email",elemento.Email)
		return false;
	}
	if(conEmail(elemento.Email))
	{
		erroreMsg("Inserire l'email correttamente",elemento.Email)
		return false;
	}
	if(conSeVuoto(elemento.Messaggio))
	{
		erroreMsg("Inserire il messaggio",elemento.Messaggio)
		return false;
	}
	if(elemento.privacy[1].checked)
	{
		erroreMsg("E' necessario accettare la legge sulla privacy",elemento.privacy[1])
		return false;
	}	
	//inviaEmail();
	return true;
}


function checkFormProponi(elemento)
{	
	if(conSeVuoto(elemento.Nome))
	{
		erroreMsg("Inserire il nome",elemento.Nome)
		return false;
	}
	if(conSeVuoto(elemento.Cognome))
	{
		erroreMsg("Inserire il cognome",elemento.Cognome)
		return false;
	}
	if(conSeVuoto(elemento.Email))
	{
		erroreMsg("Inserire l'email",elemento.Email)
		return false;
	}
	if(conEmail(elemento.Email))
	{
		erroreMsg("Inserire l'email correttamente",elemento.Email)
		return false;
	}
	if(conSeVuoto(elemento.Superficie))
	{
		erroreMsg("Inserire la superficie in mq",elemento.Superficie)
		return false;
	}
	if(conSoloNumeri(elemento.Superficie))
	{
		erroreMsg("La superficie deve essere un numero",elemento.Superficie)
		return false;
	}
	if(conSeVuoto(elemento.Prezzo))
	{
		erroreMsg("Inserire il prezzo in euro",elemento.Prezzo)
		return false;
	}
	if(conSoloNumeri(elemento.Prezzo))
	{
		erroreMsg("Il prezzo deve essere un numero",elemento.Prezzo)
		return false;
	}
	if(conSeVuoto(elemento.Messaggio))
	{
		erroreMsg("Inserire il messaggio",elemento.Messaggio)
		return false;
	}
	if(elemento.privacy[1].checked)
	{
		erroreMsg("E' necessario accettare la legge sulla privacy",elemento.privacy[1])
		return false;
	}	
	//inviaEmail();
	return true;
}

function checkFormRichiesta(elemento)
{	
	if(conSeVuoto(elemento.Nome))
	{
		erroreMsg("Inserire il nome",elemento.Nome)
		return false;
	}
	if(conSeVuoto(elemento.Cognome))
	{
		erroreMsg("Inserire il cognome",elemento.Cognome)
		return false;
	}
	if(conSeVuoto(elemento.Email))
	{
		erroreMsg("Inserire l'email",elemento.Email)
		return false;
	}
	if(conEmail(elemento.Email))
	{
		erroreMsg("Inserire l'email correttamente",elemento.Email)
		return false;
	}
	if(elemento.privacy[1].checked)
	{
		erroreMsg("E' necessario accettare la legge sulla privacy",elemento.privacy[1])
		return false;
	}	
	//inviaEmail();
	return true;
}

function checkFormMutui(elemento)
{	
	if(conSeVuoto(elemento.Nome))
	{
		erroreMsg("Inserire il nome",elemento.Nome)
		return false;
	}
	if(conSeVuoto(elemento.Cognome))
	{
		erroreMsg("Inserire il cognome",elemento.Cognome)
		return false;
	}
	if(conSeVuoto(elemento.Email))
	{
		erroreMsg("Inserire l'email",elemento.Email)
		return false;
	}
	if(conEmail(elemento.Email))
	{
		erroreMsg("Inserire l'email correttamente",elemento.Email)
		return false;
	}
	if(conSeVuoto(elemento.Importo))
	{
		erroreMsg("Inserire l'importo",elemento.Importo)
		return false;
	}	
	if(conSoloNumeri(elemento.Importo))
	{
		erroreMsg("L'importo deve essere un numero",elemento.Importo)
		return false;
	}	
	if(conSoloNumeri(elemento.Valore_Acquisto_Immobile))
	{
		erroreMsg("Il valore acquisto immobile deve essere un numero",elemento.Valore_Acquisto_Immobile)
		return false;
	}	
	if(elemento.privacy[1].checked)
	{
		erroreMsg("E' necessario accettare la legge sulla privacy",elemento.privacy[1])
		return false;
	}	
	//inviaEmail();
	return true;
}


