	var cil;
	var active;
	
		function TSButton(idi,ion)

		{document.images[idi].src=eval(ion+".src")}

	
	function getx (id) {
		var objekt = document.getElementById(id);
		var pozicex = 0;
		if (objekt.offsetParent)
		{
			while (objekt.offsetParent)
				{
					pozicex += objekt.offsetLeft;
					objekt = objekt.offsetParent;
				}
		}
		else if (objekt.x) pozicex += objekt.x;
		return pozicex;
	}


	function gety (id) {
		var objekt = document.getElementById(id);
		var pozicey = 0;
		if (objekt.offsetParent)
		{
			while (objekt.offsetParent)
				{
					pozicey += objekt.offsetTop;
					objekt = objekt.offsetParent;
				}
		}
		else if (objekt.y) pozicey += objekt.y;
		return pozicey;
	}


	function predek(menuid) {
		var mujcil = cil;
		while (mujcil = mujcil.parentNode)
		{
			if (mujcil == document.getElementById(menuid)) return true;
		}
		return false;
	}
	
	function showmenu (id,menuid)
	{
	var pox = getx(id);
	var poy = gety(id);
	poy += document.getElementById(id).height;
	//TSButton(id,obr);
	//document.getElementById(menuid).style.left=20;
	//document.getElementById(menuid).style.top=30;
	if (active) {document.getElementById(active).style.visibility='hidden';clearTimeout()}
	active = menuid;
	document.getElementById(menuid).style.visibility='visible';
	}
	
	function schovat (id,menuid) {
	if ((document.getElementById(menuid) != cil) && (document.getElementById(id) != cil) && !predek(menuid)) {
	document.getElementById(menuid).style.visibility='hidden';
	//TSButton(id,obr);
	} else clearTimeout();
	}
	
	function smaz (id,menuid,e)
	{
	if (!e) e = window.event;
	if (e.relatedTarget) cil = e.relatedTarget; else cil = e.toElement;
	setTimeout("schovat('"+id+"','"+menuid+"')",100);
	}
		