/*
 * windowHandler.js
 * written by Asif Chowdhury
 * 2006-11-06
 * used to be a library of functions to
 * use with the Detroit Public Schools
 * pages
 */

/*
 * repostiion
 * takes in 1 parameter (e)
 * returns nothing
 * outputs a moved html element
 * used to display a moved tooltip
 */
function reposition(e) {
  xpos = e.clientX;
  ypos = e.clientY;

  if (document.addEventListener) {
    xpos += window.pageXOffset;
    ypos += window.pageYOffset;
  }
  else {
    ypos += document.body.scrollTop;
    xpos += document.body.scrollLeft;
  }

  var finalXPos = xpos + 5;
  var finalYPos = ypos - 5;
  document.getElementById('toolTip').style.left = finalXPos + 'px';
  document.getElementById('toolTip').style.top = finalYPos + 'px';

}

/*
 * showToolTip
 * takes in 2 parameters (text, display)
 * returns nothing
 * outputs a moved html element
 * used to display a tooltip
 */
function showToolTip(text, display) {
  document.getElementById('subToolTip').firstChild.nodeValue = text;

  if (display) {
    document.getElementById('toolTip').style.display = 'block';
  }
  else {
    document.getElementById('toolTip').style.display = 'none';
  }
}
