function getID(id,doc)
{
	if (!doc) doc = document;
	if (document.all) return doc.all[id];
	else return doc.getElementById(id);
}
function findPElem(el,type,dir,mx)
{
	if(!el)	return;
	var r = new Array();
//	alert(el.tagName + " | " + el.nodeType + " | " + el);
	do { if (el.nodeType == 1 && el.tagName.toUpperCase() == type) {
			r[r.length] = el;
			if (r.length>=mx) return r;
		}
		el = el[dir];
	} while(el);
	return r;
}

function handleMnu(e)
{
	var el = !e.target ? e.srcElement : e.target,i; 
	if(!el) return;
//	var el = e.srcElement; 
	var li = findPElem(el,"LI","parentNode",1);
	if (!li.length || (li[0].className.substr(0,6) != "dynitm" && li[0].className.substr(0,8) != "selected")) return;
	var ul = findPElem(el,"UL","nextSibling",1);
	if (!ul.length) return;
	var tul = findPElem(li[0],"UL","parentNode",1);
	if (!tul.length) return;
	var lis = findPElem(tul[0].firstChild,"LI","nextSibling",100);
	// added close ul.expand
	var open = (ul[0].style.display == "block" || (ul[0].className == "expand" && ul[0].style.display != "none"));
	for (i in lis) {
		var u = findPElem(lis[i].firstChild,"UL","nextSibling",1);
		if(!u || !u.length) continue;
		u[0].style.display = "none";
	}
	if (!open) {
		ul[0].style.display = "block";
		// added nastaveni css stavu pridani otevreneho menu
		li[0].className += " selected_tree";
	}
}


