/* code by nathan wittstock (milkandtang.com)
   made on a macintosh */

var contactOpen = false;

$(document).ready(function() { 
	$("#contact").validate({
		rules: {
			contactName: "required",
			contactEmail: { 
				email: true 
			}, 
			contactPhone: "required"
		},
		messages: {
			contactName: "Please enter your name",
			contactPhone: "Please enter a valid phone number"
		}
	});
	
	$('#contact').ajaxForm({target: '#emailResponse', beforeSubmit: showRequest, success: showResponse});
});

function showRequest(formData, jqForm, options) { 
	if($("#contact").valid()) return true; 
	return false;
} 
 
function showResponse(responseText, statusText)  {
	$("#contactForm").slideUp(500, function() {
		$("#emailResponse").slideDown(500);
		$("#closeResponse").slideDown(500);
	});
	
}
