// JavaScript Document


	function Azzera(campo) {
		document.getElementById(campo).value="";
	}
	
	function checkRequired(value,nomecampo){
		if (value==null||value==""||value=="undefined"){
			alert("Field "+nomecampo+" must be filled in");
			return false;
		}
		else{
			return true;
		}
	}	
	
	function isEmail(string) {
		if (string.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) != -1)
			return 1;
		else{
			alert("Invalid E-mail");
			return 0;
		}
	}
	
	function submitRequest() {

			var nome = document.getElementById('nome').value;
			var email = document.getElementById('email').value;
			var date1x = document.getElementById('date1x').value;

			esito_ok = true;
			
			//controlli riempimento campi
			if(esito_ok && !checkRequired(nome,"name and surname"))
				esito_ok = false;
	
			if(esito_ok && !checkRequired(email,"e-mail"))
				esito_ok = false;
				
			if(esito_ok && !checkRequired(date1x,"arrival date"))
				esito_ok = false;							
				/*
			if(esito_ok && !document.getElementById('consenso').checked){
				alert("E' necessario fornire il consenso al trattamento dei dati personali secondo le norme che tutelano la privacy.");
				esito_ok = false;
			}*/
			
			//controlli formali	
			if(esito_ok && !isEmail(email))
				esito_ok = false;	

			if(esito_ok) { 
				if (confirm("Clicking on 'OK' button you authorize treatment of my personal data as depicted in Privacy Statement."))
					document.getElementById('form1').submit();
			}
	}  

/*
	function submit_Request() {
		//INVIA IL MODULO
		document.form1.contenitore.value = "info@bebvilladriana.it,"+document.form1.email.value;
		document.form1.submit();
	}
	*/
