/*
	tableruler()
	written by Chris Heilmann for alistapart.
	enables a rollover of rows for each table with the classname "hlrows"
*/

function tableruler()
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++)
		{
			if(tables[i].className=='list')
			{
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++)
				{
					if(trs[j].parentNode.nodeName=='TBODY')
					{
						trs[j].onmouseover=function(){
							if(this.className=='list-even') {
								this.className='list-even-ruled';
							} else if (this.className=='list-odd') {
								this.className='list-odd-ruled';
							}
							return false;
						}
						
						trs[j].onmouseout=function(){
							if(this.className=='list-even-ruled') {
								this.className='list-even';
							} else if(this.className=='list-odd-ruled') {
								this.className='list-odd';
							}
							return false;
						}
						
						trs[j].onclick=function(){
							var tables=document.getElementsByTagName('table');
							for (var i=0;i<tables.length;i++)
							{
								if(tables[i].className=='list')
								{
									var trs=tables[i].getElementsByTagName('tr');
									for(var j=0;j<trs.length;j++)
									{
										if(trs[j].parentNode.nodeName=='TBODY')
										{
											if(trs[j].className=='list-even-clicked') {
												trs[j].className='list-even';
											} else if(trs[j].className=='list-odd-clicked') {
												trs[j].className='list-odd';
											}

										}
									}
								}
							}
							
							if(this.className=='list-even-ruled' || this.className=='list-even' ) {
								this.className='list-even-clicked';
							} else if(this.className=='list-odd-ruled' || this.className=='list-odd' ) {
								this.className='list-odd-clicked';
							}							
							return true;
						}
					}
				}
			}
		}
	}
}

window.onload=function(){ tableruler();}