
function OpenWin(URL,Width,Height)
  {
   var wp;
   wp=window.open(URL,"", "toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,width=" + Width + ",height=" + Height + ",top=0,left=0");
  }

function OpenWin2(URL,Width,Height)
  {
   var wp;
   wp=window.open(URL,"", "toolbar=no,status=no,scrollbars=no,resizable=no,menubar=no,width=" + Width + ",height=" + Height + ",top=0,left=0");
  }


function ResetFields()
 {
  document.frmNL.control.value='1';
 }

function TestRicerca ()
 {if (document.frmRicerca.txtRicerca.value == "")
   {alert ("Inserire almeno un carattere nel box ricerca !");
    document.frmRicerca.txtRicerca.focus();
    return (false);
   }
  return (true);   
 }


// Validità e-mail
// ===============
function TestEmail ()
 {if (document.frmNL.email.value == "")
   {alert ("Inserire la E-Mail !");
    document.frmNL.email.focus();
    return (false);
   }
    
  //deve esserci una sola @
  pos=document.frmNL.email.value.indexOf('@', 0)
  if (pos == 0)
   {alert ("Inserisci correttamente l'e-mail!");
    document.frmNL.email.focus();
    return (false);
   }

  if (pos == -1) 
   {alert ("Inserisci correttamente l'e-mail!");
    document.frmNL.email.focus();
    return (false);
   }
  else
   {if (document.frmNL.email.value.indexOf('@', pos+1) != -1)
    {alert ("Inserisci correttamente l'e-mail!");
     document.frmNL.email.focus();
     return (false);
    }
   }

  //devono esserci almeno 4 caratteri dopo @
  if (document.frmNL.email.value.substring(pos+1,document.frmNL.email.value.length).length < 4)
   {alert ("Inserisci correttamente l'e-mail!");
    document.frmNL.email.focus();
    return (false);
   }
  //deve esserci almeno un . dopo @
  if (document.frmNL.email.value.indexOf('.', pos+1) == -1)      
   {alert ("Inserisci correttamente l'e-mail!");
    document.frmNL.email.focus();
    return (false);
   }

  //caratteri ammessi
  stremail=document.frmNL.email.value.toUpperCase()
  for (var i = 0; i < stremail.length; i++)
   {if (".-_0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(stremail.charAt(i)) == -1) 
    {alert ("Inserisci correttamente l'e-mail!");
     document.frmNL.email.focus();
     return (false);
    }
   }
  //Tutto OK
  return (true);   
 }

 // runSubmit


function runSubmit ()
  {
   if (!TestEmail()) return;
	  document.frmNL.control.value='0';
      document.frmNL.submit();  
      return;
  }

function runSubmit2 ()
  {
   if (!TestEmail()) return;
	  document.frmNL.control.value='1';
      document.frmNL.submit();  
      return;
  }

function runSubmitRicerca ()
  {
   if (!TestRicerca()) return;
      document.frmRicerca.submit();  
      return;
  }







