var FadeInterval = 400;
var StartFadeAt = 12;
var FadeSteps = new Array();
	FadeSteps[1] = "de";
	FadeSteps[2] = "db";
	FadeSteps[3] = "d8";
	FadeSteps[4] = "d3";
	FadeSteps[5] = "cc";
	FadeSteps[6] = "c7";
	FadeSteps[7] = "bb";
	FadeSteps[8] = "b7";
	FadeSteps[9] = "aa";
	FadeSteps[10] = "a7";
	FadeSteps[11] = "99";
	FadeSteps[12] = "88";


// 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
// This is the recursive function call that actually performs the fade
function DoFade(colorId, targetId) {
    try {
        if (colorId >= 1) {
		    document.getElementById(targetId).style.backgroundColor = "#fff4" + FadeSteps[colorId];
    		
            // If it's the last color, set it to transparent
            if (colorId==1) {
                document.getElementById(targetId).style.backgroundColor = "transparent";
		    }
            colorId--;
    		
            // Wait a little bit and fade another shade
            setTimeout("DoFade("+colorId+",'"+targetId+"')", FadeInterval);
	    }
	}
	catch (err)
	{}
}
