

function LED(direction,delay,color)
{
	this.direction = direction;
	this.color = color;
	var delay = (delay) ? delay : 100;
	this.lis = document.getElementsByTagName('li');
	for (var i =0;i<this.lis.length;i++)
	{
		if (!this.lis[i].bgColorCache) this.lis[i].bgColorCache = this.lis[i].getElementsByTagName('a')[0].style.backgroundColor;
	}
	this.index = (direction == "down") ?  0 : this.lis.length -1;
	var self = this;
	this.interval = window.setInterval(function () {self.hilite()},delay);
}
LED.prototype.hilite = function()
{
	if (this.elCache)
	{
		this.elCache.getElementsByTagName('a')[0].style.backgroundColor = this.elCache.bgColorCache;
	}
	this.elCache = this.lis[this.index];
	
	this.lis[this.index].getElementsByTagName('a')[0].style.backgroundColor = this.color;
	if (this.direction == "down")
	{
		this.index = (this.index < this.lis.length -1) ? this.index + 1 : 0;
	}
	else
	{
		this.index = (this.index > 0) ? this.index - 1 : this.lis.length -1;
	}
}
window.onload = function () { new LED("up",100)};//;setTimeout(function () { new LED("up",50)} ,867);setTimeout(function () { new LED("up")} ,213)}
