//  **********************************************************
//  *                /email_list_lite/                       *
//  *           Author:   www.Seiretto.com                   *
//  *    © Copyright /email_list_lite/ Seiretto.com          *
//  *              All rights reserved.                      *
//  **********************************************************
//  *        Launch Date:  May 2003                          *
//  *                                                        *
//  *     Version    Date              Comment               *
//  *     1.0f       29th May 2003      Original release     *
//  *                                                        *
//  *  NOTES:                                                *
//  *        Requires:  PHP 4.2.3 (or greater)               *
//  *                   and MySQL                            *
//  **********************************************************/
var email_list_lite_version="1.0f";
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


var message1="";
var message2="";

var theserver="http://"+self.location.hostname+"/email_list_lite/validate.php";
theform="<form method=\"POST\" name=\"FF\" action=\"" +theserver+ "\" target=\"e2afWin\">";
theform=theform + "Enter your email:<br><input type=\"text\" name=\"email_addr\" size=\"18\" onfocus=\"email_addr_onfocus()\"><br>";
theform=theform + "<div align=\"center\"><label><input type=\"radio\" name=\"action\" value=\"1\" checked>Join</label><label><input type=\"radio\" name=\"action\" value=\"0\">Leave</label></div>";
theform=theform + "<div align=\"center\"><input type=\"image\" onclick=\"validateForm()\" value=\"Submit\" name=\"Button\" src=\"../includes/languages/english/images/buttons/button_submit.gif\"></div></form>";

document.write(theform);

function set_action()
{
 with (document.FF)
 {
  if (action.value=="1") Button.value="Join List";
  else Button.value="Leave List";
 }
}

function validateForm()
{
 var okSoFar=true
 var foundAt = 0
 var foundDOT = 0
 var foundSpace = 0
 var foundDQuote = 0
 var foundSQuote = 0
 with (document.FF)
 {
  if (email_addr.value=="" && okSoFar)
  {
    okSoFar = false
    alert ("Please enter an email address.")
    email_addr.focus()
  }
 if (email_addr.value>"" && okSoFar)
  {
   foundAt = email_addr.value.indexOf("@",0)
   foundDOT = email_addr.value.indexOf(".",0)
   foundSpace = email_addr.value.indexOf(" ",0)
   foundDQuote = email_addr.value.indexOf("\"",0)
   foundSQuote = email_addr.value.indexOf("\'",0)
  }
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid email address.")
    email_addr.focus()
  }
  if (foundDOT < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid email address.")
    email_addr.focus()
  }
  if (foundSpace > 1 && okSoFar)
  {
    okSoFar = false
    alert ("There is a space within the email address this is not valid, please re-enter.")
    email_addr.focus()
  }
  if (foundDQuote > 1 && okSoFar)
  {
    okSoFar = false
    alert ("There is a double quote within the email address this is not valid, please re-enter.")
    email_addr.focus()
  }
  if (foundSQuote > 1 && okSoFar)
  {
    okSoFar = false
    alert ("There is a single quote within the email address this is not valid, please re-enter.")
    email_addr.focus()
  }
  if (okSoFar==true)
  {
   e2afWin='toolbar=0,directories=0,fullscreen=0,menubar=0,scrollbars=0,resizable=0,width=300,height=170,top=50,left=50';
   var e2afWindow = null;
   if(e2afWindow != null) if(!e2afWindow.closed) e2afWindow.close()
   loading="http://"+self.location.hostname+"/email_list_lite/loading.html";
   e2afWindow=window.open(loading,'e2afWin', e2afWin);
   e2afWindow.focus();
   submit();
  }
}
}

TimerID1=setTimeout('moveit(message1)',200);

countit=0;
run_message1=1;
function moveit(tmsg)
{
 document.FF.email_addr.value= document.FF.email_addr.value+tmsg.charAt(countit) ;
 countit++;
 if (countit==tmsg.length)
 {
  countit=0;
  clearTimeout(TimerID1);
  document.FF.email_addr.value="";
  if (run_message1==1) run_message1=0;
  else run_message1=1;
 }
 if (run_message1==1) TimerID1=setTimeout('moveit(message1)',200);
 else TimerID1=setTimeout('moveit(message2)',200);
}

function email_addr_onfocus()
{
  clearTimeout(TimerID1);
  document.FF.email_addr.value="";
}