(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(f,e){var h=this,g=0;h.countre=f.getParam("wordcount_countregex",/\S\s+/g);h.cleanre=f.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$�'"_+=\\\/-]*/g);h.id=f.id+"-word-count";f.onPostRender.add(function(c,d){var b,a;a=c.getParam("wordcount_target_id");if(!a){b=tinymce.DOM.get(c.id+"_path_row");if(b){tinymce.DOM.add(b.parentNode,"div",{style:"float: right"},c.getLang("wordcount.words","Words: ")+'<span id="'+h.id+'">0</span>')}}else{tinymce.DOM.add(a,"span",{},'<span id="'+h.id+'">0</span>')}});f.onInit.add(function(a){a.selection.onSetContent.add(function(){h._count(a)});h._count(a)});f.onSetContent.add(function(a){h._count(a)});f.onKeyUp.add(function(b,a){if(a.keyCode==g){return}if(13==a.keyCode||8==g||46==g){h._count(b)}g=a.keyCode})},_count:function(d){var f=this,e=0;if(f.block){return}f.block=1;setTimeout(function(){var a=d.getContent({format:"raw"});if(a){a=a.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");a=a.replace(f.cleanre,"");a.replace(f.countre,function(){e++})}tinymce.DOM.setHTML(f.id,e.toString());setTimeout(function(){f.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)})();