 // 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;
 }   


function stripe(classname)
	{
 		var even = false;
		/* this cool stuff is conditional assignment :o) */
	   	var evenColor = arguments[1] ? arguments[1] : "#fff";
	   	var oddColor = arguments[2] ? arguments[2] : "#f7f";
		if(document.getElementsByTagName)
		{
			var tables = document.getElementsByTagName('table')	;
			if (!tables) { return; }
			for (var t = 0; t< tables.length; t++)
			{
				var table = tables[t];
				
				var a = table.className.split(' ');
		 		for (z = 0; z < a.length; z++)
				{
					if (a[z] == classname)
					{	
					   	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++) 
							{
					       		if (! hasClass(trs[i]) &&
					           	! trs[i].style.backgroundColor)
								{
					         		var tds = trs[i].getElementsByTagName("td");
					         		for (var j = 0; j < tds.length; j++)
									{
	       				           		var mytd = tds[j];
					           			if ( ! mytd.style.backgroundColor) {
											
					             			mytd.style.backgroundColor = even ? evenColor : oddColor;
					           			}
					         		}
					       		}
					       // flip from odd to even, or vice-versa
					       even =  ! even;
					     }
					}
				}
			}
	  	}
	}
 }