var CSSrules={textarea:function(a){a.onkeydown=function(b){return doKeyPress(a,b)},a.onpaste=function(){return doPaste(a)},a.onkeyup=function(){return doKeyUp(a)},a.onblur=function(){return doKeyUp(a)}}};Behaviour.register(CSSrules);var detect=navigator.userAgent.toLowerCase();function doKeyPress(c,a){maxLength=c.getAttribute("maxlength");var b=window.event?event.keyCode:a.which;if((b==32)||(b==13)||(b>47)){if(maxLength&&(c.value.length>maxLength-1)){if(window.event){window.event.returnValue=null}else{a.cancelDefault;return false}}}}function doKeyUp(a){maxLength=a.getAttribute("maxlength");if(maxLength&&a.value.length>maxLength){a.value=a.value.substr(0,maxLength)}sr=a.getAttribute("showremain");if(sr){document.getElementById(sr).innerHTML=maxLength-a.value.length}}function doPaste(e){maxLength=e.getAttribute("maxlength");if(maxLength){if((window.event)&&(detect.indexOf("safari")+1==0)){var c=e.document.selection.createRange();var b=maxLength-e.value.length+c.text.length;try{var a=window.clipboardData.getData("Text").substr(0,b);c.text=a}catch(d){}if(window.event){window.event.returnValue=null}else{e.value=e.value.substr(0,maxLength);return false}}}};
