

var current = new Date();
var nov2 = new Date(2004, 10, 2);

function cdown() {
	
	var current = new Date();
	
	//calculate time left in milliseconds
	var milLeft = nov2.getTime() - current.getTime();
	
	//if today is Nov 2 - display new message
	if (milLeft <= 0) {
		counttext("VOTE!");
		return;
	}
	
	var secs = Math.floor(milLeft/1000);
	var mins = Math.floor(secs/60);
	var hours = Math.floor(mins/60);
	var days = Math.floor(hours/24);
	
	//make sure each read out is printed
	//within the range in which it exists
	secs = (secs % 60).toString();
	mins = (mins % 60).toString();
	hours = (hours % 24).toString();
	days = days.toString();
	
	// add on leading zeros for all the number values
	if (secs.length < 2) secs = "0" + secs;
	if (mins.length < 2) mins = "0" + mins;
	if (hours.length < 2) hours = "0" + hours;

	var t = days + ":" + hours + ":" + mins + ":" + secs;
	counttext(t);

	setTimeout("cdown()", 1000);
}

function counttext(s) {
	if (document.layers) {
		document.layers.clock.document.write(s);
		document.layers.clock.document.close();
	} else if (document.getElementById) 
	document.getElementById("clock").innerHTML=s

}


