function validator(theForm)
  {
  if (theForm.email.value == "")
    {
    alert("Please enter a value for the \"Email Address\" field.");
    theForm.email.focus();
    return (false);
    }
  
  if (theForm.email.value.length < 6)
    {
    alert("Please enter at least 6 characters in the \"Email Address\" field.");
    theForm.email.focus();
    return (false);
    }

  if (theForm.email.value.length > 100)
    {
    alert("Please enter at most 100 characters in the \"Email Address\" field.");
    theForm.email.focus();
    return (false);
    }
  
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&#402;&#352;&#338;&#381;&#353;&#339;&#382;&#376;ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-_@.";
  var checkStr = theForm.email.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
    {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
      {
      allValid = false;
      break;
      }
    }
  if (!allValid)
    {
    alert("Please enter only letters, digits or the characters - _ @ or . in the \"Email Address\" field.");
    theForm.email.focus();
    return (false);
    }
    
  var checkStr = theForm.email.value;
  var atValid = false;
  for (i = 0;  i < checkStr.length;  i++)
    {
    ch = checkStr.charAt(i);
    if (ch == "@")
      {
      atValid = true;
      break;
      }
    }
  if (!atValid)
    {
    alert("Please enter a valid email address in the \"Email Address\" field.  It is currently missing an \"@\" character.");
    theForm.email.focus();
    return (false);
    }

  var checkStr = theForm.email.value;
  var atValid = false;
  for (i = 0;  i < checkStr.length;  i++)
    {
    ch = checkStr.charAt(i);
    if (ch == ".")
      {
      atValid = true;
      break;
      }
    }
  if (!atValid)
    {
    alert("Please enter a valid email address in the \"Email Address\" field.  It is currently missing a \".\" character.");
    theForm.email.focus();
    return (false);
    }

  return (true);
  }  

function throwCurtain()
  {
  setStyle("lro-lcross-launch", "visibility", "hidden");
  setStyle("lcross-movie", "visibility", "hidden");  
  setStyle("container", "overflow", "hidden");
  setStyle("container", "height", "98%");
  setStyle("curtain", "visibility", "visible");
  var email = "";
  email = document.getElementById("emailfield").value;
  
  var answer = confirm('By clicking "Ok" you confirm that you would like to receive event information at ' + email + ' as part of a free information service from SLOOH, LLC.');
  if (answer)
    {
	emailSubmit(email);
	}
  else
    {
	setStyle("curtain", "visibility", "hidden");
    setStyle("container", "overflow", "visible");
    setStyle("container", "height", "auto");
	setStyle("lro-lcross-launch", "visibility", "visible");
    setStyle("lcross-movie", "visibility", "visible");
	document.getElementById("emailfield").value = "";
	} 
  }

function setStyle(objId, style, value) 
  {
  document.getElementById(objId).style[style] = value;
  }

var xmlhttp = false;
try
  {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
catch (e)
  {
  try
    {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
  catch (e)
    {
    xmlhttp = new XMLHttpRequest();
    }
  }

function emailSubmit(email)
  {
  xmlhttp.open("GET", "/ajax/event_email.php?email=" + email);
  xmlhttp.onreadystatechange = handleResponse;
  xmlhttp.send(null);
  }


function handleResponse()
  {
  var line;

  if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
    {
    var response = xmlhttp.responseText;
    
	switch(response)
	  {
	  case "success":
	    document.getElementById("emailform").innerHTML = "Thank You! An email confirmation has been sent to your email address.";
	    break;
	  case "confirmed":
	    alert("Your Email is already on file.");
		document.getElementById("emailform").innerHTML = "Your Email is already on file.";
	    break;
	  case "unconfirmed":
	    alert("Your Email is already on file, but you need to click on the link in the confirmation email we sent you.");
		document.getElementById("emailform").innerHTML = "Your Email is already on file, but you need to click on the link in the confirmation email we sent you.";
	    break;
	  case "fail":
	    alert("There was a problem processing your request, please try again later");
	    break;
	  }

	setStyle("curtain", "visibility", "hidden");
	setStyle("lro-lcross-launch", "visibility", "visible");
	setStyle("lcross-movie", "visibility", "visible");  
	setStyle("container", "overflow", "visible");
	setStyle("container", "height", "auto");  
    }
  }
