/* 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_2309: 'You must enter your name to review a trader', txt_2959: 'You must enter your email address or phone number to be able to submit feedback', txt_2310: 'Please enter the required details', men_2312: 'Please rate this trader'}, init: function() { this.YE.on(this.YD.get('txt_2309'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_2309', this.value, 'txt_2309'), 'txt_2309', FV.codes.txt_2309,'textinput'); } }); this.YE.on(this.YD.get('txt_2959'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_2959', this.value, 'txt_2959'), 'txt_2959', FV.codes.txt_2959,'textinput'); } }); this.YE.on(this.YD.get('txt_2310'), 'blur', function(event) { var e = event || window.event; if (e.keyCode != 9 && this.value.length > 0) { FV.showStatus(FV.validate('txt_2310', this.value, 'txt_2310'), 'txt_2310', FV.codes.txt_2310,'textinput'); } }); this.YE.on(this.YD.get('men_2312'), 'change', function() { FV.validate('men_2312', this.options.selectedIndex, 'men_2312', true); }); this.YE.on(this.YD.get('men_2312'), 'blur', function() { FV.validate('men_2312', this.options.selectedIndex, 'men_2312', true); }); }, validate: function(t, v, n, sl) { switch(t) { case 'txt_2309': var r = new RegExp(".","gi"); break; case 'txt_2959': var r = new RegExp(".","gi"); break; case 'txt_2310': var r = new RegExp(".","gi"); break; case 'men_2312': if (this.YD.get(n).options[v].value != '') { if (sl) { this.showStatus(true, n, this.codes.men_2312,'menuinput'); } return true; }else{ this.showStatus(false, n, this.codes.men_2312,'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