function get_Obj(ElmID)
{
	if(document.getElementById)
   	{
    	if(document.getElementById(ElmID))
    	{
        	return document.getElementById(ElmID);
        }
   	}

    return false;
}
var timeGen = '';
var timeCount = 0;

function set_None(dmPMain)
{
	timeCount++;

	if(timeCount > 2)
	{
		get_Obj(dmPMain).style.display = 'none';
		timeCount = 0;
		clearInterval(timeGen);
	}
}

function set_NonAll()
{
	for(var i=0; i<10; i++)
	{
		var dmPMain = 'dmPMain_'+i;

		if(get_Obj(dmPMain))
		{
			get_Obj(dmPMain).style.display = 'none';
		}
	}
}

function show_ParentMenu(id, par)
{
	var dmPMain = 'dmPMain_'+id;

	if(!get_Obj(dmPMain)) return false;

	if(par == 0)
	{
		set_NonAll();
		timeCount = 0;
		get_Obj(dmPMain).style.display = 'block';
		clearInterval(timeGen);
	}
	else
	{
		timeGen = setInterval('set_None(\''+dmPMain+'\')', 200);
		timeCount = 0;
	}
}
function popup_big_pic(path, width, height, title, alt)
{
  if(!title) title = "Увеличенное изображение";
  if(!alt) 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=yes,width="+width+",height="+height+",left="+left+",top="+top);
  wnd.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
  wnd.document.write("<html>\n<head>\n");
  wnd.document.write("<title>"+title+"</title>\n");
  wnd.document.write("<script  type=\"text/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("</head>\n");
  wnd.document.write("<body style=\"margin:0px;padding:0px;\" onKeyPress=\"KeyPress()\">\n");
  wnd.document.write("<a href=# title=Закрыть onclick='window.close()'><img src=\""+path+"\" border=\"0\" alt=\""+alt+"\"></a>");
  wnd.document.write("\n</body>");
  wnd.document.write("\n</html>");
  wnd.document.close();
  return false;
}
