// JAVASCRIPT SOURCE PER IL CLAM - Centro Linguistico d'Ateneo Messinese
// Copyright (c) 2008, Marco Todaro

/*---------------------------------------------------------------------------------------------*/
  function checkMail()
/*---------------------------------------------------------------------------------------------*/
{
  if (document.form1.id_gruppo.options.selectedIndex == 0)
  {
     alert("Seleziona un gruppo prima di procedre.");
     return false;
  }
  else
  {
     EmailAddr = document.form1.postaelettronica.value;
     Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

     if (Filtro.test(EmailAddr))
     {
        alert("Congratulazioni! Ti sei correttamente \n registrato alla mailing list del CLAM.");
        document.form1.submit();
     }
     else
     {
        alert("Controlla l'indirizzo di e-mail inserito");
        document.form1.postaelettronica.focus(); return false;
     }
  }
}

/*---------------------------------------------------------------------------------------------*/
  function apriFinestra( url, width, height)
/*---------------------------------------------------------------------------------------------*/
{
	hWin = window.open( '','ChooseWindow','scrollbars=auto,resizable=yes,width=' + width + ',height=' + height + ',left=200,top=300');
	hWin.location.href = url;
}

/*---------------------------------------------------------------------------------------------*/
  function launchCenter(url, width, height) 
/*---------------------------------------------------------------------------------------------*/
{
   var str = "height=" + height + ",innerHeight=" + height;
       str += ",width=" + width  + ",innerWidth="  + width +  ",scrollbars=yes";

   if (window.screen)
   {
      var ah = screen.availHeight - 30;
      var aw = screen.availWidth - 10;

      var xc = (aw - width)  / 2;
      var yc = (ah - height) / 2;

      str += ",left=" + xc + ",screenX=" + xc;
      str += ",top=" + yc + ",screenY=" + yc;
   }
   return window.open(url, 'ChooseWindow', str);
}
