var t;

function setTime(date,hour)
{
	var targetDate = new Date();
	var year = date.split("-")[0];
	var month = parseFloat(date.split("-")[1])-1;
	var day = date.split("-")[2];
	targetDate.setFullYear(year,month,day);
	targetDate.setHours(hour);
	targetDate.setMinutes(0);
	targetDate.setSeconds(0);
	return targetDate;
}

function showCountDown()
{
	var timeLeft = setTime('2012-07-22','9') - new Date();

	var daysLeft = Math.floor(timeLeft/(1000*60*60*24));
	var hoursLeft = Math.floor((timeLeft % (1000*60*60*24))/(1000*60*60));
	var minsLeft = Math.floor((timeLeft % (1000*60*60))/(1000*60));
	var secsLeft = Math.floor((timeLeft % (1000*60))/(1000));
	if (document.getElementById("countdown_clock"))
	{
		document.getElementById("countdown_clock").innerHTML = daysLeft + " Days " + hoursLeft + ":" +minsLeft + ":"+secsLeft;
		t = setTimeout( function () {showCountDown()},1000);
	}
	else
	{
		clearTimeout(t);
	}
}

function hideCountDown()
{
	clearTimeout(t);
}

