var SimpleValidate=new Class({Implements:Options,moValidateEl:null,moRequest:null,options:{callback:$empty(),url:false,fieldName:false,minLength:3},initialize:function(a,b){this.moValidateEl=$(a);this.setOptions(b);this.build()},build:function(){this.moValidateEl.addEvent("keyup",this.check.bind(this))},check:function(a){$type(this.moRequest)&&this.moRequest.cancel();if(!(this.options.fieldName===false||this.options.url===false)){if(arguments.length>0)switch(arguments[0].code){case 37:case 39:return}var b=
this.moValidateEl.get("value"),d=$H(),e=true;if($type(a)==="boolean")e=a;if(b.length<this.options.minLength)this.options.callback(false);else{d[this.options.fieldName]=b;this.moRequest=(new Request.JSON({url:this.options.url,method:"post",async:e,data:d.toQueryString(),onComplete:function(c){if($type(c)===false||c.result!="ok")return false;this.options.callback(c.data.valid===true)}.bind(this)})).send()}}}});
