//validazione contatto inglese
function validazione_con_en(){
with(document.contatto) {
	

	if(nome.value=="") {
	alert("Insert name");
	nome.focus();
	return false;
	}
	
	if(cognome.value=="") {
	alert("Insert surname");
	cognome.focus();
	return false;
	}
	
	if(mail.value=="") {
	alert("Insert e-mail");
	mail.focus();
	return false;
	}
	var stato=true;
	if(mail.value.indexOf(" ")!=-1) {
	mail.focus();
	stato=false;
	}
	var chiocciola=mail.value.indexOf("@");
	if(chiocciola<2) {
	mail.focus();
	stato=false;
	}
	var punto=mail.value.indexOf(".", chiocciola);
	if(punto<chiocciola+3) {
	mail.focus();
	stato=false;
	}
	var lung=mail.value.length;
	if(lung-punto<3) {
	mail.focus();
	stato=false;
	}
	
	//if(stato) {
		//alert("E-mail valida");
	//}else{	

	if(stato==false) {
		alert("E-mail invalid");
	return stato;
	}
	
	
	if(messaggio.value=="") {
	alert("Insert message");
	messaggio.focus();
	return false;
	}


}

return true;
}


//validazione contatto italiano
function validazione_con_it(){
with(document.contatto) {
	

	if(nome.value=="") {
	alert("Inserire il nome");
	nome.focus();
	return false;
	}
	
	if(cognome.value=="") {
	alert("Inserire il cognome");
	cognome.focus();
	return false;
	}
	
	if(mail.value=="") {
	alert("Inserire l' e-mail");
	mail.focus();
	return false;
	}
	var stato=true;
	if(mail.value.indexOf(" ")!=-1) {
	mail.focus();
	stato=false;
	}
	var chiocciola=mail.value.indexOf("@");
	if(chiocciola<2) {
	mail.focus();
	stato=false;
	}
	var punto=mail.value.indexOf(".", chiocciola);
	if(punto<chiocciola+3) {
	mail.focus();
	stato=false;
	}
	var lung=mail.value.length;
	if(lung-punto<3) {
	mail.focus();
	stato=false;
	}
	
	//if(stato) {
		//alert("E-mail valida");
	//}else{	

	if(stato==false) {
		alert("E-mail non valida");
	return stato;
	}
	
	
	if(messaggio.value=="") {
	alert("Inserire il messaggio");
	messaggio.focus();
	return false;
	}


}

return true;
}		


//validazione riservazione inglese
function validazione_ris_en(){
with(document.contatto) {
	
	if(giorno_arrivo.selectedIndex == 0)
		{
			alert('Select the day of arrival');
			return false;
		}
		
		if(mese_arrivo.selectedIndex == 0)
		{
			alert('Select the month of arrival');
			return false;
		}
		
		if(anno_arrivo.selectedIndex == 0)
		{
			alert('Select the year of arrival');
			return false;
		}
		
		if(giorno_partenza.selectedIndex == 0)
		{
			alert('Select the day of departure');
			return false;
		}
		
		if(mese_partenza.selectedIndex == 0)
		{
			alert('Select the month of departure');
			return false;
		}
		
		if(anno_partenza.selectedIndex == 0)
		{
			alert('Select the year of departure');
			return false;
		}
		
		if(adulti.selectedIndex == 0)
		{
			alert('Select the number of guests');
			return false;
		}
		
		if(num_camere.selectedIndex == 0)
		{
			alert('Select the number of rooms');
			return false;
		}
		
		if(tipologia.selectedIndex == 0)
		{
			alert('Select the type of room');
			return false;
		}


	if(nome.value=="") {
	alert("Insert name");
	nome.focus();
	return false;
	}
	
	if(cognome.value=="") {
	alert("Insert surname");
	cognome.focus();
	return false;
	}
	
	if(indirizzo.value=="") {
	alert("Insert address");
	indirizzo.focus();
	return false;
	}
	
	if(citta.value=="") {
	alert("Insert city");
	citta.focus();
	return false;
	}
	
	if(nazione.value=="") {
	alert("Insert country");
	nazione.focus();
	return false;
	}
	
	if(telefono.value=="") {
	alert("Insert phone");
	telefono.focus();
	return false;
	}
	
	if(mail.value=="") {
	alert("Insert e-mail");
	mail.focus();
	return false;
	}
	var stato=true;
	if(mail.value.indexOf(" ")!=-1) {
	mail.focus();
	stato=false;
	}
	var chiocciola=mail.value.indexOf("@");
	if(chiocciola<2) {
	mail.focus();
	stato=false;
	}
	var punto=mail.value.indexOf(".", chiocciola);
	if(punto<chiocciola+3) {
	mail.focus();
	stato=false;
	}
	var lung=mail.value.length;
	if(lung-punto<3) {
	mail.focus();
	stato=false;
	}
	
	//if(stato) {
		//alert("E-mail valida");
	//}else{	

	if(stato==false) {
		alert("E-mail invalid");
	return stato;
	}

	if (Privacy.checked==false) {
		alert("E' necessario accettare il consenso informato");
		return false;
	}
	
	if (Condizioni.checked==false) {
		alert("E' necessario accettare le condizioni generali di prenotazione");
		return false;
	}

	if (Clausole.checked==false) {
		alert("E' necessario accettare le clausole delle condizioni generali di prenotazione");
		return false;
	}
}

return true;
}		



