// This technique is a combination of a technique I used for highlighting FAQ's using anchors 
// and the ever popular yellow-fade technique used by 37 Signals in Basecamp.

// Including this script in a page will automatically do two things when the page loads...
// 1. Highlight a target item from the URL (browser address bar) if one is present.
// 2. Setup all anchor tags with targets pointing to the current page to cause a fade on the target element when clicked.

// 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] = "99";
	FadeSteps[2] = "88";
	FadeSteps[3] = "77";
	FadeSteps[4] = "66";
	FadeSteps[5] = "44";
	FadeSteps[6] = "22";
	FadeSteps[7] = "00";

// This is the recursive function call that actually performs the fade
function DoFade() {
    if (colorId >= 1) {
		targetId.style.backgroundColor = "#ffff" + FadeSteps[colorId];
		
        // If it's the last color, set it to transparent
        if (colorId==1) {
            //targetId.style.backgroundColor = "transparent";
			//var colorId=7;
			window.clearTimeout(runnit);
		}
        colorId--;
		
        // Wait a little bit and fade another shade
        runnit = setTimeout("DoFade()", FadeInterval);
	}
}

