/*  ****************  JAVA RUNNING CLOCK CODE  **************  
Script Modifications: Jason M. Lippa - lipp6490@fredonia.edu 
Script Editor: Howard Chen 
Get more JavaScripts at http://www.geocities.com/SiliconValley/Network/7432/ */  

var tilWhat = "Real life begins...";		// COUNTDOWN TEXT 
var countDownDate = "December 21, 2006";		// COUNTDOWN DATE 

var destinationSaying = "NOW!  I'm off to slay a dragon!";	// ARRIVAL STATEMENT  

var theDay = new Date(countDownDate);  //The day has to be in the format Month Day, Year 
var DayTill;                           //The string that is going to put all numbers together and make sense.  

function countdown() {
 	var today = new Date() ;   						//Create an Date Object that contains today's date.
 	var second = Math.floor((theDay.getTime() - today.getTime())/1000);
 	var minute = Math.floor(second/60); 				//Divide "second" into 60 to get the minute
 	var hour = Math.floor(minute/60);  					//Divide "minute" into 60 to get the hour
 	var day = Math.floor(hour/24);   					//Devide "hour" into 60 to get the day
 	CDay= day;     								//Correct day
      if(hour%24== 0) CHour = 23;
 	else          CHour= (hour % 24) - 1;				//Correct hour, after devide into 24, the remainder deposits here.
 	CMinute= minute % 60;    						//Correct minute, after devide into 60, the remainder deposits here.
 	CSecond= second % 60;    						//Correct second, after devide into 60, the remainder deposits here.
  //	if(CDay < 100) CDay = "0" + CDay;
 //	if(CDay < 10) CDay = "0" + CDay;
 	if(CHour < 10) CHour = "0" + CHour;
 	if(CMinute < 10) CMinute = "0" + CMinute;
  	if(CSecond < 0 || CMinute < 0 || CHour < 0 || CDay < 0)	{
 		DayTill = destinationSaying;
 	} else {
 		if(CSecond < 10/*jml2001*/) CSecond = "0" + CSecond;
 		DayTill =  CDay + " days, " + CHour + " hrs, " + CMinute + " mins, " + CSecond + " secs ";
 	}
  	var textArea = document.getElementById("timeLeft");
 	textArea.firstChild.nodeValue=DayTill;
  	var until = document.getElementById("tilWhat");
 	until.firstChild.nodeValue=tilWhat;
  	var counter = setTimeout("countdown()", 995);
}

/*  *****************  END RUNNING CLOCK CODE  ******************  */

/*var cs0 = "#000000";
var cs1 = "#330000";
var cs2 = "#770000";
var cs3 = "#AA0000";
var cs4 = "#FF0000";*/

var cs0 = "#000000";
var cs1 = "#140404";
var cs2 = "#280808";
var cs3 = "#3F0F0F";
var cs4 = "#451515";

function fadeUp(step) {
  var newColor = "";
  var theStep = parseInt(step);
  switch(theStep) {
  case 0: newColor = cs0; break;
  case 1: newColor = cs1; break;
  case 2: newColor = cs2; break;
  case 3: newColor = cs3; break;
  case 4: newColor = cs4; break;
  default:newColor = cs4; break;
  };
  document.getElementById("tilWhat").style.color=newColor;
  document.getElementById("timeLeft").style.color=newColor;
  theStep++;
  if(theStep < 5) setTimeout("fadeUp("+theStep+")",50);
  else return;
}

function fadeDown(step) {
  var newColor = "";
  var theStep = parseInt(step);
  switch(theStep) {
  case 0: newColor = cs4; break;
  case 1: newColor = cs3; break;
  case 2: newColor = cs2; break;
  case 3: newColor = cs1; break;
  case 4: newColor = cs0; break;
  default:newColor = cs0; break;
  };
  document.getElementById("tilWhat").style.color=newColor;
  document.getElementById("timeLeft").style.color=newColor;
  theStep++;

  if(theStep < 5) setTimeout("fadeDown("+theStep+")",50);
  else            return;
}