$(document).ready(function() {
	//pre-submit callback
	function showContactRequest(formData, jqForm, options){
		var errorMsg = '';
		if($("#contact_name").val() == ''){
			errorMsg += "Please enter your name.<br/>";
		}
		if($("#contact_email").val() == ''){
			errorMsg += "Please enter your email address.<br/>";
		}
		if($("#contact_phone").val() == ''){
			errorMsg += "Please enter your phone number.<br/>";
		}
		if($("#contact_msg").val() == ''){
			errorMsg += "Please enter your message.<br/>";
		}
		if(errorMsg != ''){
			$.prompt(errorMsg);
			return false;
		}
		$.blockUI({ 
			css: { 
				border: 'none', 
				padding: '15px', 
				backgroundColor: '#000', 
				'-webkit-border-radius': '10px', 
				'-moz-border-radius': '10px', 
				opacity: '.5', 
				color: '#fff' 
			},
			message: '<h1>Sending Message...</h1>'
		}); 
		return true;
	}
			
	//post-submit callback
	function showContactResponse(responseText, statusText){
		$.unblockUI();
		if(responseText.response == 'true'){
			$("#frmContact").resetForm();
		}
		$.prompt(responseText.msg);
	}
	//	Form Execution
	$("#frmContact").ajaxForm({
		beforeSubmit:showContactRequest,
		success:showContactResponse,
		url:"http://www.md-review.com/resources/library/processors/proc.Contact.php",
		type:"post"
	});
});
