
function chars_restantes(theform) {
  var coment_obj = theform.COMENT_TEXTO;
  if(coment_obj) {
    var div_numchars = document.getElementById('numchars');
    if(div_numchars) {
      var chars_restantes = LIMIT_CHARS - coment_obj.value.length;
      if (chars_restantes >= 0) {
        div_numchars.innerHTML = chars_restantes + '';
      } else {
        div_numchars.innerHTML = '0';
        coment_obj.value = coment_obj.value.substring(0, LIMIT_CHARS);
        alert('El número máximo de caracteres permitidos es ' + LIMIT_CHARS);
      };
    };
  };
};
