// Damian Gajda - 1999. Point of View - Interactive Solutions
// Permission granted to reuse and distribute.
// GPL style licence applies, ie. you can freely modify the code
// unless you will note about it and don't forget about the Original
// author.. (that's me ;) )

if(browserVersion.ver4up)	{
	var topLimit;
	var topPos = new Array();

	var clipHeight = 200;
}

function initScroll() {
  if ( browserVersion.ver4up )	{
	var pLs = new Array("scrollback","scrollcrop");
	topLimit = 0;
	for(var i=0; i<layersNames.length; i++) {
		addObject(layersNames[i],pLs);
		setLayer(layersNames[i], 0, -topLimit);

		topPos[i] = -topLimit;
		topPos[layersNames[i]] = topPos[i];

		topLimit -= getLayerHeight(layersNames[i]) + 5;
	}
	topLimit += clipHeight;
  }
}

function scrollMove(dir) {
	scrollSet(getLayerTop(layersNames[0]) + dir*30);//topLimit/10);
}

function scrollMove1(dir) {
	scrollSet(getLayerTop(layersNames[0]) + dir*30);//topLimit/10);
}

function scrollMove2(dir) {
	scrollSet(getLayerTop(layersNames[0]) + dir*30);//topLimit/10);
}

function scrollJump(name) {
	scrollSet(-topPos[name]);
}

function scrollSet(scrollTop) {
	scrollTop = scrollTop<topLimit?topLimit:scrollTop;
	scrollTop = scrollTop>0?0:scrollTop;

	for(var i=0; i<layersNames.length; i++)
		setLayer(layersNames[i], 0, scrollTop+5*i);// + topPos[i]);
}

window.onload = initScroll;

