var totalRows=9;
var totalCols=5;
var idName="";
var thisCol="";
var thisRow="";
var i="";

function initTBody(){
//rather than using CSS to determine the cell's initial bgcolors
//Initialize all cell backgrounds via this function
	//iterate through each column
	for (i=0; i<totalCols;i++){
		//iterate through each row of that column
		for (jj=1; jj<totalRows;jj++){
			idName="col"+i+"row"+jj;
			setThisClass(idName,'unhighlight');
		}
	}
}


function toggleColRow(thisID,thisClass){
	thisCol=(thisID.charAt(3));
	thisRow=(thisID.charAt(7));
	
	//toggle the row
	toggleRow(thisRow,thisClass)
		
	//toggle the col
	toggleCol(thisCol,thisClass)
	
	//toggle the cell itself
	if(thisClass=="highlight"){
		setThisClass(thisID,'thisHighlight');
	}else{
		setThisClass(thisID,'unhighlight');
		
	}
	
}

function toggleRow(thisRow,thisClass){
	for (i=0; i<totalCols;i++){
		idName="col"+i+"row"+thisRow;
		setThisClass(idName,thisClass);
	}
}



function toggleCol(thisCol,thisClass){
	for (i=0; i<totalRows;i++){
		idName="col"+thisCol+"row"+i;
		setThisClass(idName,thisClass);
	}

}

function setThisClass(objectID,newClass) {
	if(findDOM(objectID,0)){
		var dom = findDOM(objectID,0);
		dom.className = newClass;
	}
}


function getThisClass(objectID) {
	var dom = findDOM(objectID,0);
	return	dom.className ;
}

