function groom(arids) {
  t= 0;
  for (i= 1; i < arids.length; i++) {
    o= document.getElementById('avail_' + arids[i]);
    t+= parseInt(o.value);
  }

  ncol= 'green';
  if (t > arids[0]) ncol= 'red';

  tdos= document.getElementsByName('brace_' + arids[1]);
  for (j=0; j<tdos.length; j++) 
    tdos[j].style.color= ncol;
  for (i= 1; i < arids.length; i++) {
    o= document.getElementById('avail_' + arids[i]);
    if ( document.getElementById('avail_' +arids[i]).value > 0) {
    o.style.backgroundColor= ncol;
    }
  }
  
  if (ncol == 'red')
    return -1;
  return 0;
}

function grooms() {

  a= gavail_list;
  res= 0;
  for (k=0;k<a.length;k++) {
    plus= groom(a[k]);
    res+= plus;
  }
  if (res < 0) return false;
  return true;
}

