var AjaxLoader = new Class({
	
	initialize: function() {
	
		this.centerX = (window.getWidth()/2)-16;
		this.centerY = (window.getHeight()/2)-16;
		
		this.Overlay = new Element('div', {
			'id'    : 'BodyOverlay',
			'styles': {
	          		'display'           : 'none',
	          		'position'          : 'absolute',
	          		'top'               : '0',
	          		'left'              : '0',
	          		'opacity'           : 0.7,
	          		'z-index'           : 65554,
	          		'background-color'  : '#000',
	          		'height'            : window.getScrollHeight() + 'px',
	          		'width'             : window.getScrollWidth() + 'px'
				}
		});
		this.Picture = new Element('img', {
			 src: 'skins/default/img/loading.gif',
			 'styles': {
			 	'height' : '32px',
			 	'width' : '32px',
			 	'position' : 'absolute',
			 	'top' : this.centerY + 'px',
			 	'left' : this.centerX + 'px'
				}
		});
		
		this.Overlay.adopt(this.Picture);
		this.Overlay.injectInside(document.body);
	},

	show: function() {
		$('BodyOverlay').set('styles', {'display': 'block'});
	},

	hide: function() {
		$('BodyOverlay').set('styles', {'display': 'none'});
	}
});

window.addEvent('domready', function() {
	var ajaxLoader  = new AjaxLoader();
	// ajxLoader.show();
});		
