/*
//88888888888888888888888888888888888888888888888888888888888888888//
//88            stripeTables.js                                  88//
//88888888888888888888888888888888888888888888888888888888888888888//
//88 How it works:                                               88//
//88 Finds all the tables in a document                          88//
//88 Loops through every table                                   88//
//88 Finds all the rows in the current table (<tr>)              88//
//88 Loops through every second row                              88//
//88 Checks for the presence of the class attribute              88//
//88 If there is one give it a space seperated class of "even"   88//
//88 If there isn't one it just gives it a class of "even" with- 88//
//88 out the space separation.                                   88//
//88888888888888888888888888888888888888888888888888888888888888888//
//88 Update history:                                             88//
//88 Last Updated May 03, 2006, jallen@uwsp.edu                  88//
//88888888888888888888888888888888888888888888888888888888888888888//
*/

addLoadEvent(stripeTables);


function stripeTables() {
	if (!document.getElementsByTagName) return false; 
	var tables = document.getElementsByTagName("table"); // Find all the tables in a document
	for (var i=0; i<tables.length; i++) { // Loop through every table
	  var rows = tables[i].getElementsByTagName("tr");
	  for (var j=0; j<rows.length; j= j+2) { // Loop through every second row
	    if(!rows[j].getAttribute("class")) {
	      addClass(rows[j],"even");
	    }   
	  }
    }
}

function addClass(element, value) {
  if (!element.className) {
    element.className = value;
  } else {
    newClassName = element.className;
    newClassName += " ";
    newClassName += value;
    element.ClassName = newClassName;
  }
}
