var clipTop = 0;
var clipWidth = 380;
var clipBottom = 305;
var topper = 253;
var lyrheight = 0;
var bottomMargin = 0;
var time,amount,theTime,theHeight,DHTML;

function scrollInit()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	
	var x = new getObj('details_c');
	var x1 = new getObj('detailstxtp');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		bottomMargin = -lyrheight+335;
		x1.style.marginBottom = bottomMargin + "px";
		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)
	{
		if(x.obj) {
			lyrheight = x.obj.offsetHeight;
			x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
			
			bottomMargin = -lyrheight+335;
			x1.style.marginBottom = bottomMargin + "px";
		}
	}
}
function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}
function realscroll()
{
	var x1 = new getObj('detailstxtp');
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	bottomMargin+=amount;
	//alert(bottomMargin);
	
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		bottomMargin-=amount;
		
		topper += amount;
		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;
	}
	//alert(bottomMargin);
	x1.style.marginBottom = bottomMargin +"px";
	time = setTimeout('realscroll()',theTime);
}

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