
$(document).ready(function()
{
  $("#loading").bind("ajaxSend", function() {
    $(this).show();
 	}).bind("ajaxComplete", function() {
  $(this).hide();
 	});
})


// Load a URL with an XML-http request, with parameters passed to this URL, using AJAX & JQuery, with a fading animation.
function loadAJAX (file,object) {
 $("#"+object).hide();
 $("#"+object).load (file, function(){
   $("#"+object).fadeIn("slow");
 }); 
 return file;
 return object;
}


// Same function as above, but without the fading animation, to avoid z-index and textarea focus issues, with TinyMCE and other libraries/editors.
function loadAJAX_no_anim (file,object) { 
  $("#"+object).load (file);
  return file; 
  return object; 
}


// Post data to a URL and then load this URL, using AJAX & JQuery.
function postAJAX(postdata,file,object){
  $("#"+object).hide();
   $.ajax({
   type: "POST",
   url: file,
   data: postdata,
   success: function(msg){
     $("#"+object).html(msg);
     $("#"+object).fadeIn();
   }
 });
}
