var totalNumEntries = 0; 
var numElements = 0;/*The number of elements - The number visible*/;

//Script from QuirksMode.org(Peter-Paul Koch)
var clipTop = 0;
var clipWidth = 300;
var clipBottom = 400;
var topper = 200;
var lyrheight = 0;
var currentPos = 0;
var time,amount,theTime,theHeight,DHTML;

function initDisplay()
{
	DHTML = (document.getElementById || document.all || document.layers);
	if (!DHTML) return;
	var x = new getObj('scrollingPane');
	if (document.layers) 
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight + 15;
	}
}

function scrollLayer(layername,amt,tim)
{
	if (!DHTML) 
	{
		return;
	}
	thelayer = new getObj(layername);
	if (!thelayer) 
	{
		return;
	}
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll()
{
	if(test)
	{
		moved += amount;
		if(moved > 57 || moved < -57) 
		{
			finished = true;
			return;
		}
	}
	if (!DHTML) 
	{
		return;
	}
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0) /*|| clipBottom - 100> lyrheight)*/
	{
		finished = true;
		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;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopScroll()
{
	if (time) clearTimeout(time);
}
//API func
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 = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

/****Added functions**********/
var moved=0;
var test = false;
var finished = true;

function moveUp()
{
	if(currentPos <= 0) return;
	if(!finished) return;
	currentPos--;
	finished = false;
	moved=0;
	test = true;
	scrollLayer('scrollingPane',-3,1);
	//setTimeout(function () {stopScroll();},57);
}

function moveDown()
{
	if(!finished) return;
	if(currentPos >= numElements) return;
	currentPos++;
	finished = false;
	moved=0;
	test = true;
	scrollLayer('scrollingPane',3,1);
//	setTimeout(function () {stopScroll();},114);
}

var constantMoveTimeout;
function startMoveDown()
{
	constantMoveTimeout = setTimeout(startMoveDown,19);
	moveDown();
}
function startMoveUp()
{
	constantMoveTimeout = setTimeout(startMoveUp,19);
	moveUp();
}
function haltMovement()
{
	if(constantMoveTimeout) clearTimeout(constantMoveTimeout);
}

/**move 57 px**/
/**onmouseover="scrollLayer('scrollingPane',5,10);" onmouseout="stopScroll()"**/