/*
Form validation script
Licensed for henleysolus.co.uk

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