// These variables will hold the current mouse pointer position.

var mouseX = 0;
var mouseY = 0;

// Set up event capturing.

if (isMinNS4)
  document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMousePosition;

function getMousePosition(e) {

  // Save cursor position using browser-specific code.

  if (isMinNS4) {
    mouseX = e.pageX;
    mouseY = e.pageY;
  }
  if (isMinIE4) {
    mouseX = event.clientX + document.body.scrollLeft;
    mouseY = event.clientY + document.body.scrollTop;
  }
  return true;
}

// Timing and positioning constants for tool tip display.

var toolTipWait =   100;    // Delay before showing tool tip.
var toolTipShow = 15000;    // Time to keep tool tip active.
var toolTipxOff =    10;    // Horizontal distance from mouse.
var toolTipyOff =     0;    // Vertical distance from mouse.

function startToolTip(name) {

  var tip = getLayer(name);

  // Clear out any pending timer.

  if (tip.timerID)
    clearTimeout(tip.timerID);

  // Set timer to show tool tip.

  tip.timerID = setTimeout('showToolTip("' + name + '")', toolTipWait);
}

function showToolTip(name) {

  var tip = getLayer(name);
  
  // Clear out any pending timer.

  if (tip.timerID)
    clearTimeout(tip.timerID);

  // Position and show the tool tip.

  moveLayerTo(tip, mouseX + toolTipxOff, mouseY + toolTipyOff);
  showLayer(tip);
        
  // Set timer to hide the tool tip after a delay.

  tip.timerID = setTimeout('hideToolTip("' + name + '")', toolTipShow);
}

function hideToolTip(name) {

  var tip = getLayer(name);
  
  // Clear out any pending timer.

  if (tip.timerID)
    clearTimeout(tip.timerID);

  hideLayer(tip);
}

