provato così?

codice:
function cOn(tr, colore){
tr.style.backgroundColor=colore;
}

function cOut(tr, colore){
tr.style.backgroundColor=colore;
}