jQuery(document).ready(function() {
	
	var options = {
		target: '#FormContainer', // target element(s) to be updated with server response
		beforeSubmit: showLoading,
		success: showResponse // post-submit callback
	};
	$('#Form_Form').ajaxForm(options);
});
function showLoading(formData, jqForm, options) {
	if($('#Form_Form').validate().form()) {
		$('#Form_Form_action_SendContactForm').attr("disabled", "disabled");
		$('#Form_Form_action_SendContactForm').attr("value", "Sending...");
		return true;
	} else {
		return false;	
	}
}
function showResponse(formData, jqForm, options) {
   	$("#FormStatus").html("<p>Thank you.</p>");
}
$("#Form_Form").validate({
	rules: {
		Name: { required: true },
		Email: { required: true, email: true },
		Comments: { required: true }
	},
	messages: {
		Name: "Please enter your name.",
		Email: "Please enter a valid email address.",
		Comments: "Please enter your message."
	},
	errorPlacement:function(error, element){
		error.appendTo( $('<div class="message"></div>').appendTo(element.parent()) );
	}
});