// JavaScript Document

var col = new Array("#970000","#5385BA","#FE9900","#FF9966","#99CC00");

// ODPOCITAVANI CASU
var timerID = null; 
var timerRunning = false; 

function showtime() { 
	today = new Date(); 
	BigDay = new Date("april 22, 2010");
	msPerDay = 24 * 60 * 60 * 1000 ;
	timeLeft = (BigDay.getTime() - today.getTime() + 57600000); 
	if (timeLeft>0) {
	e_daysLeft = timeLeft / msPerDay; 
	daysLeft = Math.floor(e_daysLeft); 
	e_daysLeft = timeLeft / msPerDay; 
	daysLeft = Math.floor(e_daysLeft); 
	e_hrsLeft = (e_daysLeft - daysLeft)*24; 
	hrsLeft = Math.floor(e_hrsLeft); 
	minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60); 
	hrsLeft = hrsLeft; 
	e_minsLeft = (e_hrsLeft - hrsLeft)*60; 
	secLeft = Math.floor(e_hrsLeft); 
	secLeft = Math.floor((e_minsLeft - minsLeft)*60); 
	secLeft = secLeft; 
	Temp3='<strong>'+daysLeft+'</strong> dn&iacute;, <strong>'+hrsLeft+'</strong> hod <strong>'+minsLeft+'</strong> min <strong>'+secLeft+'</strong> s' 
	}
	else {
	Temp3 = 'Sezona 2010 je zah&aacute;jena!';	
	}
	document.getElementById('time_remain').innerHTML=Temp3; 
	timerID = setTimeout("showtime()",1000); 
	timerRunning = true; 
} 

var timerID = null; 
var timerRunning = false; 

function stopclock () { 
	if(timerRunning) 
	clearTimeout(timerID); 
	timerRunning = false; 
} 

function stopClock() { 
	stopclock();     
    return; 
} 

function startclock () { 
	stopclock(); 
	showtime(); 
} 
// --> 



function showtab(id) {
	//alert(col[id]);
	if (document.getElementById('cross_contain_'+id).style.display == "none") {
		//schovani vsech ostatnich tabs
		for (f=0;f<=4;f++) {
			if (document.getElementById('cross_contain_'+f).style.display == "block") {
				document.getElementById('cross_contain_'+f).style.display = "none";
				document.getElementById('menu_'+f).style.borderBottom = "2px solid #FFFFFF";
			}
		}
		//zobrazeni toho spravneho
		document.getElementById('cross_contain_'+id).style.display = "block";
		document.getElementById('menu_'+id).style.borderBottom = "2px solid "+col[id];
	}
}

function hide_panels() {
		document.getElementById('napojovy_listek').style.display = "none";
		document.getElementById('vinny_listek').style.display = "none";
}

function show(id) {
		if (id != 'napojovy_listek') { document.getElementById('napojovy_listek').style.display = "none"; }
			else { document.getElementById('napojovy_listek').style.display = "block"; }
		if (id != 'jidelni_listek') { document.getElementById('jidelni_listek').style.display = "none"; }
			else { document.getElementById('jidelni_listek').style.display = "block"; }
		if (id != 'vinny_listek') { document.getElementById('vinny_listek').style.display = "none"; }
			else { document.getElementById('vinny_listek').style.display = "block"; }
}

function check_pozvanka() {
		txt = "";
		if (document.getElementById('jmeno').value=="") txt = txt + "- Vaše jméno\n";
		if (document.getElementById('email').value=="") txt = txt + "- Vaši emailovou adresu\n";
		if (document.getElementById('recipients').value=="") txt = txt + "- Emailové adresy příjemců pozvánky\n";
		if (document.getElementById('text').value=="") txt = txt + "- Text pozvánky";
		
		if (txt=="") {
				return true;
		} else {
				alert("Prosím doplňte následující pole:\n"+txt);
				return false;
		}
}

function move_calendar(month,year) {
		sess = Math.floor(Math.random()*10000000);
		target = 'event_calendar';
		url = "inc/event_calendar.php?month="+month+"&year="+year+"&cache="+sess;
		if (window.ActiveXObject)
			{
			  httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			else
			{
			  httpRequest = new XMLHttpRequest();
			}
			httpRequest.open("GET", url, true);
			httpRequest.setRequestHeader("Content-Type", "text/html; charset=windows-1250");
			document.getElementById(target).innerHTML="<div align='center' style='color: #FFFFFF; font-size: 14px; font-weight: bold;'><br /><br />Načítám kalendář...</div>";
			httpRequest.onreadystatechange= function () { processRequest(target); } ;
			httpRequest.send(null);
}

function processRequest(target)
{
  if (httpRequest.readyState == 4)
  {
    if(httpRequest.status == 200)
    {
      var mistoZobrazeni = document.getElementById(target);
      mistoZobrazeni.innerHTML = httpRequest.responseText;
    }
    else
    {
        alert("Chyba pri nacitani stanky"+ httpRequest.status +":"+ httpRequest.statusText);
    }
  }
}