// 
//	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 cellClick(ev) 
{
	var th = srcElementFromEvent(ev);
	var tr = th.parentNode;
	var thead = tr.parentNode;
	var table = thead.parentNode;
	var tableData = tableDataFromId(table.id);
	
	if (tableData != null) 
	{
		setSort(tableData, tableHeaderColToDataCol(tableData, th.cellIndex, tr.rowIndex));
	}
	else 
	{
		alert("(cellClick) Unknown table id: " + table.id);
	}
}

function cellEnter(ev) 
{
	var th = srcElementFromEvent(ev);
	var tr = th.parentNode;
	var thead = tr.parentNode;
	var table = thead.parentNode;
	var tableData = tableDataFromId(table.id);

	toolTipData.toolTipText = tableData.Status[tableHeaderColToDataCol(tableData, th.cellIndex, tr.rowIndex)]; 
	toolTipData.toolTipTimeoutId = setTimeout(toolTipTimeout, 1000);
}

function cellLeave(ev) 
{
	clearTimeout(toolTipData.toolTipTimeoutId);
	toolTipData.toolTip.innerHTML = "";
	toolTipData.toolTipShadow.innerHTML = "";
}

function cellMove(ev) 
{
	toolTipData.x = ev.clientX;
	toolTipData.y = ev.clientY;
	
	if (bNetscape) 
	{
		toolTipData.pageX = ev.pageX;
		toolTipData.pageY = ev.pageY;
	}
	
	toolTipSetPosition();
}

function cellRankClick(ev) 
{
	var th = srcElementFromEvent(ev);
	var tr = th.parentNode;
	var tbody = tr.parentNode;
	var table = tbody.parentNode;
	var tableData = tableDataFromId(table.id);
	
	if (tableData != null) 
	{
		toggleRank(tableData, tableColToDataCol(th.cellIndex));
		
		if (cFavoriteTeam != "") 
		{
			drawHighlight(tableData);
			if (tableData.Table.id != "tableTotalId") drawHighlight(tableDataFromId("tableTotalId"));
		}
	}
	else 
	{
		alert("(cellRankClick) Unknown table id: " + table.id);
	}
}

