// Code modified for www.racekites.com by Simon Wood on 25/08/04 to contact email SimonWood@hpoom.co.uk

// Function to hide a layer based tooltip.
function hideTooltip( object )
{
	// Get the layer that contains the tooltip.
	var displayObj = document.getElementById( object );
	
	// Hide the tooltip and reset the position.
	displayObj.style.visibility="hidden"
	displayObj.top = 1;
	displayObj.left = 1;
}

// Function to display a layer based tooltip.
function showTooltip( object, inEvent, tipContent, backcolor, bordercolor, textcolor, displaytime )
{
	// Get the layer that contains the tooltip.
	var displayObj = document.getElementById( object );

	// Set up X buffer and Y buffer constants.
	var xBuff = -60;
	var yBuff = -80;
	// Check if event item is near the top of the screen, if it is chnage the y buffer to display the tooltip below.
	if ( inEvent.clientY < 90 ) {
		var yBuff = 20;
	}

	// Set the position of the tooltip.
	if ( inEvent.layerX ) {
		// Mozilla/Netscape/Firefox browsers code ( this is for browser that support layerX and layerY ).
		displayObj.style.left = inEvent.layerX + xBuff;
		displayObj.style.top = inEvent.layerY + yBuff;
	} else {
		// IE browser code ( this will also be called by browsers that don't support layerX and layerY ).
		displayObj.style.left = document.body.scrollLeft + inEvent.clientX + xBuff;
		displayObj.style.top = document.body.scrollTop + inEvent.clientY + yBuff;
	}

	// Set the content and make visible.
	displayObj.innerHTML='<table style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; border: ' + bordercolor + '; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: ' + backcolor + '" width="10" border="0" cellspacing="5" cellpadding="0"><tr><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: ' + textcolor + '">' + unescape( tipContent ) + '</font></td></tr></table>';
	displayObj.style.visibility="visible";
	
	// Set the timeout call for hideTooltip.
	window.setTimeout( "hideTooltip('" + object + "')", displaytime );
}

