function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Indirizzo E-mail non corretto")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Indirizzo E-mail non corretto")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Indirizzo E-mail non corretto")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Indirizzo E-mail non corretto")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Indirizzo E-mail non corretto")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Indirizzo E-mail non corretto")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Indirizzo E-mail non corretto")
		    return false
		 }

 		 return true					
	}

function Controlla(){
	if (document.Femail.nomeditta.value==""){
	alert("Modulo incompleto campo Nome Vuoto!!");
	document.Femail.nomeditta.focus();
		return false;
	}
	if (document.Femail.tel.value==""){
	alert("Modulo incompleto campo Telefono vuoto.");
	document.Femail.tel.focus();
		return false;
	}
	/*if (document.Femail.Indirizzo.value==""){
	alert("Modulo incompleto campo indirizzo vuoto.");
	document.Femail.Indirizzo.focus();
		return false;
	}
	
	if (document.Femail.servizi.value==""){
	alert("Modulo incompleto campo Servizi vuoto.");
	document.Femail.servizi.focus();
		return false;
	}
	if (document.Femail.note.value==""){
	alert("Modulo incompleto campo Note vuoto.");
	document.Femail.note.focus();
		return false;
	}*/
	if (document.Femail.email.value==""){
	alert("Modulo incompleto campo e-mail vuoto.");
	document.Femail.email.focus();
		return false;
	}
	if (echeck(document.Femail.email.value)==false){
		document.Femail.email.focus();
		return false
	}
}

function ControllaLog(){
	if (document.Flog.user.value==""){
	alert("Modulo incompleto, il campo user e Vuoto!!");
	document.Flog.user.focus();
		return false;
	}
	if (document.Flog.password.value==""){
	alert("Modulo incompleto, il campo password e Vuoto!!");
	document.Flog.password.focus();
		return false;
	}
}
