<div id="menubar">
  <script>
    var menubar = $( '#menubar' );
    
    var fRedirect = function( url ) {
      return function() {
        window.location.href = url;
      }
    };
    
    var fCreateLink = function( text, fAction ) {
      var link = $( '<div>' ).text( text );
      link.click( fAction );
      menubar.append(link);
    };

    fCreateLink( 'Forge Event Poller',
      fRedirect( 'forge?page=forge_event_poller' )
    );
    fCreateLink( 'Forge Action Invoker',
      fRedirect( 'forge?page=forge_action_invoker' )
    );
    fCreateLink( 'Forge Rule',
      fRedirect( 'forge?page=forge_rule' )
    );
    fCreateLink( 'Invoke Event',
      fRedirect( 'forge?page=forge_event' )
    );
    fCreateLink( 'Edit Modules',
      fRedirect( 'forge?page=edit_modules' )
    );
    fCreateLink( 'Edit Rules',
      fRedirect( 'forge?page=edit_rules' )
    );
//    fCreateLink( 'admin', fRedirect( 'admin' ) );

    fCreateLink( 'Logout',  function() {
      $.post( '/logout' ).done( fRedirect( document.URL ) );
    });
  </script>
</div>
