//  VFscript by Syn-Ergo(R) S.n.C.

function attachForm(){
	var form = document.forms[0]; // get the form
	form.onsubmit = function(){ Controllo(); 
	return document.ripeti;	} //attach validate() to the form
}

function Controllo(){
		var errore=false;
		var form = document.forms[0];// get the form
		var EmailAddr = form.email.value;
		Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		
		if (!errore && form.nome.value==''){
			alert("Insert your first name")
			errore=true
			form.nome.focus()
		}
		
		if (!errore && form.cognome.value==''){
			alert("Insert your last name")
			errore=true
			form.cognome.focus()
		}
		
		if (!errore && Filtro.test(EmailAddr)==''){
     	    alert("Insert a valid e-mail adress")
			errore=true
   		    form.email.focus()
        }
				
		if (!errore && form.telefono.value==''){
			alert("Insert a telephone number to contact you")
			errore=true
			form.telefono.focus()
		}
				
		if (!errore && (form.richieste.value=='')){
			alert("Insert your personal requests")
			errore=true
			form.richieste.focus()
		}


		if (!errore && (form.dati.checked=='0')){
			alert("If you want reserve, you must agree and consent to Terms and Conditions of the Italian Privacy Statement")
			errore=true
			form.dati.focus()
		}

		if (!errore){
			//frm.nome.value=frm.nome.value+' '+frm.cognome.value
			form.submit()
		}
	document.ripeti = (errore == '');
}
	
//  Copyright (C) 2006 Syn-Ergo(R) S.n.C.