/** 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);
	}
	/*
function simplePreload() {
 	var args=simplePreload.length;
	document.imageArray = new Array(args.length);
	for(var i=0; i<args.length; i++) {
		document.imageArray[i] = new Image;
		document.imageArray[i].src = args[i];
	}
   }
	 */
