// ADAM JANKOWSKI		
// http://adam.magnolia.pl  		

// EYE - project             

function gLs(ln){
   return document.getElementById?document.getElementById(ln).style:document.all?document.all[ln].style:document.layers[ln]
}
function gL(ln){
   return document.getElementById?document.getElementById(ln):document.all?document.all[ln]:document.layers[ln]
}
function Layer(id) {
   this.id=id;
   this.n4 = (document.layers)? true:false
   this.i4 = (document.all)   ? true:false; 
   
   this.show = function(){
          var Ls=gLs(this.id);
		  if(this.n4)   Ls.visibility = "show";
   		  else     Ls.visibility = "visible";
   }
   this.hide = function(){
          var Ls=gLs(this.id);
   		  if(this.n4)   Ls.visibility = "hide";
   		  else     Ls.visibility = "hidden";
   }
   this.moveTo = function(x,y) {
    	  var Ls=gLs(this.id);
    	  Ls.left = x;
		  Ls.top  = y;
   }
   this.moveBy = function(dx,dy) {
         var Ls=gLs(this.id);
  		 if(this.n4) {
    		   Ls.left += dx;
			   Ls.top += dy;
		 }  
  		 else {
    		   var L=gL(this.id);
    		   Ls.left = L.offsetLeft + dx;
    		   Ls.top = L.offsetTop + dy;
  		 }
   }	
   this.setOpacity = function(opacity) {
         this.opacity=opacity;
		 mopacity = parseFloat(opacity)/100;
         var Ls=gLs(this.id);
		 if (this.i4)
    	 	Ls.filter = 'alpha(opacity = ' + opacity + ')';
  		 else if (!this.n4){
		    Ls.MozOpacity = mopacity;
			this.hide(); 
			this.show();			   
			}
   }
   this.clipTo = function( t, r, b, l) {
   		 var Ls=gLs(this.id);
  		 if(this.n4) {
       	    Ls.clip.top = t;
       		Ls.clip.right = r;
       		Ls.clip.bottom = b;
       		Ls.clip.left = l;
         } else 
     	    Ls.clip = "rect(" + t + " " + r + " " + b + " " + l + ")";
   }
   this.setCss = function(p_name,value) {
         var temp=p_name.indexOf("-");
		 if(temp>0){
		    s1=p_name.substring(0,temp);
		  	s2=p_name.substring(temp+1,p_name.length);
		  
		  	s21=s2.substring(0,1);
		  	s22=s2.substring(1,s2.length);
		  	s21=s21.toUpperCase();
		    
		  	s2=s21+s22;
		  
		  	p_name=s1+s2;
			}
		 var Ls=gLs(this.id);
		 eval("Ls."+p_name+"="+"'"+value+"'");		
   }
   this.getPos = function() {
   		 var L=gL(this.id);
  		 if(this.n4) {
    	    this.left =  L.left;
    		this.top =  L.top;
         } else  {
    	    this.left = L.offsetLeft;
    		this.top = L.offsetTop;
  		 }
   }
   this.getH = function() {
   		 var L=gL(this.id);
  		 if(this.n4) {
    	 	this.height = L.document.height;
  		 } else {
    	    this.height = L.offsetHeight;  
   		 }		
   }
   this.getW = function() {
   		 var L=gL(this.id);
  		 if(this.n4) {
    	 	this.width = L.document.width;
  		 } else {
    	   	this.width = L.offsetWidth;  
  		 }
   }
   this.writeIn=function (tekst) {
   		 var L = gL(this.id);
  		 if(this.n4) {
      	 	 L.document.open();
      		 L.document.write(tekst);
      		 L.document.close();    
  		 } else  {
    	     L.innerHTML = tekst;
  		 }
   }
}		 

function _getScroll(){
 this.i4 = (document.all) ? true:false;

 if(!this.i4) { 
 			  this.scrollY = self.pageYOffset;
			  this.scrollX = self.pageXOffset;
 }
 else { 
              this.scrollY = document.body.scrollTop;
			  this.scrollX = document.body.scrollLeft;
 }	
}

function init(){
this.getScroll();
this.getSize();
}

function _getSize(){
  this.i4 = (document.all) ? true:false;
  if(this.i4){
   this.width=document.body.clientWidth;
   this.height=document.body.clientHeight;
  }else{
   this.width=window.innerWidth-16;
   this.height=window.innerHeight
  }
}

W = {getAll:init,getSize:_getSize,description:'Window data container',getScroll:_getScroll};
