/**
 * JavaScript Tooltips
 * @author Brent Knop [CeB] <bknop@bcbsm.com>
 * @edited by Brian Bell [OBCE] <bbell@bcbsm.com>
 * @version 1.2
 *
 * @ Revisions ------------------------------------------------------------
 *    Fixed title element from showing up by adding code to 
 *    remove title from DOM onmouseover, then replace it 
 *    onmouseout.  - bk, 9.10.07
 * ----------------------------------------------------------------------------
 *
 * @ Revisions ------------------------------------------------------------
 *    Made Brent's tool tip into a fixed position by removing dynamic 
 *    positioning function and renamed as 'tooltipFixed.js.' Also, removed 
 *    notes on dynamic function. See 'tooltips.js' on bcbsm.com for 
 *    dynamically positioning tooltip.
 *    bb, 5.27.09
 * ----------------------------------------------------------------------------
 *
 * shows tooltips popups on mouseover - calculates position so as not to
 * allow page scrolling, on account of the popup tooltip
 *
 * GLOBAL VARIABLE          DESCRIPTION
 *  TOOLTIP_ELEM            ID of tooltip DIV
 *
 * FUNCTION                 DESCRIPTION
 * ----------------------------------------------------------------------------
 * tooltip()                determines which supporting funcs to call, based on evt
 *   @param  evt            event triggering function
 *   @param  txt            text to display in tooltip DIV
 *   @return void
 *
 * tippos()                 calculates tooltip position, based on window size,
 *                          current mouse position, and size of the tooltip DIV
 *   @param  evt            event triggering function
 *   @param  elem           tooltip DIV (TOOLTIP_ELEM)
 *   @return void
 *
 * toggleCSSProperty()      changes CSS property for specified element
 *   @param  id             ID of elem whose property we want to change
 *   @param  property       CSS property name to change
 *   @param  value          new value to assign to CSS property
 *   @return void 
 */

TOOLTIP_ELEM = "tooltip";
TEXT = "";

function tooltip(evt, obj)
{
  if(document.getElementById(TOOLTIP_ELEM))
  {
    var elem = document.getElementById(TOOLTIP_ELEM);
    evt = (!evt) ? window.event: evt;
    if (obj.title) TEXT = obj.title;
    switch(evt.type)
    {
      case "mouseover" :        
        elem.innerHTML = TEXT;        
        obj.title = "";
        //obj.removeAttribute("title");
        toggleCSSProperty(elem, "display", "block");
      break;
      case "mouseout" :        
        toggleCSSProperty(elem, "display", "none");
        obj.setAttribute("title", TEXT);
      break;            
    }   
  }
}

function toggleCSSProperty(id, property, value)
{
  if(document.getElementById(id))
  {
   var str = "document.getElementById('" + id + "').style." + property + "='" + value + "';";
  }
  else
  {
   var str = "id.style." + property + "='" + value + "';";
  }
  eval(str);
}
