/*
	Standards Compliant Script
	Alternates Table Columns
	Author : Kevin Cannon
	http://www.multiblah.com
	Last Edited: 12.12.2004
	Version 1.0
	
	Search through the document for tables with the "alternateRows" class,
	and set the class of even rows to "even" to appropriate rows <tr>
	
	Changes:
	4/10/2004 - Added in AddLoadEvent function which piggybacks code onto window.onLoad 
*/

// Main function, called when the page loads
function alternateRows() {
	var i, j;
	if (!document.getElementById) return
	
		var tables = document.getElementsByTagName("table");	  
		//search through tables in document
		for (i=0; i<tables.length; i++) {
			// If table has the right classname
			if (tables[i].className == "alternateRows") {
				rows = tables[i].getElementsByTagName("tr");
				applyClasstoRows(rows);
			}
		}
}

// Function, which is passed a table reference, applies the class 'even' to each even row, <tr> tag
function applyClasstoRows(myRows) {
	// search through rows
	for (j=0; j<rows.length; j++) {
	
	   // Set class for even rows (odd doesn't need to be set)
	   if (j%2 == 0) { 
		  rows[j].setAttribute("className", "even");
		  rows[j].setAttribute("class", "even");
	   }
	}
}
function init() {
		// quit if this function has already been called
		if (arguments.callee.done) return;

		// flag this function so we don't do the same thing twice
		arguments.callee.done = true;
		
		alternateRows();
	}

	/* for Mozilla */
	if (document.addEventListener) {
	//    document.addEventListener("DOMContentLoaded", init, false);
		document.addEventListener("OnLoad", init, false);
	}
	/* for other browsers */
	window.onload = init;