function Loading() {
    this.options = {
        targetDiv: null,
        imageBig: true,
        zIndex: 3,
        paddingTop: 0,
        paddingLeft: 0,
        marginTop: 0,
        marginLeft: 0,
        marginRight: 0,
        fade: true,
        fadeColor: "#D79090"
    };
    this.init = function (options) {
        this.options = $.extend(this.options, options);
        this.options.targetDiv = (typeof this.options.targetDiv == "string") ? $(this.options.targetDiv) : this.options.targetDiv;
        var loading = $('<img class="ajaxLoadingImage" src="' + baseUrl + "images/ajax-loader-" + (this.options.imageBig ? "big" : "small") + '.gif"></img>');
        loading.css({
            position: "absolute",
            "z-index": this.options.zIndex,
            "margin-top": this.options.marginTop,
            "margin-left": this.options.marginLeft,
            "margin-right": this.options.marginRight,
            padding: 0,
            top: (this.options.targetDiv.height() / 2) - (((this.options.imageBig) ? 16 : 8) / 2) + this.options.paddingTop - this.options.marginTop,
            left: (this.options.targetDiv.width() / 2) - (((this.options.imageBig) ? 16 : 8) / 2) + this.options.paddingLeft - this.options.marginLeft - this.options.marginRight
        });
        if (this.options.fade) {
            var overlay = $('<div class="ajaxLoadingOverlay"></div>');
            overlay.css({
                position: "absolute",
                "z-index": this.options.zIndex - 1,
                top: 0,
                left: 0,
                padding: 0,
                "margin-top": this.options.marginTop,
                "margin-left": this.options.marginLeft,
                "margin-right": this.options.marginRight,
                width: this.options.targetDiv.innerWidth() - this.options.marginLeft - this.options.marginRight,
                height: this.options.targetDiv.innerHeight() - this.options.marginTop,
                "min-height": this.options.targetDiv.innerHeight() - this.options.marginTop,
                opacity: 0.8,
                "background-color": this.options.fadeColor
            });
            this.options.targetDiv.append(overlay)
        }
        this.options.targetDiv.append(loading)
    };
    this.remove = function () {
        $(".ajaxLoadingImage", this.options.targetDiv).remove();
        $(".ajaxLoadingOverlay", this.options.targetDiv).remove()
    }
};
