  function CMenuAnim(i_, id_)
  {
    this.index  =i_;
    this.id =id_;
    this.te         =null;
    this.tc         =null;
    this.offn       =1;
    this.show =function()
    {
      var self  =this;
      var offn_ =this.offn++;
      if(this.tc)clearTimeout(this.tc);
      if(animMenu2(this.id, "expand", offn_))return ;
      this.te   =setTimeout(function(){self.show();}, 10);
    }
    this.hide =function()
    {
      var self  =this;
      var offn_ =this.offn--;
      if(this.te)clearTimeout(this.te);
      if(animMenu2(this.id, "collapse", offn_))return ;
      this.tc   =setTimeout(function(){self.hide();}, 10);
    }
  }
  function animMenu2(id_, flag)
  {
    var oh  =getObjectHeight(id_);
    if(oh<=0)return;
    
    var offn  =arguments.length>2?arguments[2]:1;
    var bEnd  =false;
    var o   =$(id_);
    var off =parseInt(o.currentStyle.clipBottom);
    if("expand" == flag)
    {
      off   +=offn++;
      if(off > oh){off  =off+2;bEnd =true;}
    }else{
      off   -=offn++;
      if(off < 0)bEnd  =true;
    }
    var clip  ="rect(auto auto "+ off +" auto)";
    o.style.clip  =clip;
    var iIndex    =o.index;
    o             =null;
    if(bEnd)
    {
      if("expand"==flag)
      {
        if(iIndex>=0 && iIndex<g_menuAnim.length && g_menuAnim[iIndex].te)
          clearTimeout(g_menuAnim[iIndex].te);
      }else{
        if(iIndex>=0 && iIndex<g_menuAnim.length && g_menuAnim[iIndex].tc)
        {
          clearTimeout(g_menuAnim[iIndex].tc);
          gs_lastMenuID ="";
        }
      }
      return true;
    }
    return false;
  }
  

  var g_menuAnim  =new Array;
  g_menuAnim[0] =new CMenuAnim(0, "dv_menu_about");
  g_menuAnim[1] =new CMenuAnim(1, "dv_menu_aqbz");





  var gs_lastMenuID ="";
  function showMenu(obj, f)
  {
    var id  =obj.id;if(id.length<=0)return;
    var menuID  =id.replace(/^[^_]+_(.+)$/g, "$1");
    menuID  ="dv_menu_"+ menuID;

    if(1 == f)//show menu
    {
      if(obj.id == gs_lastMenuID)return;
      gs_lastMenuID =obj.id;
      var x, y, iIndex;
      x =getAbsoluteX(obj);
      y =getAbsoluteY(obj) + getObjectHeight(obj);
      with($(menuID))
      {
        style.left  =x;     style.top  =y;
        style.clip="rect(auto auto 0 auto)";
        iIndex    =index;
      }
      g_menuAnim[iIndex].show();
      
    }else{
      var targ  =window.event.toElement.id.toLowerCase();
      if(targ.indexOf("dv_menu_")!=0)
      {
        var iIndex  =$(menuID).index;
        g_menuAnim[iIndex].hide();
      }
    }
  }


  function signMenu(obj, f)
  {
    var to  =window.event.toElement.id;
    if(to.length>0 && to.indexOf("_menu_")>0)return;
      
    var iIndex  =obj.index;
    if(iIndex>=0 && iIndex<g_menuAnim.length && g_menuAnim[iIndex].expandT)
      clearTimeout(g_menuAnim[iIndex].te);
    g_menuAnim[iIndex].hide();
  }
