var NS,IE,NS6,range,styleObj,hideName,showName;

if(document.layers)
{
	NS=1;
	range="";
	styleObj="";
	hideName="hide";
	showName="show";
} else if(document.all)
{
	IE=1;
	range="all.";
	styleObj=".style";
	hideName="hidden";
	showName="visible";
} else if(document.getElementById)
{
	NS6=1;
	range="getElementById('";
	styleObj="').style";
	hideName="hidden";
	showName="visible";
}

var linkCol="#cccccc";
var targCol="#efefef";
var colSteps=40;
var currStep, stop;
var steps = new Array;
var cc = new Array;
var nc = new Array;

function makeObj(wObj)
{
	return eval("document."+range+wObj+styleObj);
}

function hexToDec(wCol)
{
	r = parseInt((wCol.substring(1,3)),16);
	g = parseInt((wCol.substring(3,5)),16);
	b = parseInt((wCol.substring(5,7)),16);
	
	return r+","+g+","+b;
}

function decToHex(wCol)
{
	hex = wCol.split(",");
	for(x=0; x<=2; x++)
	{
		y=eval(hex[x])
		hex[x] = y.toString(16);
		if(y<16)
			hex[x]="0"+hex[x];
	}
	return "#"+hex.join("");
}

function go(wLink)
{
	if(document.layers) {
		return;
	}
	
	stop=0;
	
	//alert (makeObj(wLink).color);
	if (wLink != "highlit") {
		fade(wLink,linkCol)
	} else
	{
		fade(wLink,"#efefef")
	}
}

function fade(wLink,cCol)
{
	cc = hexToDec(cCol).split(",");
	tc = hexToDec(targCol).split(",");
	
	currStep = 1;
	for(x=0; x<=2; x++)
	{
		steps[x] = (eval(tc[x])-eval(cc[x]))/colSteps;
	}
	
	goFade(wLink)	
}

function goFade(wLink)
{
	if(stop)
		return

	cL = wLink;
	for(x=0; x<=2; x++)
	{
		sc = steps[x]*currStep
		nc[x] = parseInt(eval(cc[x])+sc)
	}
	
	newCol = decToHex(nc.join());

	setCol(wLink,newCol);
	
	if(currStep == colSteps)
	{
		setCol(wLink,targCol)
	}
	else
	{
		currStep++;
		setTimeout("goFade(cL)",10);
	}
}

function setCol(wLink,wCol)
{
	makeObj(wLink).backgroundColor=wCol;
}

function out(wLink)
{
	if(document.layers) {
		return;
	}
	
	if (wLink != "highlit") {
		makeObj(wLink).backgroundColor=linkCol;
	} else{
		makeObj(wLink).backgroundColor="#efefef";
	}
	stop=1;
}
