var isNS = (navigator.appName == "Netscape");
var isMacIE = ( (navigator.userAgent.indexOf("IE 4")  > -1) && (navigator.userAgent.indexOf("Mac")  > -1) );
var layerRef = (isNS) ? "document" : "document.all";
var formRef = (isNS) ? "document" : "document.forms";
var styleRef = (isNS) ? "" : ".style";
var viditelny = (isNS) ? "show" : "visible"
var neviditelny = (isNS) ? "hide" : "hidden"

var	PopisekZobrazen = false;
var	KterejPopisek = "";
var Menu = 0;
var Schovavej = 0;
var Schov_ms = 800;
var aktualniMenu;

try
	{
		document.addEventListener('click', handleClick, false);
	}
catch(e)
	{
		if(document.attachEvent)
			{
				document.attachEvent('onclick', handleClick);
			}
		else
			{
				document.onclick = handleClick;
			}
	}

function handleClick(e)
	{
		var event = e || window.event;
		if(event.ctrlKey || event.shiftKey || event.altKey) return true;
		if(event.which && event.which != 1) return true;

		var target = event.target || event.srcElement;
		
		while(target && !/^a$/i.test(target.nodeName))
			{
				target = target.parentNode;
			}

		if(!target || !target.getAttribute('rel')) return true;

		var rel = target.getAttribute('rel');
		var href = target.getAttribute('href');
	 
		switch(rel)
			{
				case 'gallery':
				 window.open(href, '', 'width=252,height=252');
				 break;
				case 'external':
					window.open(href);
					break;
				default:
					return true;
			}

		 try
			{
				event.preventDefault();
			}
		catch(e)
			{
			}
		
		return false;
	}
	

function Fotka(IDf, wi, he)
	{
		var hop = "fotka.asp?IDFotky=" + IDf;
		parametry = "scrollbars=no, location=no, status=no, width=" + wi + ", height=" + he + ", menubar=no, resizable=yes, directories=no, toolbar=no";
		window.open(hop,"_blank",parametry);
	}
	
function Anketa(url)
	{
		var hop = url
		parametry = "scrollbars=yes, location=no, status=no, width=700, height=500, menubar=no, resizable=yes, directories=no, toolbar=no";
		window.open(hop,"_blank",parametry);
	}

function UkazMenu(divek,cislo) {
		t = Schov();
//		t = SchovVse();
////		changeImages('sipka' + cislo, 'img/sipka1d_on.gif');
		aktualniMenu = divek;						// Pavel
		aktualniMenu.className = "podbarveneOn";	//Pavel
		var objekt = "PodMenu" + cislo;
		var div = document.getElementById("PodMenu"+ cislo);
		//xpoz = divek.offsetLeft - 96 + 200;
		xpoz = divek.offsetLeft + 10;
		sirka = 130;
		
		if(xpoz + sirka > 1000)
			{
				zbytek = ((xpoz + sirka) - 1000);
				xpoz = xpoz - zbytek;
			}
		
		ypoz = 91;
//		eval(layerRef + '[objekt]' + styleRef + '.left = ' + xpoz + ';');
//		eval(layerRef + '[objekt]' + styleRef + '.top = ' + ypoz + ';');
//		eval(layerRef + '[objekt]' + styleRef + '.visibility = "' + viditelny + '";');
//		eval('div.style.visibility = "' + viditelny + '";');
		div.style.left = xpoz + "px";
		div.style.top = ypoz + "px";
		div.style.visibility = "visible";
		Menu = cislo;
		Schovavej = 0;
//		window.status = "Rozbal podmenu: " + objekt;
//		alert("menu = " + cislo)
		return true;
	}

function SchovMenu(cislo) {
	if(cislo>0){
		var objekt = "PodMenu" + cislo;
		var	div = document.getElementById("PodMenu" + cislo);
		div.style.visibility = "hidden";
//			eval(layerRef + '[objekt]' + styleRef + '.visibility = "' + neviditelny + '";');
//			changeImages('sipka' + cislo, 'img/sipka1d_off.gif');
		window.status = "";
		Schovavej = 0;
		Menu = 0;

		aktualniMenu.className = 'podbarveneOff';				// Pavel
	}
}

function SchovVse() {
	for(i=1;i<=7;i++){
		var objekt = "PodMenu" + i;
		eval(layerRef + '[objekt]' + styleRef + '.visibility = "' + neviditelny + '";');
		//changeImages('sipka' + i, 'img/sipka1d_off.gif');
	}
}

function SchovavejMenu() {
	Schovavej = Menu;
	var TimeOut = window.setTimeout("Schov();",Schov_ms);
}

function Udrzuj() {
	if(Schovavej>0){
		Schovavej = 0;
		var TimeOut = window.clearTimeout();
	}
}

function Schov() {
	SchovMenu(Schovavej);
}

function tisk(id)
	{
		var hop = "tisk.asp?IDZbozi=" + id;
		parametry = "scrollbars=yes, location=no, status=no, width=600, height=600, menubar=yes, resizable=yes, directories=no, toolbar=yes";
		window.open(hop,"_blank",parametry);
	}

function otevriStranku(strStranka)
	{
		window.location.href = strStranka;
	}

function rezervace()
	{
		var hop = "rezervace.asp";
		parametry = "scrollbars=yes, location=no, status=no, width=700, height=600, menubar=no, resizable=yes, directories=no, toolbar=no";
		window.open(hop,"_blank",parametry);
	}

function kalendar()
	{
		var hop = "kalendarVolnychTerminuStrelnice.asp";
		parametry = "scrollbars=yes, location=no, status=no, width=569, height=555, menubar=no, resizable=yes, directories=no, toolbar=no";
		window.open(hop,"_blank",parametry);
	}

