<!--
/* This function prototype extends the built-in Date object
 * and returns a Boolean telling whether daylight savings time
 * is in effect for the Date object. It works by comparing two
 * dates to this date: one which is never in daylight savings,
 * and one which always is for zones that have daylight savings.
 * jeff keys 10/12/2007
*/
function Date_isDaylightSavings() {
    var StTime = new Date("January 1, 2007");
    var DtTime = new Date("July 1, 2007");
    var DOffset = StTime.getTimezoneOffset() - DtTime.getTimezoneOffset();
    var ThisOffset = this.getTimezoneOffset() - StTime.getTimezoneOffset();
    return Boolean(DOffset * ThisOffset);
}
Date.prototype.isDaylightSavings = Date_isDaylightSavings;

currentDate = new Date();
//alert(currentDate);
function livedate(){
	
	/////////////////////////////////////////////////////////
	sixtyFromNow = currentDate.getTime() + (1000)
	currentDate.setTime(sixtyFromNow);
	////////////////////////////////////////////////////////
	
	timeDiff=currentDate.getTimezoneOffset()/60 - 5 + currentDate.isDaylightSavings();

	var idblock = ["dayblock","hoursblock","minutesblock","secondsblock"];
	i = idblock.length-1;
	do {
		document.getElementById(idblock[i]);
		document.getElementById(idblock[i]).removeChild(document.getElementById(idblock[i]).childNodes[0]);
	} while(i--);
	
	currentDate.getUTCDate();
	timeZones =  cthour - timeDiff;
	
	// note: count months from 0, so January is month 0 and December month 11.
	// the date here is expressed as follows: Year, Month starts at 0, Day, Hour, Minutes, Seconds.
	
	endDate = new Date(ctyear,ctmonth,ctday, timeZones, ctmin,ctsecs);
	endDate.getTimezoneOffset();
	endDateField = endDate;

	days = (endDate-currentDate)/1000/60/60/24;
	daysRound = Math.floor(days);
	if (daysRound < 10){
		daysRounddisplay = daysRound;
	} else {
		daysRounddisplay = daysRound = Math.floor(days);
	}
	
	hours = (endDate-currentDate)/1000/60/60-(24*daysRound);
	if (hours < 10){
		hoursRound = "0" + Math.floor(hours);
	} else {
		hoursRound = Math.floor(hours);
	}
	
	minutes = (endDate-currentDate)/1000/60-(24*60*daysRound)-(60*hoursRound);
	minutesRound = Math.floor(minutes);

	deltaDates = (endDate-currentDate)/1000;
	dayInSeconds = 24*60*60*daysRound;
	hoursRoundSeconds = 60*60*hoursRound;
	minutesRoundSeconds = 60*minutesRound;
	
//alert("minutes = " + minutes + "\n");
//alert("minutesRound = " + minutesRound + "\n");
	mySeconds = (endDate-currentDate)/1000-(24*60*60*daysRound)-(60*60*hoursRound)-(60*minutesRound);

//    mySeconds = deltaDates-dayInSeconds-hoursRoundSeconds-minutesRoundSeconds;
//alert("seconds = " + seconds + "\n");
	secondsRound = Math.round(mySeconds);
	//secondsRound = Math.round(seconds);
//alert("secondsRound = " + secondsRound + "\n");
	
	// Check when to put day and when to put days
	if (daysRound == 1) {
		dy = " day ";
	} else {
		dy = " days ";
	}
	if (secondsRound == 60) {
		secondsRound = 0;
	}
	if (minutesRound == 60) {
		minutesRound = 0;
	}
	if (secondsRound <= 9) {
		secondsRound = "0"+secondsRound;
	}
	if (minutesRound <= 9) {
		minutesRound =  "0"+minutesRound;
	}
	if (daysRound<=-1) {
		daysRounddisplay = "0";
		hoursRound = "00";
		minutesRound = "00";
		secondsRound = "00";
		clearInterval(runningcoutdown);
	}
	
	var displayblock = [daysRounddisplay,hoursRound,minutesRound,secondsRound];
	i = displayblock.length - 1;
	
	do {
	var d = document.createTextNode(displayblock[i]);
	document.getElementById(idblock[i]).appendChild(d);
	} while(i--);
}
runningcoutdown = window.setInterval("livedate()",1000);
-->
