jQuery.extend({
    showLoading: function(mainElement, loadingElement) {
        $(document.body).data("LoadingElementId", loadingElement);
        $(loadingElement).fadeTo("fast", 0.8).show();
    },
    hideLoading: function() {
        var loadingElement = $(document.body).data("LoadingElementId");
        $(loadingElement).fadeTo("slow", 0).hide();
        $(document.body).removeData("LoadingElementId");
    }
});