Meetup.DomDeco.MaxCharactersEnforcer=function(){bindMethods(this)};Meetup.DomDeco.MaxCharactersEnforcer.prototype.__repr__=function(){return"Meetup.DomDeco.MaxCharactersEnforcer"};Meetup.DomDeco.MaxCharactersEnforcer.prototype.decorate=function(d){this.elmInput=d;this.elmForm=d.form;this.maxChars=Meetup.DomDeco.MaxCharactersEnforcer.extractMaxChars(this.elmInput);this.pointers=[];this.elmsSubmit=null;this.elmErrorDisplay=null;this.elmOwnErrorDisplay=null;var b,a,c;if(this.maxChars===null){return}if(this.elmInput.value===undefined){return}if(this.elmForm===null){return}this.elmsSubmit=MochiKit.Selector.findChildElements(this.elmForm,["input[type=submit]"]);a=this.elmsSubmit.length;if(a===0){return}for(b=0;b<a;++b){c=this.elmsSubmit[b];this.pointers[this.pointers.length]=MochiKit.Signal.connect(c,"onclick",this.onSubmitClick)}this.pointers[this.pointers.length]=MochiKit.Signal.connect(this.elmInput,"onkeydown",this.onElementKeyDown)};Meetup.DomDeco.MaxCharactersEnforcer.prototype.onElementKeyDown=function(a){try{if(this.elmOwnErrorDisplay){this.elmOwnErrorDisplay.parentNode.removeChild(this.elmOwnErrorDisplay)}}catch(b){LOG.error(MochiKit.Base.serializeJSON(b))}this.elmOwnErrorDisplay=null};Meetup.DomDeco.MaxCharactersEnforcer.prototype.onSubmitClick=function(a){if(this.elmInput.value.length>this.maxChars){var c="<br />";try{c+=Meetup.Copy.errorCommentTooLong}catch(b){LOG.error("please include the appropriate copy.");c+="Your comment is too long."}this.alertError(c);a.preventDefault();a.stopPropagation()}};Meetup.DomDeco.MaxCharactersEnforcer.prototype.alertError=function(a){if(this.elmInput.id.length!==0){this.elmErrorDisplay=document.getElementById("charCount_"+this.elmInput.id)}if(this.elmErrorDisplay&&MochiKit.DOM.isChildNode(this.elmErrorDisplay,document.body)){try{if(this.elmOwnErrorDisplay!==null){this.elmOwnErrorDisplay.parentNode.removeChild(this.elmOwnErrorDisplay)}}catch(b){LOG.error(MochiKit.Base.serializeJSON(b))}this.elmOwnErrorDisplay=Meetup.DomDeco.MaxCharactersEnforcer.buildOwnErrorDisplay();this.elmErrorDisplay.appendChild(this.elmOwnErrorDisplay);this.elmOwnErrorDisplay.innerHTML=a}else{alert(a)}};Meetup.DomDeco.MaxCharactersEnforcer.buildOwnErrorDisplay=function(){var a=document.createElement("span");a.style.color="#FF0000";a.style.fontWeight="bold";return a};Meetup.DomDeco.MaxCharactersEnforcer.extractMaxChars=function(b){var c=null,a=b.className.match(/.*?maxChars(\d+)/);if(a&&a[1]){c=parseInt(a[1],10)}return c};