$(document).ready(function() {



	// Our Wonderful Menu
	// $('#main-menu li a').hover(function() {
		// mouse over
	//	var listItem = $(this).parent("li");
	//	$(this).css({'color' : '#000000'});
	//	$(listItem).css({'background-color' : '#d0d7dc'}); //d0d7dc
	//	},
	//	function() {
		// mouse out	
	//	var listItem = $(this).parent("li");	
	//	$(this).css({'color' : '#1f3138'});	
	//	$(listItem).css({'background-color' : 'transparent'});
	// });


	// Hide Loading and Output Elements
	$("#loader").hide();
	$("#filter").hide();		
	
		
	// Setup Form Submit Options
	var options = {
		beforeSubmit: function() {
		$('#loader').fadeIn(50);
		},
		dataType: 'json',
		success: processJson
		}
	
	
	// Form Submit Function
	function processJson(data) {
		var status = data.status;
		$('#loader').fadeOut(300);		
				
		// If Fields are Empty
		if(status == 1) {$('#output').hide().empty().fadeIn(150).append("<p class='output'>You must fill in all required fields.</p>");}
		
		// If Name is Wrong
		if(status == 2) {$('#output').hide().empty().fadeIn(150).append("<p class='output'>Your name must be between 3 and 30 characters.</p>");}								
		
		// If Spam Bot
		if(status == 3) {$('#output').hide().empty().fadeIn(150).append("<p class='output'>Leave the spam field blank please.</p>");}
		
		// If Fields are Empty
		if(status == 4) {$('#output').hide().empty().fadeIn(150).append("<p class='output'>Your email address was not valid.</p>");}
		
		// If Probems
		if(status == 6) {$('#output').hide().empty().fadeIn(150).append("<p class='output'>There was a problem sending the form.</p>");}
		
		// If Message Sent
		if(status == 5) {
						
			$('#quick-form #output').hide(50);								
			$('#quick-form form').slideUp(600);	
			$('#quick-form #thankyou').hide().append("<h6>Thank You.</h6><p class='output'>Your message has been sent.</p>").slideDown(600);														
			$('#loader').fadeOut(500);
			return false;						
		
		}// End of Status 5
						
	} 
	// End of processJson
	

	$('#quick-form form').ajaxForm(options);

});
