// this function is needed 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;
  }   

window.onload = stripeTable;
function stripeTable() {
	// if this browser doesn't have this function, then just bail out
	if (document. getElementsByTagName == null) return;

	//var class = "zebra";
	// get the table that corresponds to this ID
	var oTable = document.getElementsByTagName("table");
	if (oTable == null) 
		return;
	for (var t = 0; t < oTable.length; t++) {
		if (oTable[t].className == "zebra") {
					
			// get its table body, which contains all the TR tags
			var aTBODY = oTable[t].getElementsByTagName("tbody");
		
			// set the CSS class for each one of the TR tags 
			for (var i = 0; i < aTBODY.length; i++) {
				// get an array of all the TR tags in the TBODY
				var aTR = aTBODY[i].getElementsByTagName("tr");
				for (var j = 0; j < aTR.length; j++) {	
					//check to see whether there is already a bgcolor already assigned
					//if so, skip it
					if (! aTR[j].style.backgroundColor) {
                  
                  var clsVal = "";
                  // check to see if there is a class assigned, if so append the
                  // existing class to the front of the stripe
                  if(hasClass(aTR[j]) != false)
                  {
                     var clsVal = hasClass(aTR[j]) + " ";
                  }
						
                  // the % operator divides the given number by another
						// and returns the remainder. This is how we alternate the
						// rows. 
						aTR[j].className = (j % 2 == 1) ? clsVal + "stripe2" : clsVal + "stripe1";
					}
				}
			}
		}
	}
}