//validazione riservazione italiano
function validazione_ris_it(){
with(document.contatto) {
	
	if(giorno_arrivo.selectedIndex == 0)
		{
			alert('Selezionare il giorno di arrivo');
			return false;
		}
		
		if(mese_arrivo.selectedIndex == 0)
		{
			alert('Selezionare il mese di arrivo');
			return false;
		}
		
		if(anno_arrivo.selectedIndex == 0)
		{
			alert('Selezionare anno di arrivo');
			return false;
		}
		
		if(giorno_partenza.selectedIndex == 0)
		{
			alert('Selezionare il giorno di partenza');
			return false;
		}
		
		if(mese_partenza.selectedIndex == 0)
		{
			alert('Selezionare il mese di partenza');
			return false;
		}
		
		if(anno_partenza.selectedIndex == 0)
		{
			alert('Selezionare anno di partenza');
			return false;
		}
		
		if(adulti.selectedIndex == 0)
		{
			alert('Selezionare il numero di persone');
			return false;
		}
		
		if(num_camere.selectedIndex == 0)
		{
			alert('Selezionare il numero di camere da prenotare');
			return false;
		}
		
		if(tipologia.selectedIndex == 0)
		{
			alert('Selezionare la tipologia di camera');
			return false;
		}


	if(nome.value=="") {
	alert("Inserire il nome");
	nome.focus();
	return false;
	}
	
	if(cognome.value=="") {
	alert("Inserire il cognome");
	cognome.focus();
	return false;
	}
	
	/*
	if(indirizzo.value=="") {
	alert("Inserire indirizzo");
	indirizzo.focus();
	return false;
	}
	
	if(citta.value=="") {
	alert("Inserire la citta");
	citta.focus();
	return false;
	}
	
	if(nazione.value=="") {
	alert("Inserire la nazione");
	nazione.focus();
	return false;
	}
	*/
	
	if(telefono.value=="") {
	alert("Inserire il numero di telefono");
	telefono.focus();
	return false;
	}
	
	if(mail.value=="") {
	alert("Inserire l' e-mail");
	mail.focus();
	return false;
	}
	var stato=true;
	if(mail.value.indexOf(" ")!=-1) {
	mail.focus();
	stato=false;
	}
	var chiocciola=mail.value.indexOf("@");
	if(chiocciola<2) {
	mail.focus();
	stato=false;
	}
	var punto=mail.value.indexOf(".", chiocciola);
	if(punto<chiocciola+3) {
	mail.focus();
	stato=false;
	}
	var lung=mail.value.length;
	if(lung-punto<3) {
	mail.focus();
	stato=false;
	}
	
	//if(stato) {
		//alert("E-mail valida");
	//}else{	

	if(stato==false) {
		alert("E-mail non valida");
	return stato;
	}

	if ((tipoCarta.selectedIndex == 0) || (numeroCarta.value == "")) {
			alert("E' necessario fornire i dati della carta di credito");
			return false;
		}
		
	if (Privacy.checked==false) {
		alert("E' necessario accettare il consenso informato");
		return false;
	}
	
	if (Condizioni.checked==false) {
		alert("E' necessario accettare le condizioni generali di prenotazione");
		return false;
	}

	if (Clausole.checked==false) {
		alert("E' necessario accettare le clausole delle condizioni generali di prenotazione");
		return false;
	}
}

return true;
}		
