var hwmenfirsttime=true;
function openMenu(mx,my,p){
  if (!HW_MenuBuild)
  {
    return;
  }
  if (typeof p == "undefined")
    p={};
  var xpo=p.xp=p.xp||"l";
  var ypo=p.yp=p.yp||"t";
  if (typeof p.h == "undefined")
    p.h=true;

  var x=3;
  var y=3;
  var op;
  p.oname=p.oname||p.mname;
  if (p.mname)
  {
    helpm=eval(p.mname);
  }
  else
    helpm=hwbar;
  if (p.obj)
  {
    helpm.obj_="/"+p.obj;
  }

  if (helpm.container_)
  {
    if (helpm.opTim_)
    {
      Menu_clearTimeout(helpm.opTim_);
      helpm.opTim_=null;
    }
    if (!parent.frames[helpm.container_].HW_pageLoaded)
    {
      var functionString='openMenu(-1,-1';
      if (p.ma)
      {
        functionString+=',{ma:"'+p.ma+'"}';
      }
      functionString+=')';
      helpm.opTim_=Menu_setTimeout(functionString,200,window);
      return;
    }
    referto=eval("parent.frames."+helpm.container_+".document");
    xpo="r";
    ypo="t";
    p.ma="r";
  }
  else
  {
    referto=document;
  }

  if (p.oname)
    op=referto.all(p.oname);
  else
    op=referto.all("opener");

  if (typeof mx !="undefined" && mx!=-1)
  {
    x=mx;
    y=my;
    if (p.h)
      op.style.visibility=vishide;
  }
  else
  {
    if (p.h)
      op.style.visibility=vishide;
    x=computeOffsetLeft(op,"BODY");
    y=computeOffsetTop(op,"BODY");
    var xo=x;
    var yo=y;
    if (xpo=="r")x+=op.offsetWidth;
    if (ypo=="b")y+=op.offsetHeight;
  }
  helpm.showAt(x,y,{ma:p.ma});
  helpm.saveStat();
}
function closeMenu()
{
  hwbar.hide();
  document.all("opener").style.visibility=visshow;
  return false;
}
