/* 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: { txt_3844: 'Please enter the required details', men_3801: 'Please enter the required details', txt_3792: 'Please enter the required details', txt_3793: 'Please enter the required details', txt_3794: 'Please enter the required details', txt_3795: 'Please enter the required details', txt_3796: 'Please enter the required details', txt_3797: 'Please enter the required details', txt_3798: 'Please enter the required details', txt_3799: 'Please enter the required details', men_3802: 'Please enter the required details', men_3803: 'Day', men_3804: 'Month', men_3839: 'Please enter the required details', txt_3787: 'Please enter the required details', txt_3788: 'Please enter the required details', men_3789: 'Please select a school from the list. ', men_3808: 'Day', men_3807: 'Month', men_3841: 'Please enter the required details', txt_3857: 'Please enter the required details'}, init: function() { this.YE.on(this.YD.get('txt_3844'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3844', this.value, 'txt_3844'), 'txt_3844', FV.codes.txt_3844,'textinput'); } }); this.YE.on(this.YD.get('men_3801'), 'change', function() { FV.validate('men_3801', this.options.selectedIndex, 'men_3801', true); }); this.YE.on(this.YD.get('men_3801'), 'blur', function() { FV.validate('men_3801', this.options.selectedIndex, 'men_3801', true); }); this.YE.on(this.YD.get('txt_3792'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3792', this.value, 'txt_3792'), 'txt_3792', FV.codes.txt_3792,'textinput'); } }); this.YE.on(this.YD.get('txt_3793'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3793', this.value, 'txt_3793'), 'txt_3793', FV.codes.txt_3793,'textinput'); } }); this.YE.on(this.YD.get('txt_3794'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3794', this.value, 'txt_3794'), 'txt_3794', FV.codes.txt_3794,'textinput'); } }); this.YE.on(this.YD.get('txt_3795'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3795', this.value, 'txt_3795'), 'txt_3795', FV.codes.txt_3795,'textinput'); } }); this.YE.on(this.YD.get('txt_3796'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3796', this.value, 'txt_3796'), 'txt_3796', FV.codes.txt_3796,'textinput'); } }); this.YE.on(this.YD.get('txt_3797'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3797', this.value, 'txt_3797'), 'txt_3797', FV.codes.txt_3797,'textinput'); } }); this.YE.on(this.YD.get('txt_3798'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3798', this.value, 'txt_3798'), 'txt_3798', FV.codes.txt_3798,'textinput'); } }); this.YE.on(this.YD.get('txt_3799'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3799', this.value, 'txt_3799'), 'txt_3799', FV.codes.txt_3799,'textinput'); } }); this.YE.on(this.YD.get('men_3802'), 'change', function() { FV.validate('men_3802', this.options.selectedIndex, 'men_3802', true); }); this.YE.on(this.YD.get('men_3802'), 'blur', function() { FV.validate('men_3802', this.options.selectedIndex, 'men_3802', true); }); this.YE.on(this.YD.get('men_3803'), 'change', function() { FV.validate('men_3803', this.options.selectedIndex, 'men_3803', true); }); this.YE.on(this.YD.get('men_3803'), 'blur', function() { FV.validate('men_3803', this.options.selectedIndex, 'men_3803', true); }); this.YE.on(this.YD.get('men_3804'), 'change', function() { FV.validate('men_3804', this.options.selectedIndex, 'men_3804', true); }); this.YE.on(this.YD.get('men_3804'), 'blur', function() { FV.validate('men_3804', this.options.selectedIndex, 'men_3804', true); }); this.YE.on(this.YD.get('men_3839'), 'change', function() { FV.validate('men_3839', this.options.selectedIndex, 'men_3839', true); }); this.YE.on(this.YD.get('men_3839'), 'blur', function() { FV.validate('men_3839', this.options.selectedIndex, 'men_3839', true); }); this.YE.on(this.YD.get('txt_3787'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3787', this.value, 'txt_3787'), 'txt_3787', FV.codes.txt_3787,'textinput'); } }); this.YE.on(this.YD.get('txt_3788'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_3788', this.value, 'txt_3788'), 'txt_3788', FV.codes.txt_3788,'textinput'); } }); this.YE.on(this.YD.get('men_3789'), 'change', function() { FV.validate('men_3789', this.options.selectedIndex, 'men_3789', true); }); this.YE.on(this.YD.get('men_3789'), 'blur', function() { FV.validate('men_3789', this.options.selectedIndex, 'men_3789', true); }); this.YE.on(this.YD.get('men_3808'), 'change', function() { FV.validate('men_3808', this.options.selectedIndex, 'men_3808', true); }); this.YE.on(this.YD.get('men_3808'), 'blur', function() { FV.validate('men_3808', this.options.selectedIndex, 'men_3808', true); }); this.YE.on(this.YD.get('men_3807'), 'change', function() { FV.validate('men_3807', this.options.selectedIndex, 'men_3807', true); }); this.YE.on(this.YD.get('men_3807'), 'blur', function() { FV.validate('men_3807', this.options.selectedIndex, 'men_3807', true); }); this.YE.on(this.YD.get('men_3841'), 'change', function() { FV.validate('men_3841', this.options.selectedIndex, 'men_3841', true); }); this.YE.on(this.YD.get('men_3841'), 'blur', function() { FV.validate('men_3841', this.options.selectedIndex, 'men_3841', true); }); this.YE.on(this.YD.get('txt_3857'), 'change', function() { var e = event || window.event; FV.validate('txt_3857', this.checked, 'txt_3857', true); }); }, validate: function(t, v, n, sl) { switch(t) { case 'txt_3844': var r = new RegExp("^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}\s?[0-9]{2}\s?[0-9]{2}\s?[0-9]{2}\s?[A-D]{0,1}","gi"); break; case 'men_3801': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3801,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3801,'menuinput'); return false; } break; case 'txt_3792': var r = new RegExp(".","gi"); break; case 'txt_3793': var r = new RegExp(".","gi"); break; case 'txt_3794': var r = new RegExp(".","gi"); break; case 'txt_3795': var r = new RegExp(".","gi"); break; case 'txt_3796': var r = new RegExp(".","gi"); break; case 'txt_3797': var r = new RegExp(".","gi"); break; case 'txt_3798': var r = new RegExp("[A-PR-UWYZ][A-HK-Y0-9][A-HJKSTUW0-9]?[ABEHMNPRVWXY0-9]? *[0-9][ABD-HJLN-UW-Z]{2}","gi"); break; case 'txt_3799': var r = new RegExp(".","gi"); break; case 'men_3802': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3802,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3802,'menuinput'); return false; } break; case 'men_3803': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3803,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3803,'menuinput'); return false; } break; case 'men_3804': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3804,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3804,'menuinput'); return false; } break; case 'men_3839': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3839,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3839,'menuinput'); return false; } break; case 'txt_3787': var r = new RegExp(".","gi"); break; case 'txt_3788': var r = new RegExp(".","gi"); break; case 'men_3789': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3789,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3789,'menuinput'); return false; } break; case 'men_3808': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3808,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3808,'menuinput'); return false; } break; case 'men_3807': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3807,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3807,'menuinput'); return false; } break; case 'men_3841': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_3841,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_3841,'menuinput'); return false; } break; case 'txt_3857': if (this.YD.get(n).checked != false) { this.showStatus(true, n, this.codes.txt_3857,'checkboxField'); return false; }else{ this.showStatus(false, n, this.codes.txt_3857,'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