/* 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_11968: 'Please select a school from the list', txt_11969: 'Please enter the required details', txt_11970: 'Please enter the required details', txt_11971: 'Please enter the required details', txt_11973: 'Please enter the required details', txt_12000: 'Please enter the required details', txt_12001: 'Please check and confirm all the details'}, init: function() { this.YE.on(this.YD.get('men_11968'), 'change', function() { FV.validate('men_11968', this.options.selectedIndex, 'men_11968', true); }); this.YE.on(this.YD.get('men_11968'), 'blur', function() { FV.validate('men_11968', this.options.selectedIndex, 'men_11968', true); }); this.YE.on(this.YD.get('txt_11969'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_11969', this.value, 'txt_11969'), 'txt_11969', FV.codes.txt_11969,'textinput'); } }); this.YE.on(this.YD.get('txt_11970'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_11970', this.value, 'txt_11970'), 'txt_11970', FV.codes.txt_11970,'textinput'); } }); this.YE.on(this.YD.get('txt_11971'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_11971', this.value, 'txt_11971'), 'txt_11971', FV.codes.txt_11971,'textinput'); } }); this.YE.on(this.YD.get('txt_11973'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_11973', this.value, 'txt_11973'), 'txt_11973', FV.codes.txt_11973,'textinput'); } }); this.YE.on(this.YD.get('txt_12000'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_12000', this.value, 'txt_12000'), 'txt_12000', FV.codes.txt_12000,'textinput'); } }); this.YE.on(this.YD.get('txt_12001'), 'change', function() { var e = event || window.event; FV.validate('txt_12001', this.checked, 'txt_12001', true); }); }, validate: function(t, v, n, sl) { switch(t) { case 'men_11968': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_11968,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_11968,'menuinput'); return false; } break; case 'txt_11969': var r = new RegExp(".","gi"); break; case 'txt_11970': var r = new RegExp(".","gi"); break; case 'txt_11971': var r = new RegExp(".","gi"); break; case 'txt_11973': var r = new RegExp(".","gi"); break; case 'txt_12000': var r = new RegExp(".","gi"); break; case 'txt_12001': if (this.YD.get(n).checked != false) { this.showStatus(true, n, this.codes.txt_12001,'checkboxField'); return false; }else{ this.showStatus(false, n, this.codes.txt_12001,'checkboxField'); return true; } 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