pageNavigation = 
{
  'followLink' : function(action)
  {
    var anchor = this.findAnchors(action)[0];
    
    if (anchor)
    {
      var dest = anchor.readAttribute('href');
      
      if (dest)
      {
        window.location = dest;
      }
      else
      {
        anchor.onclick();
      }
    }
  },

  'setShortcut' : function(spec)
  {
    
    var args = spec.split(';');

    var action = args[0];
    var combo  = args[1];
    var label  = args[2];
    
    shortcut.add(combo,function()
                  {
                  	pageNavigation.followLink(action);
                  },{
                  	'type':'keydown',
                  	'propagate':false,
                  	'disable_in_input':true,
                  	'target':document
                  });
                  
    var anchors = this.findAnchors(action);
    
    for (var i = 0;
         i < anchors.length;
         i++)
    {
      var anchor = $(anchors[i]);
      var title = anchor.readAttribute('title');
      anchor.writeAttribute({'title':(title + ' (' + label + ')')});
      anchor.select('img')[0].writeAttribute({'alt':(title + ' (' + label + ')')});
  	}
  },
  
  'findAnchors' : function(action)
  {
    return $$('a.' + action);
  }
}

