$(function() {
  $('.email_error').hide();
  $("div#stafheader_error").show(); // initial header
  
  $(".button").click(function() {
	// validates email to a friend
	$('.email_error').hide();
	var youremail = $("input#youremail").val();
	if (youremail == "" || youremail == "Your Email") {
	      $("div#youremail_error").show();
	      $("input#youremail").focus();
	      return false;
	}
	var friendemail = $("input#friendemail").val();
	if (friendemail == "" || friendemail == "Friend's Email") {
		$("div#friendemail_error").show();
		$("input#friendemail").focus();
		return false;
	}
	
	
	var dataString = 'youremail='+ youremail + '&friendemail=' + friendemail;
  	//alert (dataString);return false;
  	
	$.ajax({
		type: "POST",
		url: "staf.php",
		data: dataString,
		success: function() {
  			$('.email_error').hide();
	      		$("div#stafsuccess_error").show();
		/*
			$('#contact_form').html("<div id='message'></div>");
			$('#message').html("<h2>Contact Form Submitted!</h2>")
			.append("<p>We will be in touch soon.</p>")
			.hide()
			.fadeIn(1500, function() {
				$('#message').append("<img id='checkmark' src='images/check.png' />");
			});
		*/
		}
	});
	return false;
  
	

  });
});