function setcolor(r, color){
    if (color == "" || typeof(r.style) == "undefined") {
        return false;
    }
    if (typeof(document.getElementsByTagName) != "undefined") {
        var theCells = r.getElementsByTagName("td");
    }
    else if (typeof(r.cells) != "undefined") {
        var theCells = r.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = color;
    }

    return true;
}