	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;

				for (var i =0; i != lungh; i++) {
					aChar = valore.substring(i,i + 1);
						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(formcontatti)
	{
		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(formcontatti) {

		if(Nullo(document.getElementById("latuarichiesta"))) {
			alert("Il campo \"La Tua richiesta\" è vuoto. Inserisci il tuo messaggio.");
			document.getElementById("latuarichiesta").focus(); 
			document.getElementById("latuarichiesta").select();
			return false;
			}

		

		if(Nullo(document.getElementById("nome"))) {
			alert("Il campo \"Il Tuo nome e il Tuo cognome\" è vuoto. Inserisci nome e cognome.");
			document.getElementById("nome").focus(); 
			document.getElementById("nome").select();
			return false;
			}

	
		if(!Lettere(document.getElementById("nome"))) {
			alert("Il campo \"Il Tuo nome e il Tuo cognome\" non è valido. Inserisci nome e cognome.");
			document.getElementById("nome").focus(); 
			document.getElementById("nome").select();
			return false;
			}
		
		if(Nullo(document.getElementById("mail"))) {
			alert("Il campo \"La Tua e-mail\" è vuoto. Inserisci un indirizzo email valido.");
			document.getElementById("mail").focus(); 
			document.getElementById("mail").select();
			return false;
			}

		if(!isEmail(document.getElementById("mail").value)) {
			alert("Il campo \"La Tua e-mail\" non è corretto. Inserisci un indirizzo email valido.");
			document.getElementById("mail").focus(); 
			document.getElementById("mail").select();
			return false;
			}

		if(Nullo(document.getElementById("telefono"))) {
			alert("Il campo \"Il Tuo numero di telefono\" è vuoto. Inserisci un numero di telefono.");
			document.getElementById("telefono").focus(); 
			document.getElementById("telefono").select();
			return false;
			}

		if(!Numeri(document.getElementById("telefono"))) {
			alert("Il campo \"Il Tuo numero di telefono\" è un campo numerico. Inserisci correttamente il valore.");
			document.getElementById("telefono").focus(); 
			document.getElementById("telefono").select();
			return false;
			}
			
		return true;
	}	
		
