// Contact Form
$(document).ready(function(){

	// Highlighting Current Inputs/Labels
	$("#contact-form input,#contact-form textarea")
		.focus(function(){
			$(this).parents(".row").addClass('hover');
		})
		.blur(function(){
			$(this).parents(".row").removeClass('hover');
				// Validate Single Form Element
				$(this).valid();
		});
			
	// Main Form Validation/Submit
	$("#contact-form").validate({
		highlight: function(element, errorClass) {
			$(element).parents(".row").addClass(errorClass);
		},
		unhighlight: function(element, errorClass) {
			$(element).parents(".row").removeClass(errorClass);
		},
		errorElement: "span",
		errorPlacement: function(error, element) {
			error.appendTo(element.parent());
		},
		submitHandler: function(form) {
			// Disable Elements (To prevent double submission)
			$("#contact-form input[type='submit']").hide();
			$("#form").val("javascript");		
			// Post Data
			$.post("index.php",$("form").serialize(),function(data){
				// Response Message
				alert(data);
			});
			$("#contact-form input,#contact-form textarea,#contact-form select").attr("disabled","disabled");
		}
	});

});