/*
 ***************************************
 *		jQuery for Contact Us
 ***************************************
 */
function jQueryLocalFunctions()
{
	// hide previous response on new upload attempt
	$('input#upload').click(hideResponse);
	
	// form validation
    var options   = { 
        target:			'#contactResponse',		// target element(s) to be updated with server response 
        url:			'contact/contact.php',	// override for form's 'action' attribute 
        beforeSubmit: 	showStatusbar,       	// pre-submit callback 
        success:    	showResponse,       	// post-submit callback 
	    resetForm:  	true
		}; 
	
	var container = $('#formErrors');
	var v = $("#verticleForm").validate({
		submitHandler: function(form) {
			$(form).unbind('submit').find(':submit,input:image').unbind('click');
			$(form).ajaxSubmit(options);
			return false; 
		},
		errorContainer: container,
		errorLabelContainer: $("ul", container), 
		wrapper: "li",
		meta: "validate",
		onkeyup: false,
		onblur: false,
		onsubmit: true, 
		rules: {
			cname   : "required"
		,	cemail  : {required:true, email:true}
		,	ctype   : "required"
		,	cinquiry: "required"
		},
		messages: {
			cname   : "Your name"
		,	cemail  : "Your email address"
		,	ctype   : "What is your inquiry about?<br>&hellip; a new home, extension, renovation or other"
		,	cinquiry: "Your inquiry"
		}
	});
}

// pre-submit callback 
function showStatusbar() {
	$('#contactResponse')
		.hide("normal",
			  function(){
					$('#statusBar').show();
			  });
	
}

// post-submit callback 
function showResponse()  { 
	$('#statusBar').hide();
	$('#contactResponse').show();
}
 
// post-submit callback 
function hideResponse()  { 
	$('#contactResponse').hide();
} 

