//first date until the timer counts down
dateSince = new Date(2012,3,2,9,0,0);
//text in the beginning of the sentence
text = "Do začátku plavební sezóny již zbývá jen<br/> ";

/*
function GetCount counting down date
when it expires it starts counting down again but with new date and text
*/
function GetCount(){
	//actual date
	dateNow = new Date();				
	//amount of time that left
	amount = dateSince.getTime() - dateNow.getTime();	
	delete dateNow;
	
	//condition to preset expired date
	if(amount < 1){
		//new date
		dateSince = new Date(2012,9,30,18,0,0);
		dateNow = new Date();
		amount = dateSince.getTime() - dateNow.getTime();
		delete dateNow;
		//second text in the beginning of the sentence
		text = "Do konce plavební sezóny zbývá ještě ";
	}
	
		days=0;hours=0;mins=0;secs=0;out="";

		amount = Math.floor(amount/1000);

		days=Math.floor(amount/86400);
		amount=amount%86400;

		hours=Math.floor(amount/3600);
		amount=amount%3600;

		mins=Math.floor(amount/60);
		amount=amount%60;

		secs=Math.floor(amount);
		
		out = text + days +" dnů" + ", " + hours + " hodin" + ", " + mins +" minut" + ", " + secs +" vteřin!";
		//changing a text of html tag with id="countdown"
	
	document.getElementById('countdown').innerHTML=out;

		setTimeout("GetCount()", 1000);
	
}
