	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("Il campo " + cella.getAttribute("name") + " non è valido. Inserire correttamente il valore.");
					cella.focus(); 
					cella.select();
					return false;
				}
			}
		}
	}


	function Validate(form) {

		if(Nullo(document.getElementById("latuarichiesta"))) {
			alert("Il campo \"La Tua Richiesta\" è vuoto. Inserire il valore.");
			document.getElementById("latuarichiesta").focus(); 
			document.getElementById("latuarichiesta").select();
			return false;
			}

		if(!Seleziona(document.getElementById("mesearrivo"))){
			alert("Selezionare un'opzione nel campo \"mese nella data di arrivo\"")
			return false;
			}

		if(!Seleziona(document.getElementById("annoarrivo"))){
			alert("Selezionare un'opzione nel campo \"anno nella data di arrivo\"")
			return false;
			}

		if(!Seleziona(document.getElementById("mesepartenza"))){
			alert("Selezionare un'opzione nel campo \"mese nella data di partenza\"")
			return false;
			}

		if(!Seleziona(document.getElementById("annopartenza"))){
			alert("Selezionare un'opzione nel campo \"anno nella data di partenza\"")
			return false;
			}

		if(Nullo(document.getElementById("numerodelegati"))) {
			alert("Il campo \"numero di delegati\" è vuoto. Inserire il valore.");
			document.getElementById("numerodelegati").focus(); 
			document.getElementById("numerodelegati").select();
			return false;
			}

		if(!Numeri(document.getElementById("numerodelegati"))) {
			alert("Il campo \"numero di delegati\" è un campo numerico. Inserire correttamente il valore.");
			document.getElementById("numerodelegati").focus(); 
			document.getElementById("numerodelegati").select();
			return false;
			}

		if(Nullo(document.getElementById("nome"))) {
			alert("Il campo \"nome\" è vuoto. Inserire il valore.");
			document.getElementById("nome").focus(); 
			document.getElementById("nome").select();
			return false;
			}

	
		if(!Lettere(document.getElementById("nome"))) {
			alert("Il campo \"nome\" non è valido. Inserire correttamente il valore.");
			document.getElementById("nome").focus(); 
			document.getElementById("nome").select();
			return false;
			}
		
		if(Nullo(document.getElementById("mail"))) {
			alert("Il campo \"email\" è vuoto. Inserire il valore.");
			document.getElementById("mail").focus(); 
			document.getElementById("mail").select();
			return false;
			}

		if(!isEmail(document.getElementById("mail").value)) {
			alert("Il campo email non è corretto. Inserire un'email valida.");
			document.getElementById("mail").focus(); 
			document.getElementById("mail").select();
			return false;
			}

		if(Nullo(document.getElementById("telefono"))) {
			alert("Il campo \"numero di telefono\" è vuoto. Inserire il valore.");
			document.getElementById("telefono").focus(); 
			document.getElementById("telefono").select();
			return false;
			}

		if(!Numeri(document.getElementById("telefono"))) {
			alert("Il campo \"numero di telefono\" è un campo numerico. Inserire correttamente il valore.");
			document.getElementById("telefono").focus(); 
			document.getElementById("telefono").select();
			return false;
			}
			
		return true;
	}	
		