function createValidations() { var oValidator = new FormValidator(document.forms[0]); oValidator.addValidation('loginName', { check: function(s) { if(s == '') return false; else if(s.match(/^([a-zA-Z0-9]{6,})+$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('password', { check: function(s) { if(s == '') return false; else return true; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('passwordConfirm', { check: function(s) { if(s == '') return false; else return true; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('bank_number', { check: function(s) { if(s == '') return false; else if(s.match(/^([a-zA-Z0-9]{4,})+$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('cvv', { check: function(s) { var st = document.forms[0]['cvv'].value; if(s == '' || st=="XX") return false; else if(s.match(/^\d{3}$/) && st!="XX") return true; else return false; }, format: function(s) { return s; } },true, null,'cvv' ); oValidator.addValidation('cc4', { check: function(s) { var st = document.forms[0]['cc4'].value; if(s == '' || st=="XX") return false; else if(s.match(/^\d{4}$/) && st!="XX") return true; else return false; }, format: function(s) { return s; } },true, null,'cc4' ); oValidator.addValidation('workPhoneNumber', { check: function(s) { if(s == '') return false; else if(s.match(/^\(?\d{3}\)?[-\s]?\d{3}[-\s]?\d{4}$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('workPhoneExtension', { check: function(s) { if(s == '' || s.match(/^[0-9]{3,5}$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('firstName', { check: function(s) { if(s == "") return false else if(s.match(/^[a-zA-Z\s-.]+$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('middleInitial', { check: function(s) { if(s.match(/^[a-zA-Z\s-.]+$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('lastName', { check: function(s) { if(s == "") return false else if(s.match(/^[a-zA-Z\s-.]+$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('busownerAddress1', { check: function(s) { if(s == "") return false else if(s.match(/^[a-z0-9\s-.]+$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('email', { check: function(s) { if(s == '') return false; else if(s.match(/^[a-zA-Z0-9]+([\.]?[a-zA-Z0-9_-])+@[a-zA-Z0-9-]+?\.([a-zA-Z0-9-]([\.]?[a-zA-Z0-9])+){1,}$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); oValidator.addValidation('homePhoneNumber', { check: function(s) { if(s == '') return false; else if(s.match(/^\(?\d{3}\)?[-\s]?\d{3}[-\s]?\d{4}$/)) return true; else return false; }, format: function(s) { return s; } },true, null, null ); } YAHOO.util.Event.addListener(window, 'load', function() { createValidations(); });