// JavaScript Document for INP271 Lab3, Mike Behnke

window.onload = function() {

	if (!document.getElementById && !document.getElementsByTagName) { return; }
	
	// Get the table, assign useful variables 
	var theTable = document.getElementsByTagName('table')[0];
	var maxrows = theTable.rows.length;
	var firstTD;
	
	// Loop through entire table
	for (var i=0; i<maxrows; i++) {
		// Center final column
		theTable.rows[i].cells[5].className = 'ctr';
	
		// Add text nodes for hours
		theTable.rows[i].cells[3].appendChild(document.createTextNode(' hours'));

		// Grey out non-billable items
		firstTD = theTable.rows[i].cells[0].firstChild.data;
		if (firstTD == 'Non-Billable') {
			theTable.rows[i].className = 'gry';
		}
	}
}
