var kOldCellColor;
var kNewCellColor ="#ccccff";

function fFocus(aRow) {
  var theCells = aRow.cells;
  if ( ! theCells ) return;
  kOldCellColor = theCells[0].style.backgroundColor;
  for ( var i = 0; i < theCells.length; i ++ ) {
    theCells[i].style.backgroundColor = kNewCellColor;
  }
}
function fBlur(aRow) {
  var theCells = aRow.cells;
  if ( ! theCells ) return;
  for ( var i = 0; i < theCells.length; i ++ ) {
    theCells[i].style.backgroundColor = kOldCellColor;
  }
}
// border
kBNormal = "lightblue";
kBSelect = "red";
kBError  = "red";
// bg
kBgNormal = "green";
kBgSelect = "blue";
kBgError  = "red";
// text
kTNormal = "green";
kTSelect = "blue";
kTError  = "red";

function f_on_focus( aElement ){
  aElement.style.backgroundColor = 'white';
  aElement.style.borderColor = kBSelect;
  aElement.style.color = 'black';
}
function f_on_blur( aElement , aFlag ){
  aElement.style.backgroundColor = 'white';
  aElement.style.color = 'black';
  if ( aFlag ) {
    if ( 0 < aElement.value.length  ) {
      aElement.style.borderColor = kBNormal;
    }
  } else {
    aElement.style.borderColor = kBNormal;
  }
}
function f_on_error( aElement ){
  aElement.style.backgroundColor = 'white';
  aElement.style.borderColor = kBError;
  aElement.style.color = 'black';
}
