//---------------------------------------------------------------------
// FILE: stripe.js
// AUTHOR: Klemen Kenda
// DESCRIPTION: Create Striped table
// DATE: 30/10/2007
//---------------------------------------------------------------------


function stripeTable(tableId)
{
  // Get a reference to the table.
  var theTable = document.getElementById(tableId);
	
  if (theTable)
  {
     // Get all table rows inside the passed table.
     var tableRows = theTable.getElementsByTagName('tr');

     for (var i = 0; i < tableRows.length; i++)
     {		
	// If its an alternating row, set the alternating class
	if ((i % 2) == 0)
	{	
	  tableRows[i].className += " alt";
  } else {
  	tableRows[i].className += " normal";
	}
	// These two events are mostly for old browsers (IE6 specifically) that cannot handle using CSS Hover on elements other than the anchor tag.
	/*
	tableRows[i].onmouseover = function () 
	{ 
	    this.oldClassName = this.className;
	    this.className += " over"; 
	};
	tableRows[i].onmouseout = function () { this.className = this.oldClassName; };
	*/
      }
			
   return true;
  }
  else
  {
     return false;
  }
}


function stripeTableResults(tableId)
{
  // Get a reference to the table.
  var theTable = document.getElementById(tableId);
	
  if (theTable)
  {
     // Get all table rows inside the passed table.
     var tableRows = theTable.getElementsByTagName('tr');

     for (var i = 0; i < tableRows.length; i++)
     {		
	// If its an alternating row, set the alternating class
	
	if (i == 0) tableRows[i].className += " gold";
  if (i == 1) tableRows[i].className += " silver";
  if (i == 2) tableRows[i].className += " bronze";		

	if (i >= 3) {
  	if ((i % 2) == 0) {	
  	  tableRows[i].className += " altres";
    } else {
    	tableRows[i].className += " normalres";
  	}	
	}	
	// These two events are mostly for old browsers (IE6 specifically) that cannot handle using CSS Hover on elements other than the anchor tag.
	/*
	tableRows[i].onmouseover = function () 
	{ 
	    this.oldClassName = this.className;
	    this.className += " over"; 
	};
	tableRows[i].onmouseout = function () { this.className = this.oldClassName; };
	*/
      }
			
   return true;
  }
  else
  {
     return false;
  }
}

function stripeTableResultsHeader(tableId)
{
  // Get a reference to the table.
  var theTable = document.getElementById(tableId);
	
  if (theTable)
  {
     // Get all table rows inside the passed table.
     var tableRows = theTable.getElementsByTagName('tr');

     for (var i = 0; i < tableRows.length; i++)
     {		
	// If its an alternating row, set the alternating class
	
	if (i == 0) tableRows[i].className += " header";
	if (i == 1) tableRows[i].className += " gold";
  if (i == 2) tableRows[i].className += " silver";
  if (i == 3) tableRows[i].className += " bronze";		

	if (i >= 3) {
  	if ((i % 2) == 0) {	
  	  tableRows[i].className += " altres";
    } else {
    	tableRows[i].className += " normalres";
  	}	
	}	
	// These two events are mostly for old browsers (IE6 specifically) that cannot handle using CSS Hover on elements other than the anchor tag.
	/*
	tableRows[i].onmouseover = function () 
	{ 
	    this.oldClassName = this.className;
	    this.className += " over"; 
	};
	tableRows[i].onmouseout = function () { this.className = this.oldClassName; };
	*/
      }
			
   return true;
  }
  else
  {
     return false;
  }
}
