
function initMenu( id ) {
   YAHOO.util.Event.onContentReady( id, function() {
      var oMenuBar = new YAHOO.widget.MenuBar(id, { autosubmenudisplay: true, hidedelay: 0, lazyload: true, shadow: false } );
      oMenuBar.contextMenuActive = 0;
      oMenuBar.render();

      try {
         Frink.widgets.navigation.contextMenu.subscribe('hide', function( type, args, menuBar ) {
            menuBar.contextMenuActive--;

            if( menuBar.contextMenuActive < 1 ) {
               var submenus = menuBar.getSubmenus();
               for( i in submenus ) {
                  submenus[i].hide();
               }
            }
         }, oMenuBar );

         oMenuBar.subscribe('mousedown', function( type, args, menuBar ) {
            var evt = args[0];

            if( evt.button == 2 ) {
               menuBar.contextMenuActive++;
            }
         }, oMenuBar );

         oMenuBar.subscribe('hide', function( type, args, menuBar ) {
            if( menuBar.contextMenuActive > 0 ) {
               this.show();
            }
         }, oMenuBar );
      } catch( e ) {}
   });
}

