window.onload = initialize;
function initialize()
	{
	findTables();
	}





/* to make reading the tables of data easier alternate the color of each row */
var color = new Array();
// place as many colors as you like in any color scheme
color["grey"] = new Array('#DDDDDD','#A5B9CD');
color["lightblue"] = new Array('#F0F3FA','#ffffff');

// choose chart colors from arrays above; define as many color schemes as you want
var chooseChartColor = "grey";

// first row of chart (different color to denote header)
var firstRow = '#C5D4F2';  /* dark grey C9C9C9 */
var colorFirstRow = false;

// looks for a table with id named in the filter
// this way can color multiple tables on a page
function findTables()
	{
	// use regex so that if there multiple tables on one page
	// all tables will still have their rows alternately colored
	// id of table should be "nascarSchedule#"
	// but that can be changed to any name, as long as the name is followed by a number
	var filter = /nascarSchedule[0-9]+/;
	var t= document.getElementsByTagName("table");
	allTables = t.length;
	for (x=0;x<allTables;x++) { if ( filter.test(t[x].id) ) { colorTables(t[x].id, chooseChartColor); } }
	}

// will impose the color scheme
// defined in "chooseChartColor"
// on any table with appropriate id name
function colorTables(id, whatColor)
	{
	if(document.getElementsByTagName)
		{
		var table = document.getElementById(id);
		var rows = table.getElementsByTagName("tr");
		for(i = 0; i < rows.length; i++)
			{
			var newColor = ( i==0  && colorFirstRow ) ? firstRow : color[whatColor][i % color[whatColor].length];
			rows[i].style.backgroundColor = newColor;
			}
		}
	}
