// js/zebra.js

// http://www.bigbold.com/snippets/posts/show/351
/*
	Zebra tables = colouring even and odd rows with javascript
	_after_ the table has been created
*/
function zebra_init () {
	var tables = document.getElementsByTagName("table");
	for (var i = 0; i < tables.length; i++) {
		if (tables[i].className.match(/zebra/)) {
			zebra(tables[i]);
		}
	}
}

function zebra (table) {
	var current = "oddRow";
	var trs = table.getElementsByTagName("tr");
	for (var i = 0; i < trs.length; i++) {
		trs[i].className = current;
		current = current == "evenRow" ? "oddRow" : "evenRow";
	}
}	

