// this script enables and displays the countdown for the unctad xiii conference
function updatecountdown(targetdate) {
	var conf_start = new Date(targetdate);
	var today = new Date();
	var timediff = conf_start.getTime() - today.getTime();
		              // day hour  min second
	var millis_to_days = 24 * 60 * 60 * 1000;
	var datediff = (timediff > 0) ? Math.floor(timediff/millis_to_days) : 0;
	var counterNum = document.getElementById("conf_countdown_num");
	if (counterNum)
		counterNum.innerHTML = datediff;
	// display countdown element
	var counterTextElement = document.getElementById("conf_countdown");
	if (counterTextElement)
		counterTextElement.style.display = "block";
}
// call function when page loaded using prototype library loaded on homepage
document.observe('dom:loaded', function () {
	updatecountdown("April 21, 2012");
});
