
$(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.
// We also style the form controls with "Uniform"
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, when loading
// elements using TinyMCE or other such other libraries/editors.
// This is also needed in cases where we dynamically have to toggle the object's visibility on mouse-over, like in the
// bottom "user menu" floating bar.
// We also style the form controls with "Uniform"
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();
    }
  });
}