+ },
+
+ 'min': function(min)
+ {
+ var val = parseFloat(this);
+ if (!isNaN(min) && !isNaN(val))
+ return (val >= min);
+
+ return false;
+ },
+
+ 'max': function(max)
+ {
+ var val = parseFloat(this);
+ if (!isNaN(max) && !isNaN(val))
+ return (val <= max);
+
+ return false;
+ },
+
+ 'rangelength': function(min, max)
+ {
+ var val = '' + this;
+ if (!isNaN(min) && !isNaN(max))
+ return ((val.length >= min) && (val.length <= max));
+
+ return false;
+ },
+
+ 'minlength': function(min)
+ {
+ var val = '' + this;
+ if (!isNaN(min))
+ return (val.length >= min);
+
+ return false;
+ },
+
+ 'maxlength': function(max)
+ {
+ var val = '' + this;
+ if (!isNaN(max))
+ return (val.length <= max);
+
+ return false;
+ },
+
+ 'or': function()
+ {
+ for (var i = 0; i < arguments.length; i += 2)
+ {
+ if (typeof arguments[i] != 'function')
+ {
+ if (arguments[i] == this)
+ return true;
+ i--;
+ }
+ else if (arguments[i].apply(this, arguments[i+1]))
+ {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ 'and': function()
+ {
+ for (var i = 0; i < arguments.length; i += 2)
+ {
+ if (typeof arguments[i] != 'function')
+ {
+ if (arguments[i] != this)
+ return false;
+ i--;
+ }
+ else if (!arguments[i].apply(this, arguments[i+1]))
+ {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ 'neg': function()
+ {
+ return cbi_validators.or.apply(
+ this.replace(/^[ \t]*![ \t]*/, ''), arguments);
+ },
+
+ 'list': function(subvalidator, subargs)
+ {
+ if (typeof subvalidator != 'function')
+ return false;
+
+ var tokens = this.match(/[^ \t]+/g);
+ for (var i = 0; i < tokens.length; i++)
+ if (!subvalidator.apply(tokens[i], subargs))
+ return false;
+
+ return true;
+ },
+ 'phonedigit': function()
+ {
+ return (this.match(/^[0-9\*#]+$/) != null);