// jQuery handles ajax form submission
$(function(){
	$('#agileForm').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:
				$('#agileForm #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 requesting our free white paper. We will get back to you as soon as possible.'){
					$('#agileForm').css({'position':'relative', 'right':'-9999px'});  // hide form
				}
		});
		return false;
	});
});