var FadeInterval = 400;
var StartFadeAt = 7;
var FadeSteps = new Array();
	FadeSteps[1] = "ff";
	FadeSteps[2] = "ee";
	FadeSteps[3] = "cc";
	FadeSteps[4] = "aa";
	FadeSteps[5] = "88";
	FadeSteps[6] = "66";
	FadeSteps[7] = "44";

// These are the lines that "connect" the script to the page.
var W3CDOM = (document.createElement && document.getElementsByTagName);
addEvent(window, 'load', initFades);

// This function automatically connects the script to the page so that you do not need any inline script
// See http://www.scottandrew.com/weblog/articles/cbs-events for more information
function addEvent(obj, eventType,fn, useCapture)
{
	if (obj.addEventListener) {
		obj.addEventListener(eventType, fn, useCapture);
		return true;
	} else {
		if (obj.attachEvent) {
			var r = obj.attachEvent("on"+eventType, fn);
			return r;
		}
	}
}

// The function that initializes the fade and hooks the script into the page
function initFades()
{
	if (!W3CDOM) return;
        DoFade(StartFadeAt, 'voila');
}

// This is the recursive function call that actually performs the fade
function DoFade(colorId, targetId) {
	

    if (document.getElementById(targetId)){
		
        if (colorId >= 1) {
	    document.getElementById(targetId).style.color = "#ffff" + FadeSteps[colorId];
		
            // If it's the last color, set it to transparent

            if (colorId==1) {
                document.getElementById(targetId).style.color = "#ffffff";
            }
            colorId--;
		
            // Wait a little bit and fade another shade
            setTimeout("DoFade("+colorId+",'"+targetId+"')", FadeInterval);
        }
    }
}


