

function prepareCountdown() {
	if (!document.getElementById) return false;
	if (!document.getElementById('countdown')) return false;
	var $countdown_div = document.getElementById('countdown');
	$countdown_div.timer = setTimeout('countdown();',1000);
}
addLoadEvent(prepareCountdown);

function countdown() {
	
	var $countdown_div = document.getElementById('countdown');
	$countdown_div.timer = setTimeout('countdown();',1000);

	var $countdown = Array(4);
	$countdown['days'] = parseInt(document.getElementById('countdown-days').childNodes[0].nodeValue);
	$countdown['hours'] = parseInt(document.getElementById('countdown-hours').childNodes[0].nodeValue);
	$countdown['minutes'] = parseInt(document.getElementById('countdown-minutes').childNodes[0].nodeValue);
	$countdown['seconds'] = parseInt(document.getElementById('countdown-seconds').childNodes[0].nodeValue);
	
	var $time_remaining = (($countdown['days']*86400)+($countdown['hours']*3600)+($countdown['minutes']*60)+$countdown['seconds'])-1;
	
	$countdown['days'] = Math.floor($time_remaining/86400);
	$countdown['hours'] = Math.floor(($time_remaining -= $countdown['days']*86400)/3600);
	$countdown['minutes'] = Math.floor(($time_remaining -= $countdown['hours']*3600)/60);
	$countdown['seconds'] = $time_remaining -= $countdown['minutes']*60;
	
	document.getElementById('countdown-seconds').innerHTML = $countdown['seconds'];
	document.getElementById('countdown-minutes').innerHTML = $countdown['minutes'];
	document.getElementById('countdown-hours').innerHTML = $countdown['hours'];
	document.getElementById('countdown-days').innerHTML = $countdown['days'];
}