function showEmailBox() {
    document.getElementById("splash_sign_up").style.display = "block";
}

function hideEmailBox() {
    document.getElementById("splash_sign_up").style.display = "none";
}

function clearEmail() {
    document.forms['splash_email'].email_address.value = "";
    document.forms['splash_email'].email_address.style.color = "#000000";
}

function clearEmailListEmail() {
    document.forms['email_list'].email_address.value = "";
    document.forms['email_list'].email_address.style.color = "#000000";
}

function validateEmail() {
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    var email = document.forms['splash_email'].email_address.value;

    if(email.length <= 0)
        {
          alert('Email address field empty, please enter a valid email address and press submit.')
          return false;
        }
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) {
        alert('The email address you have entered is invalid, please check the address again and resubmit.');
        return false;
    }
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) {
          alert('The email address you have entered is invalid, please check the address again and resubmit.')
          return false;
      }
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
            var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
            if(splitted[2].match(regexp_ip) == null) {
                alert('The email address you have entered is invalid, please check the address again and resubmit.')
                return false;
            }
      }// if
      return true;
    }
    alert('The email address you have entered is invalid, please check the address again and resubmit.');
    return false;
}

function validateEmailListEmail() {
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    var email = document.forms['email_list'].email_address.value;

    if(email.length <= 0)
        {
          alert('Email address field empty, please enter a valid email address and press submit.')
          return false;
        }
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) {
        alert('The email address you have entered is invalid, please check the address again and resubmit.');
        return false;
    }
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) {
          alert('The email address you have entered is invalid, please check the address again and resubmit.')
          return false;
      }
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
            var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
            if(splitted[2].match(regexp_ip) == null) {
                alert('The email address you have entered is invalid, please check the address again and resubmit.')
                return false;
            }
      }// if
      return true;
    }
    alert('The email address you have entered is invalid, please check the address again and resubmit.');
    return false;
}

function maintenance() {
    alert('We are currently migrating our subscription system to better serve our readers.  The new system will be in place on Friday, March 6, 2009.  Please check back then if you wish to purchase a subscription or you may call 800.833.0159 to place a phone order.');
}
