// This is the amount of time (in milliseconds) that will lapse between each step in the fade
var FadeInterval = 600;

// This is where the fade will start, if you want it to be faster and start with a lighter color, make this number smaller
// It corresponds directly to the FadeSteps below
var StartFadeAt = 7;

// This is list of steps that will be used for the color to fade out
var FadeSteps = new Array();
	FadeSteps[1] = "ff";
	FadeSteps[2] = "ee";
	FadeSteps[3] = "dd";
	FadeSteps[4] = "cc";
	FadeSteps[5] = "bb";
	FadeSteps[6] = "aa";
	FadeSteps[7] = "99";

// This function is just a small wrapper to use for the oncick events of the anchors
function Highlight(target) {
	// Get the target ID from the string that was passed to the function    
	DoFade(StartFadeAt, target);
}

// This is the recursive function call that actually performs the fade
function DoFade(colorId, targetId) {
	 if (colorId >= 1) {
		document.getElementById(targetId).style.background = "#ffff" + FadeSteps[colorId];
		// If it's the last color, set it to transparent
        if (colorId==1) {
        	document.getElementById(targetId).style.background = "#fff";
		}
        colorId--;		
        // Wait a little bit and fade another shade
        setTimeout("DoFade("+colorId+",'"+targetId+"')", FadeInterval);
	}
}