var brname=navigator.appName, BrVer='';
if(brname.substring(0,2)=="Mi")
	BrVer='E';
var timer = 0;
lastid = -1;
d = document;

function hidden_item(id)	{
	if(!((d.all)?d.all['menu'+id]:d.getElementById('menu'+id)))
		return;
	showElement("SELECT");
	//timer = setTimeout("if('"+id+"' == '"+lastid+"'){((d.all)?d.all['menu"+lastid+"']:d.getElementById('menu"+lastid+"')).style.visibility = 'hidden';}", 500)
	timer = setTimeout('hide('+id+')', 500);
}
function hide(id)	{
	if(id == lastid)	{
		var elm = d.getElementById('menu'+lastid);
		elm.style.visibility = 'hidden';
	}
}

function show(id)
{
	if(!((d.all)?d.all['menu'+id]:d.getElementById('menu'+id)))
		return;
	var elm = d.getElementById('menu'+id);
	var l_elm = d.getElementById('menu'+lastid);
	clearTimeout(timer);
	if((id != lastid) && (lastid!=-1))	{
		l_elm.style.visibility = 'hidden';
	}
	hideElement("SELECT", d.getElementById('menu'+lastid));
	lastid = id;
	((d.all)?d.all['menu'+lastid]:d.getElementById('menu'+lastid)).style.visibility = 'visible';
}




function GetPos(el)
{
	if (!el || !el.offsetParent)return false;
	var res=Array()
	res["left"] = el.offsetLeft;
	res["top"] = el.offsetTop;
	var objParent = el.offsetParent;
	while (objParent.tagName.toUpperCase()!="BODY")
	{
		res["left"] += objParent.offsetLeft;
		res["top"] += objParent.offsetTop;
		objParent = objParent.offsetParent;
	}
	res["right"]=res["left"]+el.offsetWidth;
	res["bottom"]=res["top"]+el.offsetHeight;
	return res;
}

function hideElement(elName, Menu)
{
	if(BrVer!='E') return;
	for (i = 0; i < d.all.tags(elName).length; i++)
	{
		var Obj = d.all.tags(elName)[i];
		if(!(pMenu=GetPos(Menu)))continue;
		if(!(pObj=GetPos(Obj)))continue;

		if(pObj["left"]<pMenu["right"] && pMenu["left"]<pObj["right"] && pObj["top"]<pMenu["bottom"] && pMenu["top"]<pObj["bottom"])	{
			Obj.style.visibility = 'hidden';
		}
	}
}

function showElement(elName)
{
	if(BrVer!='E') return;
	for (i = 0; i < d.all.tags(elName).length; i++)
	{
		obj = d.all.tags(elName)[i];
		if (!obj || !obj.offsetParent)continue;
		if(obj.style.visibility=='hidden')	{
			obj.style.visibility = 'visible';
		}
	}
}
