
var Color = new Array();
Color[1] = "#FFFFFF";	/* Lightest */
Color[2] = "#FFFFEE";
Color[3] = "#FFFFDD";
Color[4] = "#FFFFCC";
Color[5] = "#FFFFBB";
Color[6] = "#FFFFAA";
Color[7] = "#FFFF99";	/* Darkest */

var ErrorColor = new Array();
ErrorColor[1] = "#FFE8dC";
ErrorColor[2] = "#FFD8CC";
ErrorColor[3] = "#FFC8Bc";
ErrorColor[4] = "#FFB8Ac";
ErrorColor[5] = "#FFA89c";
ErrorColor[6] = "#FF988c";
ErrorColor[7] = "#FF887c";

function waittofade() {
	if (getElement('errorfade')) {
		setTimeout("fadeIn('errorfade', 7, 200)", 200);
	}
	if (getElement('fade')) {
		setTimeout("fadeIn('fade', 7, 100)", 1000);
	 }
}

/*************************************************** 
 * Requires an ID set to 'fade' or 'errorfade' 
 * Set a startup script like this to start the fade in
 *
 * <script language="javascript" type="text/javascript">
 *		waittofade();
 *	</script>
 *
 ***************************************************/
function fadeIn(oid, where, speed) {
	var obj = getElement(oid);
	
    if (where >= 1) {
		if (oid == 'fade') {
			obj.style.backgroundColor = Color[where];
		} else {
			obj.style.backgroundColor = ErrorColor[where];
		}
		
		if (where > 1) {
			where -= 1;
			setTimeout("fadeIn('"+oid+"',"+where+","+speed+")", speed);
		} else {		/* Use this if you want to force the background to transparent on the last iteration */
			where -= 1;
			setTimeout("fadeIn('"+oid+"',"+where+","+speed+")", speed);
			/* obj.style.backgroundColor = "transparent"; */
		}
    }
}

