addCss(URL + 'application/js/lightBox/css/lightBox.css');
var lightBox = function()
{
	this.parentArea = null;
	this.area = null;
	this.areaTarget = null;
	this.closeButton = null;
	this.onContent = function(){ return; };

	if(arguments.length>0) this.init( arguments );

};

lightBox.prototype.createArea = function( $content , $target ) {
	if(this.area) return;
	var $target = isset($target) ? $target : document.body;

	var ua = usefullArea();
	var h = document.body.offsetHeight>ua['y']  ? document.body.offsetHeight : ua['y'];

	this.parentArea =  cE("div", $target, 'parentLightBoxArea');
	this.parentArea.style.width = document.body.offsetWidth + 'px';
	this.parentArea.style.height = h + 'px';

	this.area =  $(cE("div", $target, 'lightBoxArea'));

	this.closeButton = cE('a', this.area, 'closeLightBoxArea');
	this.closeButton.innerHTML = "fechar";
	this.closeButton.setAttribute("href", "javascript:;");
	var o = this;
	this.closeButton.onclick = this.parentArea.onclick = function() {
		DOM.rem(o.area);
		DOM.rem(o.parentArea);
		o.area=null;
	};

	centralizeElement(this.area);

	this.areaTarget = $(cE('div', this.area, 'lightBoxAreaTarget'));
	this.areaTarget.style.display='none';

	if($content)
		this.contents($content);

};


lightBox.prototype.contents = function( $content )
{
	if($content.substring(0,7)=='http://' && typeof Ajax=='function')
	{
		var a = new Ajax(),o=this;
		a.onComplete = function(r){
			o.contents(r[0]);
		}
		a.callServer($content);
		return;
	}

	this.areaTarget = this.areaTarget.replaceHTML($content);

	this.showArea();

}

lightBox.prototype.showArea = function()
{
	this.areaTarget.style.display='block';
	this.areaTarget.style.cssFloat='left';

	var w = this.areaTarget.offsetWidth;
	this.area.style.width = (w>750 ? 750 : w) + 'px';

	this.onContent( this.area );

	centralizeElement(this.area);
}