
function menuThing() {
  this.currentNode=null

  this.toggleOpenClose = function(oNode){
    this.doOpenCloseActions(oNode)

    if ((this.oneSubMode)&&(this.currentNode!=null)) {
      if (this.currentNode.id!=oNode.id) {
        this.doOpenCloseActions(this.currentNode, "close");
      }
    }

    this.currentNode=oNode
  }

  this.doOpenCloseActions = function (oNode, action) {
    subNodeId="sub"+oNode;

    if (!document.getElementById(subNodeId))
      return;

    oSub=document.getElementById(subNodeId);
    if ((oSub.style.display=="")||(action=="close")) {
      oSub.style.display="none";
    }
    else {
      oSub.style.display=""
    }
  }

  this.doUrlCommand = function () {
    node='{$activeMenu}';
    if (node!="") {
      oNode=document.getElementById(node);
      this.toggleOpenClose(oNode);
    }
  }

}

if (typeof oMC=="undefined"){
  lmenu = new menuThing();
}

function init() {
  if (typeof lmenu!="undefined") { 
    lmenu.doUrlCommand() 
  } 
}

