//author: steve tomlin
//date: 5/7/2010
//version: 1
//requires: jquery
//this function adds zebra stripes to tables.

var firebug=(typeof console!='undefined')?console:{debug:function(){}};if(typeof firebug.debug=='undefined'){firebug={debug:function(){}}}
function tableStriper(){firebug.debug('begin tableStriper');$('table').each(function(intIndex){var strHTML=''+this.innerHTML;var strClass='odd';strHTML=strHTML.replace(/(\<\/?)(\w+)([\s\>])/g,function($0,$1,$2,$3){return $1+($2).toLowerCase()+$3});strHTML=strHTML.replace(/(\w\=)(\w+)([\s\>])/g,'$1"$2"$3');strHTML=strHTML.replace(/(\<tr[^\>]*class\=\"?[^\"]*[\s\"]?)odd([\s\"])/g,'$1'+'$2');strHTML=strHTML.replace(/\<tr([\s\>])/g,'¬<tr$1');strHTML=strHTML.replace(/\¬([^\¬]*)\¬/g,'¬$1');strHTML=strHTML.replace(/\¬\<tr([\s\>])/g,'<tr class="'+strClass+'"$1');strHTML=strHTML.replace(new RegExp('(\\<tr\\s[^\\>]*)class\\=\\"'+strClass+'\\"([^\\>]*class\\=\\")','g'),'$1 $2'+strClass+' ');try{$(this)[0].innerHTML=''+strHTML;}catch(err){if(this.outerHTML){var strParent=''+this.outerHTML;var strTableAtts=strParent.substring(0,strParent.search(/\>/)+1).toLowerCase();this.outerHTML=(strTableAtts+strHTML+'</table>');}else{var strAtts='';for(i=0;i<this.attributes.length;i++){if(this.attributes[i].specified){strAtts=' '+this.attributes[i].name+'="'+this.attributes[i].value+'"';}}
var strTableAtts="<table "+strAtts+">";$(this).after(strTableAtts+strHTML+'</table>');$(this).remove();}}});}
$(function(){tableStriper();})

