jQuery(function($) {
				
function pause(func, delay)
{
	var pauseTimer;
	clearTimeout(pauseTimer);
	pauseTimer = setTimeout(eval(func), delay);
}

// Update every 10 seconds
updateCountdown();

function updateCountdown()
{
	var $now = Math.round(new Date().getTime() / 1000);

	//Timestamp for christmas
	var $deadline = 1293235200;
	
	// seconds between the two times
	$timeLeft = $deadline - $now;

	if($timeLeft > 0)
	{
		/*** Split time left into days, hours, and minutes ***/
		
		// Days
		$days = Math.floor($timeLeft / 86400);
		$daysInSeconds = $days * 86400;
		
		// Hours
		$remainder = $timeLeft - $daysInSeconds;
		$hours = Math.floor($remainder / 3600);
		$hoursInSeconds = $hours * 3600;
		
		// Minutes
		$remainder = $timeLeft - $daysInSeconds - $hoursInSeconds;
		$minutes = Math.floor($remainder / 60);

		if($minutes.toString().length == 1) $minutes = "0" + $minutes.toString();
		if($hours.toString().length == 1) $hours = "0" + $hours.toString();
		if($days.toString().length == 1) $days = "0" + $days.toString();

		$("#CountdownMinutes").html($minutes);
		$("#CountdownHours").html($hours);
		$("#CountdownDays").html($days);
		
		// Update every 10 seconds
		pause("updateCountdown", 10000);
	} else {
		$("#CountdownMinutes").html("00");
		$("#CountdownHours").html("00");
		$("#CountdownDays").html("00");
	}
}

});
