// User script file

var SMSTimeout = null;
function checkFieldLength(id) {
  clearTimeout(SMSTimeout);
  SMSTimeout = setTimeout(function() {
    var obj = getObjectById(id);
    if (!obj || !obj.value) return;
    var valueLength = obj.value.length;
    if (valueLength > obj.getAttribute('maxlength'))
      ChangeClass(obj, 'clFlatTextInputError');
    else
      ChangeClass(obj, 'clFlatTextInput');
    SetContent(id+'_SIZE', parseInt(valueLength));
  }, 200);
}

