// 
//	TYGR Productions Interactive Statistics
//	
//	This file contains JavaScript support functions for TYGR Productions' Interactive Statistics.  The code contained herein
//  is NOT in the public domain.  This file is provided for download to personal computers and is only authorized for personal 
//  use in conjuction with TYGR Productions' Interactive Statistics.  Copying or reposting this file in whole or in part on 
//  any web server or other network server, or reusing any portion of the code is not allowed without express written consent 
//  of the author.  Any commercial use is strictly prohibited.
//	
//	Copyright (c) 2005 by Jon T. Camp.  All rights reserved.
// 
function toolTipSetPosition() 
{
	if (toolTipData.toolTip.innerHTML != "") 
	{
		if (bIE) 
		{
			if ((toolTipData.x + 10 + toolTipData.toolTip.clientWidth) >= document.body.clientWidth) 
			{
				toolTipData.toolTip.style.left = toolTipData.x + document.body.scrollLeft - 
					toolTipData.toolTip.clientWidth - 2;
			}
			else 
			{
				toolTipData.toolTip.style.left = toolTipData.x + document.body.scrollLeft + 10;
			}
	
			if ((toolTipData.y + 2 + toolTipData.toolTip.clientHeight) >= document.body.clientHeight) 
			{
				toolTipData.toolTip.style.top = toolTipData.y + document.body.scrollTop - 
					toolTipData.toolTip.clientHeight - 2;
			}
			else 
			{
				toolTipData.toolTip.style.top = toolTipData.y + document.body.scrollTop + 2;
			}
		}
		else 
		{
			if ((toolTipData.x + 10 + toolTipData.width) >= document.body.clientWidth) 
			{
				toolTipData.toolTip.style.left = toolTipData.pageX - toolTipData.width - 2;
			}
			else 
			{
				toolTipData.toolTip.style.left = toolTipData.pageX + 10;
			}
			
			if ((toolTipData.y + 2 + toolTipData.toolTip.clientHeight) >= document.body.clientHeight) 
			{
				toolTipData.toolTip.style.top = toolTipData.pageY - toolTipData.toolTip.clientHeight - 2;
			}
			else 
			{
				toolTipData.toolTip.style.top = toolTipData.pageY + 2;
			}
		}

		toolTipData.toolTipShadow.style.left = parseInt(toolTipData.toolTip.style.left) + 3;
		toolTipData.toolTipShadow.style.top = parseInt(toolTipData.toolTip.style.top) + 2;
	}
}

function toolTipTimeout() 
{
	clearTimeout(toolTipData.toolTipTimeoutId);
	toolTipData.toolTipTimeoutId = setTimeout(cellLeave, 4000); 

	var tipTable = document.createElement("table");
	tipTable.style.backgroundColor = toolTipData.toolTip.style.backgroundColor;
	tipTable.border = 1;
	tipTable.cellPadding = 0;
	tipTable.cellSpacing = 0;
	var tipBody = document.createElement("tbody");
	tipTable.appendChild(tipBody);
	var tipRow = appendRow(tipBody);
	var tipCell = appendCellHTML(tipRow, "&nbsp;" + toolTipData.toolTipText + "&nbsp;");
	tipCell.noWrap = "true";
	toolTipData.toolTip.style.left = 0;
	toolTipData.toolTip.style.top = -100;

	var imgShadow = document.createElement("img");
	imgShadow.src = "black.png";
	if (bIE) imgShadow.style.filter = "Alpha(opacity=60)";
	toolTipData.toolTipShadow.style.left = 0;
	toolTipData.toolTipShadow.style.top = -100;

	toolTipData.toolTip.appendChild(tipTable);
	toolTipData.width = toolTipData.toolTip.clientWidth;
	imgShadow.width = toolTipData.toolTip.clientWidth;
	imgShadow.height = toolTipData.toolTip.clientHeight;
	toolTipData.toolTipShadow.appendChild(imgShadow);

	toolTipSetPosition();
}

