var timeZone = -new Date().getTimezoneOffset() / 60;
var bigDay = new Date(2009, 9, 3, 11, 20, 0, 0, 0);
var now = new Date();

$(function() {
	if (now > bigDay) {
		countUp();
	} else {
		countDown();
	}
});

function countUp() {
	$('#count').countdown( {
		since : $.countdown.UTCDate(timeZone, bigDay),
		format : 'yOD',
		layout : 'Jsme svoji již {yn} {yl} {on} {ol} {dn} {dl}'
	});
}
function countDown() {
	$('#count').countdown( {
		until : $.countdown.UTCDate(timeZone, bigDay),
		format : 'DHMS',
		layout : 'Zbývá {dn} {dl} {hnn} {hl} {mnn} {ml} {snn} {sl}',
		onExpiry : changeCounting
	});
}
function changeCounting() {
	$('#count').countdown('destroy');
	bigDay = new Date(bigDay.getTime() - 500);
	countUp();
}
