var clipTop = 0;
var clipWidth = 155;
var clipBottom = 112;
var topper = 0;
var lyrheightx = 0;
var lyrheighty = 0;
var lyrheightz = 0;
var time,amount,theTime,theHeight,DHTML;

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 init()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('prodLevel1');
	var y = new getObj('prodLevel2');
	var z = new getObj('prodLevel3');
	if (document.layers)
	{
		lyrheightx = x.style.clip.bottom;
		lyrheightx += 10;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
		
		lyrheighty = y.style.clip.bottom;
		lyrheighty += 10;
		y.style.clip.top = clipTop;
		y.style.clip.left = 0;
		y.style.clip.right = clipWidth;
		y.style.clip.bottom = clipBottom;
		
		lyrheightz = z.style.clip.bottom;
		lyrheightz += 10;
		z.style.clip.top = clipTop;
		z.style.clip.left = 0;
		z.style.clip.right = clipWidth;
		z.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheightx = x.obj.offsetHeight;
		lyrheighty = y.obj.offsetHeight;
		lyrheightz = z.obj.offsetHeight;
		
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		y.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		z.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
	
	//hiding scroll arrows if not needed
	if(lyrheightx<=110){
		document.getElementById("scroller1").style.visibility = "hidden";
	}
	if(lyrheighty<=110){
		document.getElementById("scroller2").style.visibility = "hidden";
	}
	if(lyrheightz<=110){
		document.getElementById("scroller3").style.visibility = "hidden";
	}
}

function scrollayer(layername,amt,tim)
{
	scrollObj = layername.substr(9,9);
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll(scrollObj);
}

function realscroll(myObj,counter)
{
	
	if (counter == undefined){
		counter = 0;
	}
	
	if (!DHTML) return;
	switch(myObj){
		case "1":
			lyrheight = lyrheightx;			
			break;
		case "2":	
			lyrheight = lyrheighty;
			break;			
		case "3":
			lyrheight = lyrheightz;			
			break;			
	}
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= 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;
	}
	
	if (counter<3){
		counter++;
		time = setTimeout('realscroll('+myObj+','+counter+')',theTime);
	}
}

function stopscroll()
{
	if (time) clearTimeout(time);
}