function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function scrollayer(layername,amt,tim,i)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll(i);
}

function realscroll(i)
{
	if (!DHTML) return;
	clipTop[i] += amount;
	clipBottom[i] += amount;
	topper[i] -= amount;
	if (clipTop[i] < 0 || clipBottom[i] > lyrheight[i])
	{
		clipTop[i] -= amount;
		clipBottom[i] -= amount;
		topper[i] += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop[i]+'px,'+clipWidth[i]+'px,'+clipBottom[i]+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper[i] + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop[i];
		thelayer.style.clip.bottom = clipBottom[i];
		thelayer.style.top = topper[i];
	}
	time = setTimeout('realscroll('+i+')',theTime);
}

function stopScroll()
{
	if (time) clearTimeout(time);
}

function init_layer(layername,i)
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj(layername);
	if (document.layers)
	{
		lyrheight[i] = x.style.clip.bottom;
		lyrheight[i] += 20;
		x.style.clip.top = clipTop[i];
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth[i];
		x.style.clip.bottom = clipBottom[i];
	}
	else if (document.getElementById || document.all)
	{
		lyrheight[i] = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop[i]+'px,'+clipWidth[i]+'px,'+clipBottom[i]+'px,0)';
	}
}

