// 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;
         var Ls=gLs(this.id);
		 if (this.i4)
    	 	Ls.filter = 'alpha(opacity = ' + opacity + ')';
  		 else if (!this.n4){
		    Ls.MozOpacity = opacity + '%';
			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};

function showFLV(){
	var L = new Layer('tlo');
	L.show();
}

function hideFLV(){
	var L = new Layer('tlo');
	L.hide();
}

function ov(id){
	var L = new Layer(id);
	L.setCss('background','#FFFFFF');
	L.setCss('opacity','.2');
	L.setCss('filter','alpha(opacity=20)');
}

function out(id){
	var L = new Layer(id);
	L.setCss('background','transparent');
}

function open_projektor(){
	var T =  new Layer('tlo');
	var P = new Layer('projektor');
	var L = new Layer('myFlash');
	var w = screen.width;
	T.show();
	L.writeIn('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="352" height="288" id="reklama" align="middle">	<param name="allowScriptAccess" value="sameDomain" />	<param name="movie" value="reklama.swf" />	<param name="quality" value="high" />	<param name="bgcolor" value="#ffffff" />	<embed src="reklama.swf" quality="high" bgcolor="#ffffff" width="352" height="288" name="reklama" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />	</object>');	
	L.show();
	P.setCss('left',Math.abs((screen.width-362)/2)+'px');
	P.show();
}

function close_projektor(){
	var L = new Layer('myFlash');
	var P = new Layer('projektor');
	var T =  new Layer('tlo');
	P.hide();
	T.hide();
	L.hide();
	L.writeIn('');
}
	