/* Form Validation */ function FV() {} FV.prototype = { YD: YAHOO.util.Dom, YE: YAHOO.util.Event, YA: YAHOO.util.Anim, YC: YAHOO.util.Connect, strength: -1, uidcount: 0, uids: {}, codes: { men_10477: 'Please enter the required details', txt_10478: 'Please enter the required details', txt_10479: 'Please enter the required details', txt_10483: 'Please enter a valid National Insurance Number', men_10482: 'Day', men_10481: 'Month', men_10480: 'Year', txt_10484: 'Please enter the required details', txt_10485: 'Please enter the required details', men_10519: 'Day', men_10518: 'Month', men_10517: 'Year'}, init: function() { this.YE.on(this.YD.get('men_10477'), 'change', function() { FV.validate('men_10477', this.options.selectedIndex, 'men_10477', true); }); this.YE.on(this.YD.get('men_10477'), 'blur', function() { FV.validate('men_10477', this.options.selectedIndex, 'men_10477', true); }); this.YE.on(this.YD.get('txt_10478'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_10478', this.value, 'txt_10478'), 'txt_10478', FV.codes.txt_10478,'textinput'); } }); this.YE.on(this.YD.get('txt_10479'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_10479', this.value, 'txt_10479'), 'txt_10479', FV.codes.txt_10479,'textinput'); } }); this.YE.on(this.YD.get('txt_10483'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_10483', this.value, 'txt_10483'), 'txt_10483', FV.codes.txt_10483,'textinput'); } }); this.YE.on(this.YD.get('men_10482'), 'change', function() { FV.validate('men_10482', this.options.selectedIndex, 'men_10482', true); }); this.YE.on(this.YD.get('men_10482'), 'blur', function() { FV.validate('men_10482', this.options.selectedIndex, 'men_10482', true); }); this.YE.on(this.YD.get('men_10481'), 'change', function() { FV.validate('men_10481', this.options.selectedIndex, 'men_10481', true); }); this.YE.on(this.YD.get('men_10481'), 'blur', function() { FV.validate('men_10481', this.options.selectedIndex, 'men_10481', true); }); this.YE.on(this.YD.get('men_10480'), 'change', function() { FV.validate('men_10480', this.options.selectedIndex, 'men_10480', true); }); this.YE.on(this.YD.get('men_10480'), 'blur', function() { FV.validate('men_10480', this.options.selectedIndex, 'men_10480', true); }); this.YE.on(this.YD.get('txt_10484'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_10484', this.value, 'txt_10484'), 'txt_10484', FV.codes.txt_10484,'textinput'); } }); this.YE.on(this.YD.get('txt_10485'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_10485', this.value, 'txt_10485'), 'txt_10485', FV.codes.txt_10485,'textinput'); } }); this.YE.on(this.YD.get('men_10519'), 'change', function() { FV.validate('men_10519', this.options.selectedIndex, 'men_10519', true); }); this.YE.on(this.YD.get('men_10519'), 'blur', function() { FV.validate('men_10519', this.options.selectedIndex, 'men_10519', true); }); this.YE.on(this.YD.get('men_10518'), 'change', function() { FV.validate('men_10518', this.options.selectedIndex, 'men_10518', true); }); this.YE.on(this.YD.get('men_10518'), 'blur', function() { FV.validate('men_10518', this.options.selectedIndex, 'men_10518', true); }); this.YE.on(this.YD.get('men_10517'), 'change', function() { FV.validate('men_10517', this.options.selectedIndex, 'men_10517', true); }); this.YE.on(this.YD.get('men_10517'), 'blur', function() { FV.validate('men_10517', this.options.selectedIndex, 'men_10517', true); }); }, validate: function(t, v, n, sl) { switch(t) { case 'men_10477': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_10477,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_10477,'menuinput'); return false; } break; case 'txt_10478': var r = new RegExp(".","gi"); break; case 'txt_10479': var r = new RegExp(".","gi"); break; case 'txt_10483': var r = new RegExp("^[a-z]{2}(?:\\s*\\d\\s*){6}[a-z]$","gi"); break; case 'men_10482': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_10482,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_10482,'menuinput'); return false; } break; case 'men_10481': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_10481,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_10481,'menuinput'); return false; } break; case 'men_10480': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_10480,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_10480,'menuinput'); return false; } break; case 'txt_10484': var r = new RegExp(".","gi"); break; case 'txt_10485': var r = new RegExp(".","gi"); break; case 'men_10519': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_10519,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_10519,'menuinput'); return false; } break; case 'men_10518': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_10518,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_10518,'menuinput'); return false; } break; case 'men_10517': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_10517,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_10517,'menuinput'); return false; } break; } if (r) { if (r.exec(v)) { return true; }else{ return false; } } }, showStatus: function(s, id, m, c) { FV.YD.get('status-'+id).className = 'l'; FV.YD.setStyle('status-'+id, 'opacity', 1); FV.YD.get('status-'+id).innerHTML = ''; clearTimeout(FV.YD.get('status-'+id).statim); FV.YD.get('status-'+id).statim = setTimeout(function() { FV.YD.get(id).className = c; if (s) { FV.YD.get('status-'+id).className = 's'; if (FV.YD.get('strength-'+id)) { FV.YD.get('strength-'+id).style.display = 'block'; FV.YD.get(id).className = c; } }else{ FV.YD.setStyle('status-'+id, 'opacity', 1); FV.YD.get('status-'+id).className = 'f'; FV.YD.get('status-'+id).innerHTML = m; FV.YD.get(id).className = c + ' fail'; } }, 500); return s; }, getType: function(form) { var e = 0; for(i=0;i