function MemoField(id,maxlength){this.ComponentField($(id),'MemoField');this.count=$(this.id+"_count");this.maxlength=maxlength;this.setup();}MemoField.extend(ComponentField);MemoField.prototype.setup=function(){this.fld.component=this;this.count.auxiliary=true;Event.addListener(this.fld,'keydown',this.keyHandler.bind(this));Event.addListener(this.fld,'keyup',this.keyHandler.bind(this));};MemoField.prototype.clear=function(){this.fld.value='';this.count.value=this.maxlength;};MemoField.prototype.isEmpty=function(){return(this.fld.value.trim()=='');};MemoField.prototype.keyHandler=function(event){var len=this.fld.value.length;if(len>=this.maxlength){this.fld.value=this.fld.value.substring(0,this.maxlength);this.count.value=0;}else{this.count.value=this.maxlength-len;}};
