// Wersja dla www.krakus.net
function SprawdzPrzegladarke() {
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v = parseInt(this.version);
	this.dom = (document.getElementById)?1:0;
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.dom && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie4 = (this.version.indexOf('MSIE 4')>0);
	this.ie5 = (this.version.indexOf('MSIE 5')>0);
	this.min = (this.ns||this.ie);
}

to = new SprawdzPrzegladarke();

function Warstwa(id,parent_id,grandparent_id,supergrandparent_id,no_iframe) {
	if(to.ns4) {
		this.css = (supergrandparent_id)? eval("document." + supergrandparent_id + ".document." + grandparent_id + ".document." + parent_id + ".document." + id) : (grandparent_id)? eval("document." + grandparent_id + ".document." + parent_id + ".document." + id) : (parent_id)? eval("document." + parent_id + ".document." + id) : document.layers[id];
		this.elm = this.css;
		this.x = this.startX = this.css.left;
		this.y = this.startY = this.css.top;
		this.wys = this.css.clip.height;
		this.szer = this.css.clip.width;
	}
	if(to.dom) {
		this.css = document.getElementById(id).style;
		this.elm = document.getElementById(id);
		this.x = this.startX = this.elm.offsetLeft;
		this.y = this.startY = this.elm.offsetTop;
		this.wys = this.elm.offsetHeight;
		this.szer = this.elm.offsetWidth;
	}
	if(to.ie) {
		this.css = (no_iframe)? document.all[id].style : parent.document.all[id].style;
		this.elm = (no_iframe)? document.all[id] : parent.document.all[id];
		this.x = this.startX = this.elm.offsetLeft;
		this.y = this.startY = this.elm.offsetTop;
		//this.wys = (to.ie4)? this.css.pixelHeight : this.elm.offsetHeight
		//this.szer = (to.ie4)? this.css.pixelWidth : this.elm.offsetWidth
		this.wys = (to.ie4)?  this.elm.scrollHeight : this.elm.offsetHeight;
		this.szer = (to.ie4)?  this.elm.scrollWidth : this.elm.offsetWidth;
	}
	this.pokaz = PokazWarstwe;
	this.schowaj = SchowajWarstwe;
	this.przeniesDo = PrzeniesWarstweDo;
	this.przeniesO = PrzeniesWarstweO;
	this.przesunDo = PrzesunWarstweDo;
	this.wpisz = WpiszDoWarstwy;
	this.laduj = LadujDoWarstwy;
	this.zaladowane = ZaladowanaWarstwa;
	this.scrollUp = ScrollUp;
	this.scrollDown = ScrollDown;
	this.scrollStop = ScrollStop;
	this.scroll = false;
	this.scrollTimer;
	this.obj = id + "Objekt";
	eval(this.obj + "=this");
}	
function PokazWarstwe() {
	this.css.visibility = (to.ns4)? "show" : "visible";
	this.widoczna=true;
}
function SchowajWarstwe() {
	this.css.visibility = (to.ns4)? "hide" : "hidden";
	this.widoczna=false;
}
function PrzeniesWarstweDo(x,y) {
	if (x!=null) {
		this.x = x;
		if (to.ns4 || to.ns5) this.css.left = this.x;
		else this.css.pixelLeft = this.x;
	}
	if (y!=null) {
		this.y = y;
		if (to.ns4 || to.ns5) this.css.top = this.y;
		else this.css.pixelTop = this.y;
	}
}
function PrzeniesWarstweO(x,y) {
	this.przeniesDo(this.x+x,this.y+y);
}

function PrzesunWarstweDo(x,krok,del) {
	clearTimeout(this.przesunTimer);
	this.lewa=(to.ie)? parseInt(this.elm.offsetLeft) : parseInt(this.css.left);
	this.krok=Math.min(krok,Math.abs(x-this.lewa));
	if(this.lewa<x) {
		this.css.left=this.lewa+this.krok;
		this.przesunTimer=setTimeout(this.obj+'.przesunDo('+x+','+krok+','+del+')',del);
	}
	if(this.lewa>x) {
		this.css.left=this.lewa-this.krok;
		this.przesunTimer=setTimeout(this.obj+'.przesunDo('+x+','+krok+','+del+')',del);
	}
}

function WpiszDoWarstwy(tekst) {
	if(to.ns4) {
		this.css.document.open();
		this.css.document.write(tekst);
		this.css.document.close();
	}	
	else	this.elm.innerHTML = tekst;
	this.wys=(to.ns4)? this.css.document.height : this.elm.offsetHeight;
}
function LadujDoWarstwy(plik,szer,ieramka) {
	if(to.ns4) this.css.load(plik,szer);
	if(to.ie) {
		//eval("top.parent."+ieramka).document.location.href = plik //zmiana dla www.krakus.net
		document.frames[ieramka].document.location.href = plik;
		this.css.width = szer;
	}
}

function ZaladowanaWarstwa(ieramka) {
	if(to.ie) {
		this.elm.innerHTML = document.frames[ieramka].document.body.innerHTML;
	}
	this.wys=(to.ns4)? this.css.document.height : (to.ie4)? this.elm.scrollHeight : this.elm.offsetHeight;
	if(ieramka!='ietest') {LoadLyr.schowaj(); scrollLyr="Tekst";}
}
function ScrollUp(krok,del,limit) {
	this.gora=(to.ie)? parseInt(this.elm.offsetTop) : parseInt(this.css.top);
	this.limit=!isNaN(limit)? limit : (limit.indexOf('okno')>=0)? -(this.wys-limit.substr(4))+this.startY : this.gora-1;
	if(this.limit==null) this.limit=this.gora-1;
	this.scroll=true;
	this.krok=Math.min(krok,Math.abs(this.limit-this.y));
	if(this.scroll && this.gora>= this.limit) {
		//this.przeniesDo(null,this.gora + -this.krok)
		this.przeniesO(null,-this.krok);
		this.scrollTimer=setTimeout(this.obj+".scrollUp("+this.krok+","+del+",'"+limit+"')",del);
	}
}
function ScrollDown(krok,del,limit) {
	this.gora=(to.ie)? parseInt(this.elm.offsetTop) : parseInt(this.css.top);
	this.limit=!isNaN(limit)? limit : (limit.indexOf('okno')>=0)? this.startY : this.gora+1;
	if(this.limit==null) this.limit=this.gora+1;
	this.scroll=true;
	this.krok=Math.min(krok,Math.abs(this.limit-this.y));
	if(this.scroll && this.gora<this.limit) {
		//this.przeniesDo(null,this.gora + this.krok)
		this.przeniesO(null,this.krok);
		this.scrollTimer=setTimeout(this.obj+".scrollDown("+this.krok+","+del+",'"+limit+"')",del);
	}
}
function ScrollStop() {
	this.scroll=false;
	clearTimeout(this.scrollTimer);
	return true;
}
