function LayerBlocker() {
	var args = $A(arguments);
	if (args.length == 1)
		this.opacity = args[0];
	else
		this.opacity = 0.7;
	
	this.resizeFunc = null;
	//this.create();
	this.blockerObj = null;
}

LayerBlocker.prototype.createObject = function() {
	this.blockerObj = new Element('div');
	
	var windowSize = document.viewport.getDimensions();
	var scrollPosition = document.viewport.getScrollOffsets();
	this.blockerObj.setStyle({
		'position': 'absolute',
		'top': scrollPosition.top + 'px',
		'left': scrollPosition.left + 'px',
		'backgroundColor': '#000000',
		'width': windowSize.width + 'px',
		'height': windowSize.height + 'px',
		'display': 'none',
		'zIndex': 1000
	});
	this.blockerObj.setOpacity(this.opacity);
	document.body.appendChild(this.blockerObj);
	
	this.resizeFunc = LayerBlocker.ResizeHandler.bindAsEventListener(this);
	Event.observe(window, 'resize', this.resizeFunc);
	Event.observe(window, 'scroll', this.resizeFunc);
	
	var layerBlockerObj = this;
	Event.observe(document, 'unload', function() {
		layerBlockerObj.unload();
	});
};

LayerBlocker.prototype.unload = function() {
	Event.stopObserving(window, 'resize', this.resizeFunc);
	Event.stopObserving(window, 'scroll', this.resizeFunc);
};

LayerBlocker.prototype.show = function() {
	if (this.blockerObj == null)
		this.createObject();
	this.blockerObj.show();
};

LayerBlocker.prototype.hide = function() {
	if (this.blockerObj != null)
		this.blockerObj.hide();
};

LayerBlocker.ResizeHandler = function(event) {
	var windowSize = document.viewport.getDimensions();
	var scrollPosition = document.viewport.getScrollOffsets();
	
	this.blockerObj.setStyle({
		'left': scrollPosition.left + 'px',
		'top': scrollPosition.top + 'px',
		'width': windowSize.width + 'px',
		'height': windowSize.height + 'px'
	});
};