
jQuery.fn.ajaxLoader = function (conf) {
	var config = jQuery.extend({
		className:	'jquery-ajax-loader'
	}, conf);

	return this.each(function () {
		var t = jQuery(this);

		if (!this.ajaxLoader) {
			var offset = t.offset();
			var dim = {
				left:	offset.left, 
				top:	offset.top, 
				width:	t.outerWidth(), 
				height:	t.outerHeight()
			};

			this.ajaxLoader = jQuery('<div class="' + config.className + '"></div>').css({
				position:	'absolute', 
				left:		dim.left + 'px', 
				top:		dim.top + 'px',
				width:		dim.width + 'px',
				height:		dim.height + 'px'
			}).appendTo(document.body).hide();
		}

		this.ajaxLoader.show();
	});
};

jQuery.fn.ajaxLoaderRemove = function () {
	return this.each(function () {
		if (this.ajaxLoader) {
			this.ajaxLoader.fadeOut(500);
		}
	});
};