$(document).ready(function() {
	$("#commentForm").validate();
	
});

function doContact(){

	if ( $("#commentForm").valid() ){
		
		$("#message").html('Processing your request...');
		
		$("#commentForm").ajaxSubmit({
			url: '/contact/contact_process.php',
			dataType: 'json',
			success: function(json) {
				var jsonData = eval(json);
				if (jsonData['error'] != '') alert(jsonData['error']);
				if (jsonData['success'] == true || jsonData['success'] == 'true') {
					$('#message').html('Enquiry sent succesfully...');
					location.href = '/contact/thank_you.php?ref_no='+jsonData['ref_no'];
				}
			}
		});
		
	} else {
		window.status = 'One or more of your fields have a validation error, please check what is filled in.';
	}
}
