function initTimer() {
	var days = $("#days").html();
	var hours = $("#hours").html();
	var minutes = $("#minutes").html();
	var seconds = $("#seconds").html();
	
	var total = parseInt(days) * 86400 + parseInt(hours) * 3600 + parseInt(minutes) * 60 + parseInt(seconds);
	return total;
}

function updateTimer() {
	var total = parseInt(initTimer()) - 1;
	total = (total > 0) ? total : 0;
	
	var days = Math.floor(total / 86400);
	var hours = Math.floor( (total - (days * 86400)) / 3600 );
	var minutes = Math.floor( (total - (days * 86400) - (hours * 3600)) / 60);
	var seconds = total % 60;
	
	$("#days").html(days);
	$("#hours").html(hours);
	$("#minutes").html(minutes);
	$("#seconds").html(seconds);
}

$(document).ready(function() {
	if ( $("#teller").size() )
		var countdown = setInterval(updateTimer,1000);
});