// JavaScript Document

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbar=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
  popUpWin.focus();
}


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){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }
 		 return true					
}

function verifica_info()
{
  var emailID=document.form1.Email
  if(document.form1.Nome.value == "" )
	alert ("Il campo Nome non è stato riempito");
  else if(document.form1.Cognome.value == "" )
	alert ("Il campo Cognome non è stato riempito");
  else if(emailID.value == "")
	alert ("Inserite il vostro indirizzo e-mail");
  else if (echeck(emailID.value)==false)
	alert ("Inserite un indirizzo email valido");
  else if(document.form1.info.value == "" )
	alert ("Il campo informazioni non è stato riempito");
  else
    document.form1.submit();
}

