var shouldEraseFirstNamePrompt = 1;
var shouldEraseLastNamePrompt = 1;
var shouldEraseEmailPrompt = 1;

function clickedInFirstNameBox()
    {
    if (shouldEraseFirstNamePrompt)
        {
        document.forms['email_signup_form'].form_first_name.value = "";
        document.getElementById("form_first_name").style.color="#000000";
        shouldEraseFirstNamePrompt = 0;
        }
    }

function clickedInLastNameBox()
    {
    if (shouldEraseLastNamePrompt)
        {
        document.forms['email_signup_form'].form_last_name.value = "";
        document.getElementById("form_last_name").style.color="#000000";
        shouldEraseLastNamePrompt = 0;
        }
    }

function clickedInEmailBox()
    {
    if (shouldEraseEmailPrompt)
        {
        document.forms['email_signup_form'].form_email.value = "";
        document.getElementById("form_email").style.color="#000000";
        shouldEraseEmailPrompt = 0;
        }
    }

 
function emailSubmitFunc()
    {
    //alert(document.email_signup_form.form_email.value);
    var first_name_form_value;
    var last_name_form_value;
    var email_form_value;
    
    first_name_form_value = document.email_signup_form.form_first_name.value;
    //last_name_form_value = document.email_signup_form.form_last_name.value;
    email_form_value = document.email_signup_form.form_email.value;

    if ((first_name_form_value.length == 0) || (first_name_form_value == "First Name"))
        alert("Please enter your first name.")
    else if ((email_form_value.length == 0) || (email_form_value.indexOf('@') == -1))
        alert("Please enter a valid email address.")
    else if (document.email_signup_form.form_other.value.length > 0)
        alert("Please leave final field blank.")
    else
        document.email_signup_form.submit();
        //alert("Coming soon!");    
    }


function setSession(my_variable, my_value)
    {
    //alert("my_variable: "+my_variable+", my_value: "+my_value);
    var xmlhttp;
    var my_text;
    
    var my_string;
    
    my_string = String(my_value);
    
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    
    /*
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        var my_response = xmlhttp.responseText;
        if (my_response.length)
            alert(my_response);
    
        location.href = "directory.php";    
        }
      }
      */
    xmlhttp.open("POST","../AJAX/AJAX_session.php",true);
    xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    my_string = my_string.replace(new RegExp("&", "g"), "AMPERSANDDNASREPMA");
    my_send = "my_variable="+my_variable+"&my_value="+my_string;
    //alert(my_send);
    xmlhttp.send(my_send);
    }    
