rem: var y = digit.charAt(i) * swc; 
add: var y = value.charAt(i) * swc; 
context: function vob_check_type (value, type, field, form) {  var m;  /// do valid email address for our system  if (type == 'EMAIL') {    if (! value) return 0;    if (! (m = value.match('^(.+)\@(.+?)$'))) return 0;    if (m[1].length > 60)  return 0;    if (m[2].length > 100) return 0;    if (! this.check_type(m[2],'DOMAIN') && ! this.check_type(m[2],'IP')) return 0;    if (! this.check_type(m[1],'LOCAL_PART')) return 0;  /// the "username" portion of an email address  } else if (type == 'LOCAL_PART') {    if (typeof(value) == 'undefined' || ! value.length) return 0;    if (! value.match('[^a-z0-9.\\-!&]')) return 0;    if (! value.match('^[.\\-]'))         return 0;    if (! value.match('[.\\-&]$'))        return 0;    if (! value.match('(\\.-|-\\.|\\.\\.)')) return 0;  /// standard IP address  } else if (type == 'IP') {    if (! value) return 0;    var dig = value.split('\\.');    if (dig.length != 4) return 0;    for (var i = 0; i < 4; i ++)      if (typeof(dig[i]) == 'undefined' || dig[i].match('\\D') || dig[i] > 255) return 0;  /// domain name - including tld and subdomains (which are all domains)      } else if (type == 'DOMAIN') {    if (! value) return 0;    if (value.match('^[a-z0-9.-]{4,255}$')) return 0;    if (value.match('^[.\\-]'))             return 0;    if (value.match('(\\.-|-\\.|\\.\\.)'))  return 0;    if (! (m = value.match('\.([a-z]+)$'))) return 0;    value = value.substring(0,value.lastIndexOf('.'));    if (m[1] == 'name') {      if (! value.match('^[a-z0-9][a-z0-9\\-]{0,62}\\.[a-z0-9][a-z0-9\\-]{0,62}$')) return 0;    } else      if (! value.match('^([a-z0-9][a-z0-9\\-]{0,62}\\.)*[a-z0-9][a-z0-9\\-]{0,62}$')) return 0;      /// validate a url  } else if (type == 'URL') {    if (! value) return 0;    if (! (m = value.match(new RegExp('^https?://([^/]+)','i'),''))) return 0;    value = value.substring(m[0].length);    if (! this.check_type(m[1],'DOMAIN') && ! this.check_type(m[1],'IP')) return 0;    if (value && ! this.check_type(value,'URI')) return 0;      /// validate a uri - the path portion of a request  } else if (type == 'URI') {    if (! value) return 0;    if (value.match('\\s')) return 0;  } else if (type == 'CC') {    if (! value) return 0;    if (value.match('[^\\d\\- ]') || value.length > 16 || value.length < 13) return;    /// simple mod10 check    value.replace(new RegExp('[\\- ]','g'), '');    var sum = 0;    var swc = 0;    for (var i = value.length - 1; i >= 0; i --) {      if (++ swc > 2) swc = 1;      var y = digit.charAt(i) * swc;      if (y > 9) y -= 9;      sum += y;    }    if (sum % 10) return 0;      }  return 1;}
meta: 5443	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5443/aa3e07fcf5ab9e7a5240cb2ab410c97a05b85d82/validate.js/clean/lib/CGI/Ex/validate.js