$(document).ready(function(){

	
	// Contact form
	$("form#contact_form").submit(function() {
		
		//Setup any needed variables
		var input_name  = $('#name').val(),
		input_email     = $('#email').val(),
        input_phone     = $('#phone').val(),
        input_company   = $('#company').val(),
		input_subject   = $('#subject').val(),
		input_message   = $('#message').val(),
		response_text   = $('#main_content #response');
		
		//Hide any previous response text
		response_text.hide();

		//Change response text to 'loading...'
		response_text.html('<p>Loading...</p>').show();

		//Make AJAX request
		$.post('sendmail.php', {name: input_name, email: input_email, phone : input_phone, company : input_company, subject: input_subject, message: input_message}, function(data){
			response_text.html(data);
		});

		//Cancel default action
		return false;
		
	});
	
});
