$(document).ready(function() {

		

	$('#email').focus(function() {

		if ($(this).val() == 'email address') $(this).val('');

	});

	$('#email').blur(function() {

		if ($(this).val() == '') $(this).val('email address');

	});

	

	$('#submit').click(function(){

			$('#submit').hide();

			$('#bepatient').show();

	});



});



$(function() {

  $('.error').hide();



  $("#contact").submit(function(e) {

	e.preventDefault();

		// validate and process form

		// first hide any error messages

    $('.error').hide();

		

		var email = $("input#email").val();

		if (email == "" || email == "email address") {

	      $("label#emailError").show();

	      $("input#email").focus();

		  $("#bepatient").hide();

		  $("#submit").show();

	      return false;

	    }

		

		var dataString = 'email='+email;

		

		$.ajax({

      type: "POST",

	  url: "php/process.php",

      data: dataString,

      success: function() {

		$('#contact fieldset').fadeOut(300, function() {  // when submit is clicked, fadeout form's fields

			$('#bepatient').hide();

			$('#check').fadeIn(1500, function() {  // then fadein the success message

  			  		});

  			});

      }

     });

    return false;

	});

});
