
 
// 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...
			alternateRows(oddClass,evenClass,tbodies[h]);
			}
		}
	}

function stripeTBody ( oddClass, evenClass, idlist ) {
	oddClass=oddClass?oddClass:"oddRow";  
	evenClass=evenClass?evenClass:"evenRow"; 
	for (var j=2; j<arguments.length;j++){
		var tBody = document.getElementById(arguments[j]); // Get list of child tbody's
		alternateRows(oddClass,evenClass,tBody);	
		}
	}

function alternateRows(oddClass, evenClass, tbid ){
		var odd=false;  // the flag we'll use to track even/odd rows
		var trs = tbid.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 (length.ths>0) continue; // Skip if this row has headings
			if (!hasClass(trs[i]) ) trs[i].className=(odd=!odd)?oddClass:evenClass; // Do unless row has class
			}
	}

function stripeRows (oddClass, evenClass, tBody){
		var even=false;  // the flag we'll use to track even/odd rows
		var trs = tBody.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...
			alternateRows(oddClass,evenClass,tbodies[h]);		
			}
		}
	}

function alternateTbodys (oddClass, evenClass, id ){
		var odd=false;  // the flag we'll use to track even/odd rows
		var tbl = document.getElementById(id); // find all the <tr> elements... 
		var tbs = tbl.getElementsByTagName("tbody"); // Get list of child tbody's		
		for (var i = 0; i < tbs.length; i++) { 		// ... and iterate through them
			tbs[i].className=(odd=!odd)?oddClass:evenClass; 
			}
	}
	
function assignColumnClass(   ){
	var table = document.getElementById(arguments[0]);// obtain a reference to the desired table
	var trs = table.getElementsByTagName("tr"); // Get list of child tbody's
	for (var h = 0; h < trs.length; h++) {     // and iterate through them...
	//	var ths= trs[h].getElementsByTagName("th"); // find all the <th> elements... 
	//	if (length.ths>0) continue; // Skip if this row has headings
		var tds= trs[h].getElementsByTagName("td"); // find all the <th> elements... 
		for (var i = 0; i < tds.length; i++) { 		// ... and iterate through them
			if  ( !hasClass(tds[i]) // avoid rows having class attribute 
				)  tds[i].className=arguments[i+1];				
			}
			
		var ths= trs[h].getElementsByTagName("th"); // find all the <th> elements... 			
		for (var i = 0; i < ths.length; i++) { 		// ... and iterate through them
			if  ( !hasClass(ths[i]) // avoid rows having class attribute 
				)   ths[i].className=arguments[i+1];				
			}			
			
		}
	
	}
