// defined in foodPopup.js
// var tooltip = new Tooltip();
// var timer;

function showTooltipEquipment(event, urlId) {
	showTooltipGeneric(event, "../tooltip/equipment.xhtml?filename=" + urlId);
}
	 
function showTooltipGeneric(event, link) {
    var e = event || window.event; // IE doesn't pass event as argument 
    var x = e.clientX + Geometry.getHorizontalScroll() + 25;
    var y = e.clientY + Geometry.getVerticalScroll() + 15;
    
    // If a tool tip is pending, cancel it
    if (timer) window.clearTimeout(timer);
    // Schedule a tool tip to appear after x milliseconds
    timer = window.setTimeout(show, 100); // Must put mouse over link for at least 100 ms to launch show method
    
    function show() {
      HTTP.getText(link, 
	function(tip) {
	  if (timer) { // Only show when mouse is over
	    tooltip.show(tip, x, y);
	  }
		  } );	      
    }
  }
	 

// Defined in foodPopup.js
/*function hideTooltip() {
    if (timer) window.clearTimeout(timer);
    timer = null;
    tooltip.hide();
}*/