function upload() {
  $('whiteout').setStyle('opacity', 0).setStyle('display', 'block');
  new Fx.Morph('whiteout', { duration: 1000, link: 'cancel' }).start({ opacity : [0, .8]});
  $('signup_form').setStyle('display', 'block');
  return false;
}
function hide() {
  $('whiteout').setStyle('display', 'none');
  $('signup_form').setStyle('display', 'none');
  return false;
}
function validate(form) {
  return true;
}
function vote() {
  return true;
}
window.addEvent('domready', function() {
  var share_links = $$('#share a');
  share_links[0].href = "http://twitter.com/home?status="+encodeURIComponent(window.location.href);
  share_links[1].href = "http://www.facebook.com/share.php?u="+encodeURIComponent(window.location.href)+"&t="+encodeURIComponent(document.title);
});
function imposeMaxLength(Event, Object, MaxLen) {
/*  if(Object.value.length > MaxLen)
    $('table td.caption:eq(1)').css('color', 'red');
  else
    $('table td.caption:eq(1)').css('color', 'black');*/
  return (Object.value.length <= MaxLen)||(Event.keyCode == 8 ||Event.keyCode==46||(Event.keyCode>=35&&Event.keyCode<=40))
}
var emailform;
function email_validate(form) {
  var query_string;
  emailform = form;
  if(form.elements[0].value.length > 0) {
    query_string = 'ajax=true&email='+form.elements[0].value;
    new Request({
      url: "http://www.elementbyfuego.com/addemail.php",
      method: "post",
      onSuccess: function(responseText, responseXML) {
        if(responseText == "success")
          form.innerHTML = '<strong>Join Our Mailing List!</strong><br />Submission Successful';
        else {
          alert('An error has occurred with your submission');
          if(emailform && emailform.elements[0] != null)
            emailform.elements[0].focus();
        }
      },
      onFailure: function() {
        alert('An error has occurred with your submission');
          if(emailform && emailform.elements[0] != null)
            emailform.elements[0].focus();
      }
    }).send(query_string);

  } else {
    alert('Invalid Email');
    form.elements[0].focus();
  }

  return false;
}