$(document).ready(function(){

var options = {
    target:        '#bodyajax',   // target element(s) to be updated with server response 
    beforeSubmit:  showRequest,
	success:       showResponse  // post-submit callback 
}; 
$('form').submit(function() { 
        $(this).ajaxSubmit(options); 
        return false; 
}); 

});

function showRequest(formData, jqForm, options)  {
    $('#bodyajax').hide().empty();
	$('#mywait').fadeIn();
}

function showResponse(responseText, statusText)  {
		$('#mywait').hide();
		$('#bodyajax').fadeIn();
}

var request_in_progress = false;
function jGet(page) {
	if (request_in_progress)
		return;
	$('#bodyajax').hide().empty().load(page+'', function() {
		request_in_progress = false;
		$('#mywait').hide();
		$(this).fadeIn();
	});
	$('#mywait').fadeIn();
	request_in_progress = true;
}

