
function scrl_init(whichLayer) {
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj(whichLayer);
	var sb = new getObj('scrollbars');
	if (document.layers) {
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all) {
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
	if ((clipHeight == 457 && lyrheight >= clipHeight + 25) || (clipHeight != 457 && lyrheight >= clipHeight + 10))
		sb.style.visibility = 'visible';
	x.style.visibility = 'visible';
}

function scrollayer( layername, amt, tim) 
{
	if (!DHTML)
		return;
	thelayer = new getObj(layername);
	if (!thelayer)
		return;

	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll() {
	if (!DHTML)
		return;
	/*clipTop += amount;
	clipBottom += amount;
	topper -= amount;*/
	/*if (clipTop < 0 || clipBottom > lyrheight) {
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}*/
	//if ()
	/*if (document.getElementById || document.all) {
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers) {
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}*/
	//ibox.value = ibox.value +'\n'+ amount;
	blahblah.setValueBy(amount, 0); //translateToPx
	time = setTimeout('realscroll()',theTime);
}

function stopscroll() {
	if (time)
		clearTimeout(time);
}


// JSB: I made these:
function scrollto (layername, pos) {
	if (!DHTML)
		return;
	thelayer = new getObj(layername);
	if (!thelayer)
		return;
	amnt = Math.round((lyrheight - clipHeight) * pos);
	//ibox.value += '\n' + amount.toString();
	setscroll();
}

function setscroll() {
	if (!DHTML)
		return;
	clipTop = amnt;
	clipBottom = clipHeight + amnt;
	topper = -amnt;
	if (clipTop < 0 || clipBottom > lyrheight) {
		/*clipTop -= amnt;
		clipBottom -= amnt;
		topper += amnt;*/
		return;
	}
	if (document.getElementById || document.all) {
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers) {
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	//time = setTimeout('realscroll()',theTime);
}
