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=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


var popUpWinSCROLL=0;
function popUpWindowSCORLL(URLStr, left, top, width, height)
{
  if(popUpWinSCROLL)
  {
    if(!popUpWinSCROLL.closed) popUpWinSCROLL.close();
  }
  popUpWinSCROLL = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


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_login()
{
  if(document.frm_login.UserID.value == "")
	alert ("Inserite il Vostro nome utente");
  else if(document.frm_login.PWD.value == "")
	alert ("Inserite la Vostra password");
  else
  document.frm_login.submit();
}

function verifica_login1()
{
  if(document.frm_login1.UserID.value == "")
	alert ("Inserite il Vostro nome utente");
  else if(document.frm_login1.PWD.value == "")
	alert ("Inserite la Vostra password");
  else
  document.frm_login1.submit();
}


function verifica_ricerca()
{
  if(document.frm_ricerca.str_search.value == "")
	alert ("Inserite una stringa di ricerca");
  else
  document.frm_ricerca.submit();
}

function verifica_email()
	{
	var emailID=document.frm_newsletter.email
	  if(emailID.value == "")
		alert ("Inserite il vostro indirizzo e-mail");
	  else if (echeck(emailID.value)==false)
		alert ("Inserite un indirizzo email valido");
	 else
	document.frm_newsletter.submit();
}

function verifica_new()
{
var emailID=document.adduser.email
  if(document.adduser.nome.value == "")
	alert ("Il campo nome è obbligatorio");
  else if(document.adduser.cognome.value == "")
	alert ("Il campo cognome è obbligatorio");
  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.adduser.privacy.value != "1" )
	alert ("E' necessario consentire il trattamento dei dati per proseguire");
  else
  document.adduser.submit();
}
