function deleteBlanks(str){
        var foundBlank = 1;
        var len;
        len = str.length;
        if (len == 0) return str;
        while (foundBlank == 1)
            {   var indx;
                indx = str.indexOf(" ", 0);
                if (indx == -1) {foundBlank =0;}
                else {str= str.substring(0, indx) +
                        str.substring(indx + 1, len);}}
        return str;}

function validateForm(lingua) {
	
	var cognome		= deleteBlanks(document.Prenot.Cognome.value.toLowerCase());
	var nome    	= deleteBlanks(document.Prenot.Nome.value.toLowerCase());
	var telefono 	= deleteBlanks(document.Prenot.Tel.value.toLowerCase());
	var email 		= deleteBlanks(document.Prenot.EMail.value.toLowerCase());
	var stato = null

	if (cognome=="") {
		switch (lingua)
		{
			case "en":
				alert("Fill in all the obligatory sections with correct data");
				break;
			case "fr":
				alert("Compiler toutes les cases obbligatoires de façon correcte.");
				break;
			default:
				alert("Compilare tutti i campi obbligatori con dati corretti.");
				break;
		}
		document.Prenot.Cognome.focus();
		return false
	}

	if (nome=="") {
	    switch (lingua)
		{
			case "en":
				alert("Fill in all the obligatory sections with correct data");
				break;
			case "fr":
				alert("Compiler toutes les cases obbligatoires de façon correcte.");
				break;
			default:
				alert("Compilare tutti i campi obbligatori con dati corretti.");
				break;
		}
		document.Prenot.Nome.focus();
        return false
	}

	if (telefono=="") {
		switch (lingua)
		{
			case "en":
				alert("Fill in all the obligatory sections with correct data");
				break;
			case "fr":
				alert("Compiler toutes les cases obbligatoires de façon correcte.");
				break;
			default:
				alert("Compilare tutti i campi obbligatori con dati corretti.");
				break;
		}
		document.Prenot.Tel.focus();
		return false;
	}

	if (email=="") {
		switch (lingua)
		{
			case "en":
				alert("Fill in all the obligatory sections with correct data");
				break;
			case "fr":
				alert("Compiler toutes les cases obbligatoires de façon correcte.");
				break;
			default:
				alert("Compilare tutti i campi obbligatori con dati corretti.");
				break;
		}
		document.Prenot.EMail.focus();
		return false;
	}

	document.Prenot.email.value = document.Prenot.EMail.value;
	document.Prenot.realname.value = document.Prenot.Cognome.value + ' ' + document.Prenot.Nome.value;

}