﻿if (document.layers) {
    document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = moveDiv;

var info;
function showInfo(elem)
{
  if(info == null)initInfo();
  info.show(elem);
}

function hideInfo(elem)
{
  if(info == null)initInfo();
  info.hide(elem);
}

function initInfo()
{
  info = new InfoDiv();
  info.setClipping(0,0,g_pageWidth,-1);
  info.enableFollowMouse(true);
}

function moveDiv(e)
{
    var eventX = (document.all) ? event.clientX : e.pageX;
    var eventY = (document.all) ? event.clientY : e.pageY;
    if(document.all) {
    eventX += getScrollLeft()
    eventY += getScrollTop()
    }
    if (info != null) info.moveVisible(eventX, eventY)
    
    //tooltip 
    var tooltip = document.getElementById('tooltip');
    if (tooltip != null) 
    {
      x = eventX;
      y = eventY; 

      right = (document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth);
      bottom = (window.scrollY || document.documentElement.scrollTop || document.body.scrollTop) + (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight);

      x += 15;
      y += 10;

      if (x > right - tooltip.offsetWidth)
          x = right - tooltip.offsetWidth;

      if (y > bottom - tooltip.offsetHeight)
          y = bottom - tooltip.offsetHeight;

      tooltip.style.top = y + 'px';
      tooltip.style.left = x + 'px';
    }
}


