function setLinHome(lingua){
	document.lingForm.ling.value=lingua;
	document.lingForm.action="home.php";
	document.lingForm.submit();
}

function setLin(page){
	document.lingForm.action=page;
	document.lingForm.submit();
}

function CheckForm(ling){
checked=false;
msg="";

if (ling=='de'){
	nome="Das Feld \"VOR- & NACHNAME\" muss ausgefüllt werden.";
	mail="Das Feld \"E-MAIL\" muss ausgefüllt werden.";
	mail2="Das Feld \"E-MAIL\" enthält keine gültige E-Mail Adresse.";
	tel="Das Feld \"TELEFON\" muss ausgefüllt werden.";
	tel2="Das Feld \"TELEFON\" kann nur Zahlen, Leerzeichen und das Zeichen '+' enthalten";
	arrivo="Das Feld \"ANKUNFTSDATUM\" muss ausgefüllt werden.";
	arrivo2="Das Feld \"ANKUNFTSDATUM\" kann nur Zahlen und die Zeichen '.' und `\\` erhalten.";
	partenza="Das Feld \"ABFAHRTSDATUM\" muss ausgefüllt werden.";
	partenza2="Das Feld \"ABFAHRTSDATUM\" kann nur Zahlen und die Zeichen '.' und `\\` erhalten.";
}
else if (ling=='en'){
	nome="The field \"NAME & SURNAME\" is required.";
	mail="Il campo \"E-MAIL ADDRESS\" is required.";
	mail2="Il campo \"E-MAIL ADDRESS\" does not contain a valid e-mail address.";
	tel="Il campo \"PHONE\" is required.";
	tel2="Il campo \"PHONE\" may only contain numerical values, space and `+`.";
	arrivo="Il campo \"DATE OF ARRIVAL\" is required.";
	arrivo2="Il campo \"DATE OF ARRIVAL\" may only contain numerical values, dots and  `\\`";
	partenza="Il campo \"DATE OF DEPARTURE\" is required.";
	partenza2="Il campo \"DATE OF DEPARTURE\" may only contain numerical values, dots and  `\\`";
}
else{
	nome="Il campo \"NOME E COGNOME\" è obbligatorio.";
	mail="Il campo \"E-MAIL\" è obbligatorio.";
	mail2="Il campo \"E-MAIL\" non contiene un indirizzo e-mail valido.";
	tel="Il campo \"TELEFONO\" è obbligatorio.";
	tel2="Il campo \"TELEFONO\" può contenere solo valori numerici, il carattere spazio ed il carattere `+`.";
	arrivo="Il campo \"DATA DI ARRIVO\" è obbligatorio.";
	arrivo2="Il campo \"DATA DI ARRIVO\" può contenere solo valori numerici, il punto ed il carattere `\\`.";
	partenza="Il campo \"DATA DI PARTENZA\" è obbligatorio.";
	partenza2="Il campo \"DATA DI PARTENZA\" può contenere solo valori numerici, il punto ed il carattere `\\`.";
}
	if(document.preno.nome.value==""){
		msg+=nome;
	}
	if(document.preno.mail.value==""){
		msg+="\n"+mail;
	}
	else if (document.preno.mail.value.indexOf("@")==-1 ||document.preno.mail.value.indexOf(".")==-1 || (document.preno.mail.value.lastIndexOf(".")-document.preno.mail.value.indexOf("@"))<2 )
							 msg+="\n"+mail2;
		if(document.preno.tel.value==""){
			msg+="\n"+tel;
	}
	else {
		procedi=true;
		for(j=0;j<document.preno.tel.value.length;j++){
		   if((document.preno.tel.value.charAt(j)<"0" || document.preno.tel.value.charAt(j)>"9") && (document.preno.tel.value.charAt(j)!="+" && document.preno.tel.value.charAt(j)!=" ")){
			   procedi=false;
				break;
			}//fine if	
		}//fine for
		if(!procedi){				   
			msg+="\n"+tel2; 					
		}//fine if
	}
	if(document.preno.arrivo.value==""){
		msg+="\n"+arrivo;
	}
	else {
		procedi=true;
		for(j=0;j<document.preno.arrivo.value.length;j++){
		   if((document.preno.arrivo.value.charAt(j)<"0" || document.preno.arrivo.value.charAt(j)>"9") && (document.preno.arrivo.value.charAt(j)!="\\" && document.preno.arrivo.value.charAt(j)!=".")){
			   procedi=false;
				break;
			}//fine if	
		}//fine for
		if(!procedi){				   
			msg+="\n"+arrivo2; 					
		}//fine if
	}
	if(document.preno.partenza.value==""){
		msg+="\n"+partenza;
	}
	else {
		procedi=true;
		for(j=0;j<document.preno.partenza.value.length;j++){
		   if((document.preno.partenza.value.charAt(j)<"0" || document.preno.partenza.value.charAt(j)>"9") && (document.preno.partenza.value.charAt(j)!="\\" && document.preno.partenza.value.charAt(j)!=".")){
			   procedi=false;
				break;
			}//fine if	
		}//fine for
		if(!procedi){				   
			msg+="\n"+partenza2; 					
		}//fine if
	}
	if (msg!="")
		alert(msg);
	else{
		document.preno.action="email.php";
		document.preno.submit();
		}
}