﻿function Menu(id,items)
{this.ID=id;this.Items=items;this._menu=null;this.Init();}
function MenuItem(menuid,id,name)
{this.ParentID=menuid;this.ID=id;this.Name=name;this._menuitem=null;}
MenuItem.prototype.ToHTMLMenuItem=function()
{if(!this._menuitem)
{this._menuitem=document.createElement("div");with(this._menuitem)
{className="SubMenuItem";innerHTML=this.Name;eval("this._menuitem.onmouseover = function(e) { Catalog.Show("+this.ParentID+", "+this.ID+"); this.className = 'SubMenuItem_HL'; }");this._menuitem.onmouseout=function(e){this.className="SubMenuItem";}
eval("this._menuitem.onclick  = function(e) { window.location.href='InfoList.aspx?rc="+this.ParentID+"&sc="+this.ID+"'; }");}}
return this._menuitem;}
Menu.prototype.Init=function()
{if(this._menu)
return;with(this)
{_menu=document.createElement("div");_menu.className="SubMenu";_menu.style.display="none";if(isIE)
_menu.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";else
_menu.style.opacity=0.9;for(var i=0;i<Items.length;i++)
_menu.appendChild(Items[i].ToHTMLMenuItem());document.body.appendChild(_menu);}}
Menu.prototype.Show=function(x,y)
{if(!this._menu||this.Items.length==0)
return;with(this._menu.style)
{left=x+"px";top=y+"px";display="";}}
Menu.prototype.Hide=function()
{this._menu.style.display="none";}