/* Script for usefull block following vertical scrollbar position */

function JScrollerPos(elem) {

			var p,elem;
			p = {x: 0.0, y: 0.0};

			while(elem && elem != document.body) {
				p.x+=elem.offsetLeft;
				p.y+=elem.offsetTop;
				elem=elem.offsetParent;
			}
			return p;
	}

function JScrollerScrollIt() {
		this.wh = this.suwaczek.offsetHeight;
		this.wx = document.body.scrollTop - JScrollerPos(this.element.parentNode).y;
		this.h  = this.element.offsetHeight;
		this.ch = this.element.parentNode.offsetHeight;

		if(this.wh<this.h) {
			if(this.wx < this.x) {
				this.dest = this.wx;
				if(this.dest < 0) this.dest = 0;
			} else if(this.wx+this.wh > this.x + this.h) {
				this.dest = this.wx + this.wh - this.h;
				if(this.dest+this.h > this.ch) this.dest = this.ch - this.h;
			}
		} else {
			this.dest = this.wx;
			if(this.dest < 0) this.dest = 0;
			if(this.dest+this.h > this.ch) this.dest = this.ch - this.h;
		}
		this.x += (this.dest - this.x)/6;
		this.element.style.top = this.x+"px";

	}

function JScroller(element, name_of_this_object) {
		// create element for measuring window
		this.suwaczek=document.createElement("DIV");
		this.suwaczek.style.visibility = 'hidden';
		this.suwaczek.style.height = '100%';
		this.suwaczek.style.left = '0px'; 
		this.suwaczek.style.top = '0px';
		this.suwaczek.style.position = 'absolute';
		document.body.appendChild(this.suwaczek);
		this.element = element;
		this.x  = 0;
		this.scrollIt = JScrollerScrollIt;
		setInterval('document.'+name_of_this_object+'.scrollIt()',15);
	
	}
	

/* Script for view new window with picture */

licz=0;
function powiekszenie(nazwa,szer,wys,t,temat) {
	config='left=100,top=20,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
	okieneczko='okno' + licz;
	stadion=window.open('',okieneczko,config)
	stadion.document.write('<HTML><HEAD>');
	stadion.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">');
	stadion.document.write('<TITLE>'+temat+'</title>');

	stadion.document.write('<script language="javascript">');
	stadion.document.write('setTimeout(');
	stadion.document.write('"self.close()');
	stadion.document.write(';",100000)');
	stadion.document.write('</');
	stadion.document.write('script>');

	stadion.document.write('</HEAD>');
	stadion.document.write('<body bgcolor=#ffffff leftmargin=0 topmargin=0 marginheight=0 marginwidth=0>');
	stadion.document.write('<DIV align=center><a href=# onclick="javascript:self.close();" title="'+t+'"><img src='+nazwa+' border=0 ></A></DIV>');
	stadion.document.write('</body></html>');
	stadion.focus();
	licz+=1;
}
	
