/*
    Function List:
   dayDiff(start, stop)
      Calculates the number of days, rounded down the next lowest integer, 
      between a starting date and stopping date.

   hoursLeft(time)
      Calculates the number of hours left in the current day rounded down to
      the next lowest integer.

   minutesLeft(time)
      Calculates the number of minutes left in the current hour rounded down 
      to the next lowest integer.

   showDate(time)
      Displays the value of the time object in the format:
      mm/dd/yyyy

   showTime(time)
      Displays the value of the time object in the format:
      hh:mm am/pm
*/

function dayDifference() {
	start = new Date(); //Today is start
	stop = new Date("November 11, 2012");  // Race Day @ 12:00:00
	raceTime = (8*60*60*1000) + (30*60*1000);
			// alert("Race Time is "+raceTime);
			
	subtract = stop-start;
				// alert ("Subtract stop-start "+subtract);
			
	totalTime = subtract + raceTime; //Revised subtract to include additional time from midnite to race start (ending time)
				// alert("Subtract after adding raceTime "+totalTime);
		
	decimalDiff = totalTime/(24*60*60*1000);  //Total difference including decimals
				// alert("Decimal difference for days "+decimalDiff);
	dayDiff = Math.floor(decimalDiff); 
	
	remainder = decimalDiff - dayDiff;
	return dayDiff;
	}
	
function hourLeft() {
	totalHour = remainder*24; //Results in hours plus decimals remaining
	hrLeft = Math.floor(totalHour);
	newRemainder = totalHour-hrLeft; //decimal number remaining in hours
	return hrLeft;
	}
	
function minuteLeft() {
	totalMin = newRemainder*60; 
	minLeft = Math.floor(totalMin);
	newerRemain = totalMin - minLeft;
	return minLeft;
}
function secondLeft()	{ 
	totalSec = newerRemain*60;
	secLeft = Math.floor(totalSec);
	return secLeft;
}
	

   


