function onShow_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  var top  = (c["pn"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["pn"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

function onShow()
{
  p = document.getElementById(this["pt"]);
  c = document.getElementById(this["cd" ]);

  onShow_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

function onHide()
{
  c = document.getElementById(this["cd"]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

function onAttach(parent, child, position, cursor)
{
  p = document.getElementById(parent);
  c = document.getElementById(child);

  p["pt"]     = p.id;
  c["pt"]     = p.id;
  p["cd"]      = c.id;
  c["cd"]      = c.id;
  p["pn"]   = position;
  c["pn"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;
  {
      p.onmouseover = onShow;
      p.onmouseout  = onHide;
      c.onmouseover = onShow;
      c.onmouseout  = onHide;
  }
}
