//  **********************************************************
//  *                /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="Zapisz się..........";
var message2="Newsletter Oranżeria.com.....";

var theserver="http://"+self.location.hostname+"/mailing/validate.php";
theform="<form method=\"POST\" name=\"FF\" action=\"" +theserver+ "\" target=\"e2afWin\">";
theform=theform + "<div style=\" align: center; \">Jeśli chcesz otrzymywać <b>wiadomości<br>z Galerii Oranżeria</b> -<br>powiadomienia<br>o nowościach, promocjach, zmianach - <b>wpisz tu<br>swój adres e-mail</b>:<br><div align=\"center\"><input type=\"text\" name=\"email_addr\" size=\"10px\" style=\" align: center; height: 20px; width: 160px;\" onfocus=\"email_addr_onfocus()\"><br><select name=\"action\" size=\"1\" ONChange=\"set_action()\"></div></div>";
theform=theform + "<div style=\" align:center \"><div><option selected value=\"1\">Zapisz się</option><option value=\"0\">Rezygnujesz?</option></div></div>";
theform=theform + "</select><input type=\"button\" onclick=\"validateForm()\" value=\"Zapisz\" name=\"Button\"></form>";

document.write(theform);

function set_action()
{
 with (document.FF)
 {
  if (action.value=="1") Button.value="Zapisz się";
  else Button.value="Rezygnujesz?";
 }
}

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 ("Wpisz swój adres E-mail!")
    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 ("Proszę, wpisz poprawny adres e-mail!")
    email_addr.focus()
  }
  if (foundDOT < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Proszę, wpisz poprawny adres e-mail!")
    email_addr.focus()
  }
  if (foundSpace > 1 && okSoFar)
  {
    okSoFar = false
    alert ("Przecież nie może być spacji w adresie e-mail! Wpisz ponownie poprawny adres.")
    email_addr.focus()
  }
  if (foundDQuote > 1 && okSoFar)
  {
    okSoFar = false
    alert ("W podanym adresie e-mail są niedozwolone znaki. Wpisz jeszcze raz!")
    email_addr.focus()
  }
  if (foundSQuote > 1 && okSoFar)
  {
    okSoFar = false
    alert ("W podanym adresie e-mail są niedozwolone znaki. Wpisz jeszcze raz!")
    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+"/mailing/loading.html";
   e2afWindow=window.open(loading,'e2afWin', e2afWin);
   e2afWindow.focus();
   submit();
  }
}
}

TimerID1=setTimeout('moveit(message1)',100);

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)',100);
 else TimerID1=setTimeout('moveit(message2)',100);
}

function email_addr_onfocus()
{
  clearTimeout(TimerID1);
  document.FF.email_addr.value="";
}
