function startClock() {
	setCountdown();
	setInterval("setCountdown()", 1000);
}

function setCountdown()
{
	// Array of pictures for time, with the way the array is made, each image can be referenced by the corresponing array position
	numberArray = new Array("images/0_es.png", "images/1_es.png", "images/2_es.png", "images/3_es.png", "images/4_es.png", "images/5_es.png", "images/6_es.png", "images/7_es.png", "images/8_es.png", "images/9_es.png");

	// get the time right now
	var today = (new Date()).getTime();

	// the day and time we are counting down to
	var the_day = (new Date("June 12, 2009 23:59:59")).getTime();

	// time in between today and the time we are counting down to
	var time = (the_day - today);

	// if the countdown date has not yet passed
	if(time > 0)
	{
		// get the number of days remainng and subtract from time
		var days = String((time - (time % 86400000)) / 86400000);
			time = time - (days * 86400000);

		// get the number of hours remaining and subtract from time
		var hours = String((time - (time % 3600000)) / 3600000);
			time = time - (hours * 3600000);

		// get the number of minutes remaining and subtract from time
		var mins = String((time - (time % 60000)) / 60000);
			time = time - (mins * 60000);

		// get the number of seconds remaining
		var secs = String((time - (time % 1000)) / 1000);

		// add two zeros before days left if single digit
		if(days.length == 1) {
			days = "00" + String(days);
		}

		// add one zero before days left if double digit
		if(days.length == 2) {
			days = "0" + String(days);
		}

		// add one zero before hours left if single digit
		if(hours.length == 1) {
			hours = "0" + String(hours);
		}

		// add one zero before hours left if single digit
		if(mins.length == 1) {
			mins = "0" + String(mins);
		}

		// add one zero before hours left if single digit
		if(secs.length ==1) {
			secs = "0" + String(secs);
		}						

		// Change countdown images to match values of remaining
		document.day_one.src = numberArray[days.substr(2,1)];
		document.day_ten.src = numberArray[days.substr(1,1)];
		document.day_hundred.src = numberArray[days.substr(0,1)];

		document.hour_one.src = numberArray[hours.substr(1,1)];
		document.hour_ten.src = numberArray[hours.substr(0,1)];

		document.minute_one.src = numberArray[mins.substr(1,1)];
		document.minute_ten.src = numberArray[mins.substr(0,1)];

		document.second_one.src = numberArray[secs.substr(1,1)];
		document.second_ten.src = numberArray[secs.substr(0,1)];
	}
	else // if the countdown date has already passed
	{
		// make all number images not visible and show image display that all tv is digital
		document.day_one.visible = false;
		document.day_ten.visible= false;
		document.day_hundred.visible = false;

		document.hour_one.visible = false;
		document.hour_ten.visible = false;

		document.minute_one.visible = false;
		document.minute_ten.visible = false;

		document.second_one.visible = false;
		document.second_ten.visible = false;

		document.labels.visible = false;

		document.TV_is_digital.visible = true;
	}
}