/*
Form validation script

Written by Matt Dolan
June 2008

Handles validation for various data types in text input fields.
Set the data type for each <input> tags by setting the 'validation' attribute, e.g.:
	<input type="text" name="salary" validate="currency" />

Requires Prototype 1.6 - http://www.prototypejs.org

Validation types:

ATTRIBUTE	| MEANING
-----------------------------------------------------
text		| Text - anything that's not nothing
date		| Date
integer		| Integer
number		| Number
currency	| Currency
phone		| Telephone
email		| Email
postcode	| UK Postcode

*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('r K(){6(1r.1Z.2o.h(/28/)==-1){1q(\'22 23 1o K - j 1E 1G@1I.1J 1V 2x 1Y\');7 v}5.1n=r(){8 a=$$(\'1F\');H(8 i=0;i<a.N;i++){B=v;8 b=$(a[i]).1g(\'x\');H(4=0;4<b.N;4++){6($(b[4]).24(\'C\')){B=2m;$(b[4]).Q(\'1D\',5.1w.y(5));5.1h(b[4])}}6(B){$(a[i]).Q(\'1H\',5.1j.y(5))}}};5.z=r(a){8 b=a.w(\'C\');6(b==\'x\'){7 a.f===\'\'}p 6(b==\'L\'){1k=(a.f.h(/^(0?[1-9]|[12][0-9]|3[O])[- \\/.](0?[1-9]|1[2n])[- \\/.](19|20)?\\d\\d$/)!=-1);1l=(a.f.h(/^(0?[1-9]|[12][0-9]|3[O])\\s?(1p|1s|1t|1u)?\\s?(1C|1x|1y|1A|1B|R|S|T|U|V|W|X|Y|10|11|13|15|16|17|1a|1b|1c|1d|1e)\\s?(19|20)?\\d\\d$/i)!=-1);1f=(a.f.h(/^(1C|1x|1y|1A|1B|R|S|T|U|V|W|X|Y|10|11|13|15|16|17|1a|1b|1c|1d|1e)\\s?(0?[1-9]|[12][0-9]|3[O])\\s?(1p|1s|1t|1u)?\\s?(18|19|20|21)?\\d\\d$/i)!=-1);7(!(1k||1l||1f))}p 6(b==\'t\'){7(a.f.h(/^-?[0-9.,]+$/)==-1)}p 6(b==\'D\'){7(a.f.h(/^-?[0-9]+$/)==-1)}p 6(b==\'E\'){7(a.f.h(/^-?[^a-2s-Z-.,;\'[]()]? ?-?[0-9., ]+k?$/)==-1)}p 6(b==\'F\'){7(a.f.h(/^\\+?[0-9 ()]+$/)==-1)}p 6(b==\'G\'){7(a.f.h(/^[a-o-9!#$%&\'*+\\/=?^1m`{|}~-]+(?:\\.[a-o-9!#$%&\'*+\\/=?^1m`{|}~-]+)*@(?:[a-o-9](?:[a-o-9-]*[a-o-9])?\\.)+[a-o-9](?:[a-o-9-]*[a-o-9])?$/)==-1)}p 6(b==\'I\'){7(a.f.h(/^([A-1K-1L-9][A-1M-1N-9][1O-9]?[1P-9]? ?[0-9][1Q-1R-1S-Z]{2}|1T 1U)$/i)==-1)}p{7 v}};5.1h=r(a){8 b=a.w(\'C\');8 c=a.w(\'J\');1X(b){n\'x\':c=\'l\';m;n\'L\':c=\'l: j q a M L 25/26/27\';m;n\'D\':c=\'l: j q 1v D t, e.g. 29\';m;n\'t\':c=\'l: j q a t, e.g. 3.14\';m;n\'E\':c=\'l: j q 1v 2a 1o E, e.g. £2b\';m;n\'F\':c=\'l: j q a F t, e.g. 2c 2d\';m;n\'G\':c=\'l: j q a M G 2e, e.g. 2f@2g.2h\';m;n\'I\':c=\'l: j q a M 2i I, e.g. 2j 2k\';m}a.2l(\'J\',c)};5.1w=r(a){8 b=u.1z(a);b.P.2p=(5.z(b))?\'2q\':\'\'};5.1j=r(a){8 b=u.1z(a);8 c=$(b).1g(\'x\');H(4=0;4<c.N;4++){6(5.z($(c[4]))){$(c[4]).2r();c[4].P.1i=\'2t\';1q($(c[4]).w(\'J\'));c[4].P.1i=\'\';u.2u(a);7 v}}};u.Q(1r,\'2v\',5.1n.y(5))};8 2w=1W K();',62,158,'||||ii|this|if|return|var|||||||value||search||please||Required|break|case|z0|else|enter|function||number|Event|false|getAttribute|text|bindAsEventListener|isInvalid||formNeedsValidation|validate|integer|currency|phone|email|for|postcode|title|MGDValidator|date|valid|length|01|style|observe|March|Apr|April|May|Jun|June|Jul|July||Aug|August||Sep||Sept|September|Oct|||October|Nov|November|Dec|December|longDate2|getInputs|_setHint|backgroundColor|_formSubmit|shortDate|longDate1|_|initialise|of|st|alert|window|nd|rd|th|an|_fieldBlur|January|Feb|element|February|Mar|Jan|blur|contact|form|matt|submit|dolan|me|PR|UWYZ0|HK|Y0|AEHMNPRTVXY0|ABEHMNPRVWXY0|ABD|HJLN|UW|GIR|0AA|to|new|switch|license|location|||Unlicensed|use|hasAttribute|dd|mm|yyyy|bblecr|300|amount|50|01234|567890|address|user|domain|com|UK|AB12|3CD|setAttribute|true|012|href|borderColor|#8E0B51|activate|zA|#8E0B51|stop|load|validator|obtain'.split('|'),0,{}))