
/* TOOLTIPS */
/* given the id of flight/fare element, show tooltip containing the fair info */

var isIE=document.all?true:false;
var isNS4=document.layers?true:false;
var isNS6=!isIE&&document.getElementById?true:false;
var old=!isNS4&&!isNS6&&!isIE;

if(isNS4)
  document.captureEvents(Event.MOUSEMOVE);
if(isNS6)
  document.addEventListener("mousemove", updateFloatingBoxCoordinate, true);
if(isNS4 || isIE)
  document.onmousemove=updateFloatingBoxCoordinate;
  
var tooltipId = null;

function updateFloatingBoxCoordinate(e) {
  var x  = (isNS4 || isNS6) ? e.pageX : event.clientX + 
    (document.documentElement ? document.documentElement.scrollLeft : document.body.scrollLeft);
  var y = (isNS4 || isNS6) ? e.pageY : event.clientY + 
    (document.documentElement ? document.documentElement.scrollTop : document.body.scrollTop);
  
  window.setTimeout('showTooltip(' + x + ',' + y + ')', 0);
}

function showTooltip(x, y) {

  if (tooltipId != null)
  {
    var pos = YAHOO.util.Dom.getXY(tooltipId);
    pos[0] = x + 10;
    pos[1] = y + 18;  
    var tooltip = document.getElementById(tooltipId);
  
    YAHOO.util.Dom.setXY(tooltip, pos);  
  }
}

function showFareInfo(htmlId) {
  showDiv(htmlId);
  tooltipId = htmlId;
}

function hideFareInfo() {
  var pos = new Array(-200, -200);
  YAHOO.util.Dom.setXY(tooltipId, pos);
  tooltipId = null;
}


