/**
 * Popup Menu Version 1.0
 * Èampulka Jiøí
 * Copyright (c) 2003 Èampulka Jiøí
 */

	var zobraz = false;
	var menuTimer;
	var showing;

	function Browser ()
	{
		this.isIE = false;
		this.isMozilla = false;

		ua = navigator.userAgent;

		if ((i = ua.indexOf("MSIE"))>=0)
		{
			this.isIE = true;
			return;
		}

		if ((i = ua.indexOf("Gecko"))>=0)
		{
			this.isMozilla = true;
			return;
		}
	}

	var browser = new Browser();

	function ShowMenu(o,menu)
	{
		if (showing)
		{
			if (showing!=menu)
			{
				zobraz = false;
				HideMenu();
			}
		}
		c = document.getElementById(menu);
		if (!c) {
			return;
		}

		showing = menu;

		if (browser.isIE)
		{
			ss = getStyleSheet(".menuxa");
			//if (ss)	ss.style.width = "100%";
		}
		c.style.left = getPageOffsetLeft(o)+o.offsetWidth-10+"px";
		c.style.top = getPageOffsetTop(o)+4+"px";
		c.style.visibility="visible";
		zobraz = true;
	}

	function getStyleSheet(name)
	{
		if(!name || !document.styleSheets) return null;
		var i = document.styleSheets.length;
		while(i--)
		{
			var rules = document.styleSheets[i].rules ? document.styleSheets[i].rules :
			document.styleSheets[i].cssRules;
			var j = rules.length;
			while(j--) { if(rules[j].selectorText == name) return rules[j]; }
		}
		return null;
	}

	function HideMenu()
	{
		if (!showing) {
			return;
		}
		c = document.getElementById(showing);
		if (!zobraz)
		{
			c.style.visibility="hidden";
		}
		zobraz = false;
	}

	function Zavri(jak,kolik)
	{
		zobraz = !jak;
		if (menuTimer) clearTimeout(menuTimer);
		menuTimer = setTimeout("HideMenu()", kolik);
	}

	function getPageOffsetLeft(el) {
		return el.offsetLeft + (el.offsetParent ? getPageOffsetLeft(el.offsetParent) : 0);
	}

	function getPageOffsetTop(el) {
		return el.offsetTop + (el.offsetParent ? getPageOffsetTop(el.offsetParent) : 0);
	}
