(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var a=this,b=0;a.countre=c.getParam("wordcount_countregex",/\S\s+/g);a.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$�'"_+=\\\/-]*/g);a.id=c.id+"-word-count";c.onPostRender.add(function(h,g){var e,f;f=h.getParam("wordcount_target_id");if(!f){e=tinymce.DOM.get(h.id+"_path_row");if(e){tinymce.DOM.add(e.parentNode,"div",{style:"float: right"},h.getLang("wordcount.words","Words: ")+'<span id="'+a.id+'">0</span>')}}else{tinymce.DOM.add(f,"span",{},'<span id="'+a.id+'">0</span>')}});c.onInit.add(function(e){e.selection.onSetContent.add(function(){a._count(e)});a._count(e)});c.onSetContent.add(function(e){a._count(e)});c.onKeyUp.add(function(e,f){if(f.keyCode==b){return}if(13==f.keyCode||8==b||46==b){a._count(e)}b=f.keyCode})},_count:function(c){var a=this,b=0;if(a.block){return}a.block=1;setTimeout(function(){var d=c.getContent({format:"raw"});if(d){d=d.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");d=d.replace(a.cleanre,"");d.replace(a.countre,function(){b++})}tinymce.DOM.setHTML(a.id,b.toString());setTimeout(function(){a.block=0},2000)},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();