/* 
Dynamically applies alternating table row colors

1. Include the script in the page head
2. Assigned the relevant table (or tables) the "striped" class
3. Create a "ruled" class in your style sheet with the appropriate background color

Optional

Create a "striped" class in the style sheet to apply a border, or alter the table in some other manner

*/

function stripe() {
	var t = document.getElementsByTagName("table");
	for (var i=0; i<t.length; i++) {
		if (t[i].className == "striped") {
			var trs = t[i].getElementsByTagName("tr");
			for (var j=0; j<trs.length; j++) {
				if (j%2 == 0){} 
				else {trs[j].className+="ruled";}
			}
		}		
	}
}
window.onload = stripe;