<!-- Begins

window.onerror = null;
var topMargin;
var slideTime = 1200;
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

var lanc;
var glob_symb;


function layerObject(id,left) {


	
if (ns6) {
this.obj = document.getElementById('floatLayer_'+id).style;
//this.obj.left = left;                        /// lewy inicjalizuje
this.obj.left=getxmarginLeft(document.getElementById('floatLayer_'+id));
this.obj.top=getymarginTop(document.getElementById('floatLayer_'+id))-15;

//eval('document.flang.topMargin_'+id).value = this.obj.top;

topMargin = this.obj.top;

return this.obj;
}
else if(ie4) {

this.obj = document.all['floatLayer_'+id].style;

//this.obj.left = left;                       //


this.obj.left=getxmarginLeft(document.all['field_'+id]);
this.obj.pixelTop=getymarginTop(document.all['field_'+id])-15;

//eval('document.flang.topMargin_'+id).value = this.obj.pixelTop;

topMargin = this.obj.pixelTop;

return this.obj;
}
else if(ns4) {
this.obj = document.layers['floatLayer_'+id];
//this.obj.left = left;                       //
this.obj.left=getxmarginLeft(document.layers['floatLayer_'+id]);
this.obj.top=getymarginTop(document.layers['floatLayer_'+id])-15;

//eval('document.flang.topMargin_'+id).value = this.obj.top;

topMargin = this.obj.top;

return this.obj;
   }
}

function layerSetup() {

	
var tab_symb = this.lanc.split(",");
var ile = tab_symb.length;

var tmp;

for (i=0;i<ile;i++)
{
  tmp = eval('document.flang.otwarty_'+tab_symb[i]).value;	

  if (tmp == 1) 
  {
	  floatLyr = new layerObject(tab_symb[i], pageWidth * .5);
	  //window.setInterval("main()", 10)
  }
}

window.setInterval("main()", 10);

}

function floatObject() {
if (ns4 || ns6) {
findHt = window.innerHeight;
} else if(ie4) {
findHt = document.body.clientHeight;
   }
} 

function main() {

	
	
// tutaj petla po symbolach
// (rozbija lanc na kawałki)
// glob_symb = wlasnie taki symbol	

var tab_symb = this.lanc.split(",");

var ile=tab_symb.length;

for (i=0;i<ile;i++)
{
this.glob_symb = tab_symb[i];	

//alert(this.name);

//this = eval('floatLayer_'+glob_symb);

//alert(eval('document.flang.topMargin_'+this.glob_symb).value);

var tmp = eval('document.flang.otwarty_'+this.glob_symb).value;

//alert(document.flang.otwarty_nowy);

//var tmp = document.flang.pole.value; 

if (tmp == 1)
{

if (ns4) {	
this.currentY = document.layers['floatLayer_'+this.glob_symb].top;     // prawy inicjalizuje
this.scrollTop = window.pageYOffset;
mainTrigger(this.glob_symb);
}
else if(ns6) {
this.currentY = parseInt(document.getElementById(eval('floatLayer_'+glob_symb)).style.top);
this.scrollTop = scrollY;
mainTrigger(this.glob_symb);
} else if(ie4) {
	
this.currentY = eval('floatLayer_'+glob_symb).style.pixelTop;
this.scrollTop = document.body.scrollTop;

document.all['floatLayer_'+glob_symb].style.visibility = "visible";

mainTrigger(this.glob_symb);

   }
   
} // otwarty
   
} // koniec petli
}


function mainTrigger(symb) {
var newTargetY = this.scrollTop + topMargin;
if ( this.currentY != newTargetY ) {
if ( newTargetY != this.targetY ) {
this.targetY = newTargetY;

floatStart();

}
animator();

}
}


function floatStart() {

	
	var now = new Date();
this.A = this.targetY - this.currentY;
this.B = Math.PI / ( 2 * this.slideTime );
this.C = now.getTime();
if (Math.abs(this.A) > this.findHt) {
this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt;
this.A = this.A > 0 ? this.findHt : -this.findHt;
}
else {
this.D = this.currentY;
   }


}



function animator() {
var nazwa_pola = 'floatLayer_'+this.glob_symb;
var now = new Date();
var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D;
newY = Math.round(newY);
if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < this.currentY )) {
if ( ie4 )eval('document.all.'+nazwa_pola).style.pixelTop = newY;
if ( ns4 )document.layers['floatLayer_'+this.glob_symb].top = newY;
if ( ns6 )document.getElementById('floatLayer_'+this.glob_symb).style.top = newY + "px";
   }
}

function start(lancuch) {
	
if (lancuch.length>0)
{
	
this.lanc = lancuch;

if(ns6||ns4) {
pageWidth = innerWidth;
pageHeight = innerHeight;


layerSetup();
floatObject();
}
else if(ie4) {
pageWidth = document.body.clientWidth;
pageHeight = document.body.clientHeight;
layerSetup();
floatObject();
   }
   
}   
   
}


function killBanner(symb)
{
	var x = getxmarginLeft(document.all['field_'+symb]); 	
	var y = getymarginTop(document.all['field_'+symb])-1;
	
	// tutaj ustawia wspolrzedne warstwy

//alert(otwarty_nowy);	
	
//tmp = eval('otwarty_'+symb);
//tmp = 0;

eval('document.flang.otwarty_'+symb).value = 0;



if (ns6) 
{			
var krzyzyk = document.getElementById('kwadr_krzyz_'+symb).style;	
krzyzyk.display='none';

this.obj = document.getElementById('floatLayer_'+symb).style;
this.obj.top = y;
this.obj.left=x;
mainTrigger(symb);
}


else if(ie4) 
{
		
var krzyzyk = document.all['kwadr_krzyz_'+symb].style;
krzyzyk.display='none';

this.obj = document.all['floatLayer_'+symb].style;
eval('floatLayer_'+glob_symb).style.pixelTop

this.obj.pixelTop = y;
this.obj.left=x;

this.obj.height = 1;

mainTrigger(symb);
}


else if(ns4) 
{		
var krzyzyk = document.layers['kwadr_krzyz_'+symb];
krzyzyk.display='none';	

this.obj = document.layers['floatLayer_'+symb];
this.top = y;     
this.obj.left=x;
mainTrigger(symb);
}



}

////////




///////////////////////////////////////////////


function getymarginTop(o){
 var ob=o;
 var oT=o.offsetTop;

 if (ob.tagName!="BODY") {
  while(ob.offsetParent.tagName!="BODY"){
   ob=ob.offsetParent;
   oT+=ob.offsetTop;
  }
 }
 return oT;
}

function getxmarginLeft(o){

 var ob=o
 var oL=o.offsetLeft;
 if (ob.tagName!="BODY") {
  while(ob.offsetParent.tagName!="BODY"){
   ob=ob.offsetParent;
   oL+=ob.offsetLeft;
  }
 }
 return oL;
 
}
