var pattern = { filled : /^\s*\S+(\s+\S+)*/, number : /^\s*-{0,1}\d+\s*$/, phone : /^\s*[\s0-9+-]+\s*/, ssn : /^\s*\d{3}-\d{2}-\d{4}\s*$/, decimal : /^\s*-{0,1}\d*\.\d+\s*$/, zip : /^[a-z]{1}([a-z]{1})?[0-9]{1}([0-9]{1}|[a-z]{1})?([ ])?[0-9]{1}[a-z]{2}|(EIRE)\s*$/i, date : /^\s*([0][1-9]|[1][012])(\/|-|\.)([0][1-9]|[12][0-9]|[3][01])(\/|-|\.)[1-9]\d{3}\s*$/, time : /^\s*([0][0-9]|[1][012]):([0][0-9]|[1-5][0-9])\s*$/, military : /^\s*([01][0-9]|[2][123]):([0][0-9]|[1-5][0-9])\s*$/, currency : /^\s*\-{0,1}\$\d{1,3}(\,\d{3})*\.\d{2}\s*$/, email : /^(\s*[^@ ]+[@][^@ ]+\.[^@ ]+\s*,? *)+$/, postcode_uk : /^[a-z]{1}([a-z]{1})?[0-9]{1}([0-9]{1}|[a-z]{1})?([ ])?[0-9]{1}[a-z]{2}$/i, postcode_ca : /^[a-z]{1}[0-9]{1}[a-z]{1}[0-9]{1}[a-z]{1}[0-9]{1}$/i }; function Validation(F) { this.form = F; this.pattern = pattern; } // ctor function Match(f,p) { var d = 0; var o = 0; var val_type = ''; var checked = ''; var matched = []; var select = false; var selected = false; var field_name = ''; if (typeof(this.form[f])=='undefined') { return false; } // if if (typeof(this.form[f][0]) == 'object' && typeof(this.form[f][0].name) != "string") { if ((typeof(this.form[f].val_type) != 'undefined') && this.form[f].type.match(/select/)) { this.fields = [ this.form[f] ]; } else { this.fields = this.form[f]; } // if else } else { this.fields = [ this.form[f] ]; } // if else for (d=0; d end_date); } // fn Validation.prototype.datecompare = DateCompare;