// jQuery handles ajax form submission
$(function(){
	$('#contactForm').submit(function(){
		var action = $(this).attr('action');
		$.post(action,
			{ // ALL THE DATA:
			name: $('#name').val(),
			email: $('#email').val(),
			phone: $('#phone').val(),
			message: $('#message').val()
			},
			function(data){ // WHEN DATA HAS BEEN POSTED:
				$('#contactForm #submit').attr('disabled',''); // Enable use of submit button again
				$('div#form-message').empty(); // Remove any previous instances of the "#form-message" message
				$('div#form-message').html(data); // Add response to document
				$('div#form-message').slideDown() // Cool effect
				if(data=='Thank you for contacting us. We will get back to you as soon as possible.'){
					$('#contactForm').css({'position':'relative', 'right':'-9999px'});  // hide form
				}
		});
		return false;
	});
});