

$(document).ready(function(){
    //Load the form
    $("#popupArea").hide();
    $("#popupArea").load(rel_home+"/email.html", pageLoadDone);
});

function pageLoadDone(){
  $("#emailForm").submit(function(){
      var options={ target: '#popupArea', beforeSubmit: showRequest, success:showResponse};  
      $(this).ajaxSubmit(options);    
      return false;
  });

}

$(document).ready(function(){
	//$().ajaxError(function(ev, xhr, opts, err){
	//     alert(err);
	//});
});

function showRequest(formData, jqForm, options){
  alert("showRequest");
}
 
function showResponse(responseText, statusText){
alert("showRequeset");
}

function emailPopup(){
    $("#popupArea").hide();
     $("#popupArea").dialog({width: 300, height: 260, resizable: false});
    $("#popupArea").show("slow");

}


function submitEmail(){
  //Validate
  var email1 = document.getElementById("l258304-258304").value;
  var email2 = document.getElementById("email2").value;
  var name = document.getElementById("name").value;

  if(name == ''){
  alert("Please enter a name.");
  return;
  }

  if(email1 == '' || email2 == ''){
  alert("Please enter an email.");
  return;
  }

  if(email1 != email2){
  alert("Emails do not match.  Please retype them.");
  return;
  }


 document.getElementById("emailForm").submit();
}

function closeEmail(){
     $("#popupArea").dialogClose();
}




