var Navlinks =
{
  init: function()
  {
    var links = document.getElementsByTagName("a");
    
    for (var i = 0; i < links.length; i++)
    {
      var title = links[i].getAttribute("title");
      
      if (title && title.length > 0)
      {
        Core.addEventListener(links[i], "mouseover", Navlinks.showInfoListener);
        Core.addEventListener(links[i], "focus", Navlinks.showInfoListener);
        Core.addEventListener(links[i], "mouseout", Navlinks.hideInfoListener);
        Core.addEventListener(links[i], "blur", Navlinks.hideInfoListener);
      }
    }
  },

  showInfo: function(link)
  {
    Navlinks.hideInfo(link);

    var Info = document.createElement("span");
    Info.className = "mousetext";
    var InfoText = document.createTextNode(link.title);
    Info.appendChild(InfoText);
    link.appendChild(Info);
    
    link._mousetext = Info;
    link.title = "";
    
    // Fix for Safari2/Opera9 repaint issue
    document.documentElement.style.position = "relative";
  },
  
  hideInfo: function(link)
  {
    if (link._mousetext)
    {
      link.title = link._mousetext.childNodes[0].nodeValue;      
      link.removeChild(link._mousetext);
      link._mousetext = null;
      
      // Fix for Safari2/Opera9 repaint issue
      document.documentElement.style.position = "static";
    }
  },

  showInfoListener: function(event)
  {
    Navlinks.showInfo(this);
    Core.preventDefault(event);
  },
  
  hideInfoListener: function(event)
  {
    Navlinks.hideInfo(this);
  }
};

Core.start(Navlinks);
