jQuery(document).ready(function(){
    $('#commentForm').submit(function(){
    	var action = $(this).attr('action');
    	$('#response').remove();
    	$('#commentForm')
    		.before('<div id="process" class="loader"><p><img src="img/ajax-loader.gif" /></p></div>')
    		.attr('disabled','disabled');		 
    	$.post(action, { 
    		name: $('#name').val(),
    		email: $('#email').val(),
    		phone: $('#phone').val(),
    		comments: $('#comments').val(),
    		type: $('#type').val(),
    		username: $('#username').val(),
    		formStatus: $('#formStatus').val(),
    		token: $('#token').val()
    	},
    	function(data){
    		$('#commentForm #submit #process').attr('disabled','');
    		$('#process').remove();
    		$('#response').remove();
    		$('#commentForm').before('<span id="response">'+data+'</span>');
    		$('#response').slideDown();
    		$('#commentForm div.loader').fadeOut(500,function(){$(this).remove()});
    		if(data=='<p class="green">Email sent successfully!.  Thank you for your inquiry, someone from Upperhand Creation will contact you shortly if necessary.</p>') $('#commentForm').slideUp();
    		}
    	);		 
    	return false;		 
	});		 
});
