function mundos_InitializeTooltips()
{
  var links = $$('a');
  links.each(function(lnk) {
    var t = lnk.getAttribute("title");
    if(t != null && t.length != 0)
    {
      lnk.setAttribute("title", "");
      lnk.onmouseover = function(e) { mundos_locate_tooltip(e); $('tooltip-top').innerHTML = t; $('tooltip').show(); return false; };
      lnk.onmouseout  = function(e) { $('tooltip').style.left = "-999px"; return false; };
      lnk.onmousemove = mundos_locate_tooltip;
    }
  });  
}

function mundos_getViewPortWidth()
{
  if (typeof window.innerWidth != 'undefined') // Mozilla
  {
    return window.innerWidth;
  }
  else if (typeof document.documentElement != 'undefined'
      && typeof document.documentElement.clientWidth !=
      'undefined' && document.documentElement.clientWidth != 0) // IE Standards compliant
  {
    return document.documentElement.clientWidth;
  }
  else // Old IE
  {
    return document.getElementsByTagName('body')[0].clientWidth;
  }  
}

function mundos_locate_tooltip(e)
{
  var posx = 0;
  var posy = 0;
  var hor_middle = getViewPortWidth() / 2;
  var vert_middle = getViewPortHeight() / 2 + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
  var tooltip = $('tooltip');
  
  if(e == null) e = window.event;
  if(e.pageX || e.pageY)
  {
    posx=e.pageX; posy=e.pageY;
  }
  else if(e.clientX || e.clientY)
  {
    if(document.documentElement.scrollTop)
    {
      posx = e.clientX + document.documentElement.scrollLeft;
      posy = e.clientY + document.documentElement.scrollTop;
    }
    else
    {
      posx = e.clientX + document.body.scrollLeft;
      posy = e.clientY + document.body.scrollTop;
    }
  }
  
  var x = posx - 100;
  var y = posy + 22
  tooltip.style.left = x.toString() + "px";
  tooltip.style.top  = y.toString() + "px";  
}
