//global variables for all three examples
var colors = new Array('#ffffff','#dddddd','#aaaaaa','#888888');
var bgcolor = 255; 			//starting bgcolor in decimal
var steps = 10;				//the factor, a distance between colors
var down = true;			//direction, if going up or down when calculating bgcolor value
var switchingPoint = 160;	//the numeric value where the foreground color need to change
var fgColorHi = "white";
var fgColorLo = "black";
/****************************************************************************************/
function alternate(id){
	if(document.getElementById){						//check that browser has capabilities
		var table = document.getElementById(id);		//get just the selected table not all of them
		var rows = table.getElementsByTagName("tr");	//get all table rows
		for(i = 0; i < rows.length; i++){				//alternate styles			
			//manipulate rows	
			doAlternate(rows[i], i);
		}
	}
}

/****************************************************************************************/
function doAlternate(row, i){
	if(i % 2 == 0){
		row.className = "even";
	}else{
		row.className = "odd";
	}
}
