var LiteBox = Class.create({

	initialize: function(){
	

		var _self = this;
		
		
	    this.bgcolor = '#000000';
		$$('body').each(function(obj){
		
		   id = obj.identify();
		   ih = document.documentElement.clientHeight || window.innerHeight;
		   if(ih > $(obj.id).getHeight())
		   _self.height = ih;
		   else
		  _self.height = $(obj.id).getHeight();
		  _self.body = obj;
		  
		});
		this.liteboxbg = document.createElement('div');
		    this.liteboxbg.innerHTML = 'Test';
			this.liteboxbg.style.cssText = 'width:100%;background-color:#000000;position:absolute;z-index:1000;left:0px;height:'+this.height+'px';
			
		    this.body.insertBefore(this.liteboxbg,this.body.firstChild);
		    this.liteboxbg.id = 'litebox';
		    $('litebox').setOpacity(0.5);
	     
	
	},
	
	callUrl: function(url,properties){
	
		

         if(!properties.width) properties.width = 800;
	     if(!properties.bg)    properties.bg = '#ffffff';
		 var div = document.createElement('div');
		 var pos = document.createElement('div');
		 var cls = document.createElement('div');
		 var a = document.createElement('a');
		 a.innerHTML = 'schlie&szlig;en[x]';
		 a.href = 'javascript:void(0)';
		   
                 
		 a.obj = this;
         	 a.onclick = function(){this.obj.liteboxbg.parentNode.removeChild(this.obj.liteboxbg);pos.parentNode.removeChild(pos);}
         	 cls.appendChild(a);
		     pos.style.cssText = 'width:100%;left:0px;position:absolute;z-index:1001;padding-top:20px;';
	         a.style.cssText = 'color:#000000;text-decoation:none;line-height:30px;margin:10px;';
			 cls.style.cssText = 'width:'+(properties.width+40)+'px;margin:0px auto;text-align:left;text-align:right;background-color:#ffffff';
		     div.style.cssText = 'width:'+properties.width+'px;padding:20px;background-color:'+properties.bg+';margin:0px auto;text-align:left;';
		     pos.appendChild(cls);
			 pos.appendChild(div);
			 this.liteboxbg.parentNode.insertBefore(pos,this.liteboxbg.nextSibling);
			 
			 
			 new Ajax.Request(url,{
			 
			 
			 	onComplete:function(r){
				div.innerHTML = r.responseText;
				try
				{
				document.documentElement.scrollTop = 1000;
                                $('litebox').style.height = (document.viewport.getScrollOffsets().top + document.viewport.getHeight())+'px';
				document.documentElement.scrollTop = 0;
				}catch(e){$('litebox').style.position = 'fixed';}
				
	
				
				}
				
			 
			 });

	}



});
