// create zebra stripses / rollover highlighting on tables
// originally found at http://validweb.nl/artikelen/javascript/better-zebra-tables/
// tweaked slightly to only apply to a specific class
// hubby@ubisan, 27/05/07

var stripe = function() {
	
  var tables = document.getElementsByTagName("table");  

  for(var x=0;x!=tables.length;x++) {
    var table = tables[x];
    if (!table) return false;
    
    if(table.className && (' '+table.className+' ').indexOf(' zebra ') != -1) {
 	  	var tbodies = table.getElementsByTagName("tbody");
  		for (var h = 0; h < tbodies.length; h++) {
     		var trs = tbodies[h].getElementsByTagName("tr");
      	for (var i = 0; i < trs.length; i++) { 	 
      		trs[i].onmouseover=function(){
       		this.className += " ruled"; return false;
      		}
      		trs[i].onmouseout=function() {
       			this.className = this.className.replace("ruled", ""); return false;
      		}
      	}
      }
    }
  }
}

window.onload = stripe;