
// Scrolling layer script

var clipTop = 0;
var clipWidth =580;
var clipBottom  = 100;
var clipLeft = 0;
var topper = 0;
var lyrleft = 30;
var lyrheight = 0;
var lyrwidth = 1000;

var time,amount,theTime,theHeight,DHTML;


function initSlider()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('example');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;

		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = clipLeft;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		lyrwidth = x.obj.offsetWidth;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,'+clipLeft+'px)';
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}
function resetSlider()
{
	clipTop = 0;
	clipWidth =580;
	clipBottom  = 100;
	clipLeft = 0;
	lyrleft = 30;
	element("example").style.left = lyrleft;
	element("example").style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,'+clipLeft+'px)';	
}
function realscroll()
{
	if (!DHTML) return;

	clipLeft -= amount;
	clipWidth -= amount;
	lyrleft += amount;

	if (clipLeft < 0 || clipWidth > lyrwidth)
	{
		clipLeft += amount * 2;
		clipWidth += amount * 2;
		lyrleft -= amount * 2;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,'+clipLeft+'px)';
		thelayer.style.clip = clipstring;
		thelayer.style.left = lyrleft + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopScroll(dir)
{
	if (time) clearTimeout(time);
}


