
 
// this function is need to work around 
// a bug in IE related to element attributes
function hasClass(obj) {
	var result = false;
	if (obj.getAttributeNode("class") != null) {
		result = obj.getAttributeNode("class").value;
	}
	return result;
}   


function stripeTable ( oddClass, evenClass, idlist ) {

 	oddClass=oddClass?oddClass:"oddRow";  
	evenClass=evenClass?evenClass:"evenRow"; 

	if (!idlist){
		stripeAllTables(oddClass, evenClass);
		return;
		}

	for (var j=2; j<arguments.length;j++){
		var table = document.getElementById(arguments[j]);// obtain a reference to the desired table
		var tbodies = table.getElementsByTagName("tbody"); // Get list of child tbody's
		for (var h = 0; h < tbodies.length; h++) {     // and iterate through them...
			var even=false;  // the flag we'll use to track even/odd rows
			var trs = tbodies[h].getElementsByTagName("tr"); // find all the <tr> elements... 
			for (var i = 0; i < trs.length; i++) { 		// ... and iterate through them
				var ths= trs[i].getElementsByTagName("th"); // find all the <th> elements... 
				if  (
					!(hasClass(trs[i]) || (length.ths>0) )// avoid rows having either a class attribute or headings
					)  { 
					trs[i].className= even ? evenClass : oddClass;
					even=!even;
					}
				}
			}
		}
	}

function stripeAllTables ( oddClass, evenClass, divID ) {
 	oddClass=oddClass?oddClass:"oddRow";  
	evenClass=evenClass?evenClass:"evenRow"; 
	var thisdiv;
	var divtables;
	if (divID){
		thisdiv = document.getElementById(divID );// obtain a reference to the desired div
		divtables = thisdiv.getElementsByTagName("table");	// find all tables inside the div		
		}
	else {  
		divtables = document.getElementsByTagName("table");	// If no 3rd argument, find all tables in the document
		}
	for (var j=0; j<divtables.length;j++){
		var tbodies = divtables[j].getElementsByTagName("tbody");// Get list of child tbody's
		for (var h = 0; h < tbodies.length; h++) {     // and iterate through them...
			var even=false;  // the flag we'll use to track even/odd rows
			var trs = tbodies[h].getElementsByTagName("tr"); // find all the <tr> elements... 
			for (var i = 0; i < trs.length; i++) { 		// ... and iterate through them
				var ths= trs[i].getElementsByTagName("th"); // find all the <th> elements... 
				if  (
					!(hasClass(trs[i]) || (length.ths>0)) // avoid rows having either a class attribute or headings
					)  {
					trs[i].className= even ? evenClass : oddClass;
					even=!even;
					}
				}
			}
		}
	}

