	function MM_openBrWindow(theURL,winName,features) 
	{ //v2.0
		 window.open(theURL,winName,features);
	}
	function Nullo(textObj){
            return (textObj.value.length==0);
            
        }
	
	function Lettere(textObj){
			var valore = textObj.value;
			var lungh= valore.length;
			var extraChars = ", - .";
			var search;

				for (var i =0; i != lungh; i++) {
					aChar = valore.substring(i,i + 1);
					aChar = aChar.toUpperCase();
					search = extraChars.indexOf(aChar);
						if(search == -1 && (aChar < "A" || aChar > "Z")) {
						return false;
						}
				}
			return true;
		}
		

		function Numeri(textObj){
			var valore = textObj.value;
			var lungh= valore.length;
			var ispippo = false;

				for (var i =0; i != lungh; i++) {
					aChar = valore.substring(i,i + 1);
					if (aChar == ".")
					{
						if (!ispippo)
						{
							ispippo = true;
						}
						else
						{
							return false;
						}
					}
					else
					{
						if(aChar < "0" || aChar > "9") {
							return false;
						}
					}
				}
			return true;
		}

		function isEmail(strValue)
		{
			RegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
			return RegExp.test(strValue);
		}


		function Seleziona(selectObject){
			return selectObject.options[selectObject.selectedIndex].value;
			
		}


	function Valida(form)
	{
		var lista_td = document.getElementsByTagName("input");
		for(i=0; i < lista_td.length; i++)
		{	
			if(lista_td.item(i).getAttribute("title") == "int")
			{
				cella = lista_td.item(i);
				
				if(!Numeri(cella))
				{
					alert("The field " + cella.getAttribute("name") + " is not valid. Please it fill up properly.");
					cella.focus(); 
					cella.select();
					return false;
				}
			}
		}
	}


	function Validate(form) {

		if(Nullo(document.getElementById("latuarichiesta"))) {
			alert("The field \"Your request\" is empty. Please fill it up.");
			document.getElementById("latuarichiesta").focus(); 
			document.getElementById("latuarichiesta").select();
			return false;
			}

		if(!Seleziona(document.getElementById("mesearrivo"))){
			alert("Please choose an option in the field \"month in the day of arrival.\"")
			return false;
			}

		if(!Seleziona(document.getElementById("annoarrivo"))){
			alert("Please choose an option in the field \"year in the day of arrival.\"")
			return false;
			}

		if(!Seleziona(document.getElementById("mesepartenza"))){
			alert("Please choose an option in the field \"month in the date of departure.\"")
			return false;
			}

		if(!Seleziona(document.getElementById("annopartenza"))){
			alert("Please choose an option in the field \"year in the date of departure.\"")
			return false;
			}

		if(Nullo(document.getElementById("numerodelegati"))) {
			alert("The field \"Number of delegates\" is empty. Please fill it up.");
			document.getElementById("numerodelegati").focus(); 
			document.getElementById("numerodelegati").select();
			return false;
			}

		if(!Numeri(document.getElementById("numerodelegati"))) {
			alert("The field \"Number of delegates\" is not valid. Please it fill up properly.");
			document.getElementById("numerodelegati").focus(); 
			document.getElementById("numerodelegati").select();
			return false;
			}

		if(Nullo(document.getElementById("nome"))) {
			alert("The field \"name\" is empty. Please it fill up properly.");
			document.getElementById("nome").focus(); 
			document.getElementById("nome").select();
			return false;
			}

	
		if(!Lettere(document.getElementById("nome"))) {
			alert("The field \"name\" is not valid. Please it fill up properly.");
			document.getElementById("nome").focus(); 
			document.getElementById("nome").select();
			return false;
			}
		
		if(Nullo(document.getElementById("mail"))) {
			alert("The field \"email\" is empty. Please it fill up properly.");
			document.getElementById("mail").focus(); 
			document.getElementById("mail").select();
			return false;
			}

		if(!isEmail(document.getElementById("mail").value)) {
			alert("The field email is not valid. Please it fill up properly.");
			document.getElementById("mail").focus(); 
			document.getElementById("mail").select();
			return false;
			}

		if(Nullo(document.getElementById("telefono"))) {
			alert("The field \"Telephone number\" is empty. Please it fill up properly.");
			document.getElementById("telefono").focus(); 
			document.getElementById("telefono").select();
			return false;
			}

		if(!Numeri(document.getElementById("telefono"))) {
			alert("The field \"Telephone number\" is not valid. Please it fill up properly.");
			document.getElementById("telefono").focus(); 
			document.getElementById("telefono").select();
			return false;
			}
			
		return true;
	}	
		