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

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

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


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 < document.all.tags(elName).length; i++)
	{
		Obj = document.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 < document.all.tags(elName).length; i++)
	{
		obj = document.all.tags(elName)[i];
		if (!obj || !obj.offsetParent)continue;
		if(obj.style.visibility=="hidden")
			obj.style.visibility = "visible";
	}
}

function ImgShow(ID, width, height, alt) 
{ 
    var scroll = "no"; 
    var top=0, left=0; 
    if(width > screen.width-10 || height > screen.height-28) scroll = "yes"; 
    if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14); 
    if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5); 
    width = Math.min(width, screen.width-10); 
    height = Math.min(height, screen.height-28); 
    var wnd = window.open("","","scrollbars="+scroll+",resizable=no,width="+width+",height="+height+",left="+left+",top="+top); 
    wnd.document.write("<html><head>\n"); 
    wnd.document.write("<"+"script language='JavaScript'>\n"); 
    wnd.document.write("<!--\n"); 
    wnd.document.write("function KeyPress()\n"); 
    wnd.document.write("{\n"); 
    wnd.document.write("    if(window.event.keyCode == 27)\n"); 
    wnd.document.write("        window.close();\n"); 
    wnd.document.write("}\n"); 
    wnd.document.write("//-->\n"); 
    wnd.document.write("</"+"script>\n"); 
    wnd.document.write("<title>"+(alt == ""? "Картинка":alt)+"</title></head>\n"); 
    wnd.document.write("<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\">\n"); 
    wnd.document.write("<img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\">"); 
    wnd.document.write("</body>"); 
    wnd.document.write("</html>"); 
    wnd.document.close(); 
}

