(function(f){var c,b,e=[],a=window;f.fn.tinymce=function(h){var n=this,o,i,p,k,g,j="",l="";if(!n.length){return n}if(!h){return tinyMCE.get(n[0].id)}function m(){var q=[],r=0;if(d){d();d=null}n.each(function(w,s){var v,u=s.id,t=h.oninit;if(!u){s.id=u=tinymce.DOM.uniqueId()}v=new tinymce.Editor(u,h);q.push(v);if(t){v.onInit.add(function(){var y,x=t;if(++r==q.length){if(tinymce.is(x,"string")){y=(x.indexOf(".")===-1)?null:tinymce.resolve(x.replace(/\.\w+$/,""));x=tinymce.resolve(x)}x.apply(y||tinymce,q)}})}});f.each(q,function(t,s){s.render()})}if(!a.tinymce&&!b&&(o=h.script_url)){b=1;p=o.substring(0,o.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(o)){l="_src"}k=o.lastIndexOf("?");if(k!=-1){j=o.substring(k+1)}a.tinyMCEPreInit=a.tinyMCEPreInit||{base:p,suffix:l,query:j};if(o.indexOf("gzip")!=-1){g=h.language||"en";o=o+(/\?/.test(o)?"&":"?")+"js=true&core=true&suffix="+escape(l)+"&themes="+escape(h.theme)+"&plugins="+escape(h.plugins)+"&languages="+g;if(!a.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=l;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+g+".js");q("themes/"+h.theme+"/editor_template"+l+".js");q("themes/"+h.theme+"/langs/"+g+".js");f.each(h.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+l+".js");q("plugins/"+r+"/langs/"+g+".js")}})},end:function(){}}}}f.ajax({type:"GET",url:o,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;b=2;if(h.script_loaded){h.script_loaded()}m();f.each(e,function(r,q){q()})}})}else{if(b===1){e.push(m)}else{m()}}return n};f.extend(f.expr[":"],{tinymce:function(g){return g.id&&!!tinyMCE.get(g.id)}});function d(){function k(l){if(l==="remove"){this.each(function(m,n){var o=j(n);if(o){o.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(m,n){var o=tinyMCE.get(n.id.replace(/_parent$/,""));if(o){o.remove()}})}function h(m){var l=this,n;if(m!==c){k.call(l);l.each(function(q,o){var p;if(p=tinyMCE.get(o.id)){p.setContent(m)}})}else{if(l.length>0){if(n=tinyMCE.get(l[0].id)){return n.getContent()}}}}function j(l){var m=null;(l)&&(l.id)&&(a.tinymce)&&(m=tinyMCE.get(l.id));return m}function i(l){return !!((l)&&(l.length)&&(a.tinymce)&&(l.is(":tinymce")))}var g={};f.each(["text","html","val"],function(l,o){var n=g[o]=f.fn[o],m=(o==="text");f.fn[o]=function(p){var q=this;if(!i(q)){return n.apply(q,arguments)}if(p!==c){h.call(q.filter(":tinymce"),p);n.apply(q.not(":tinymce"),arguments);return q}else{var s="";var r=arguments;(m?q:q.eq(0)).each(function(u,v){var t=j(v);s+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent()):n.apply(f(v),r)});return s}}});f.each(["append","prepend"],function(l,n){var m=g[n]=f.fn[n],o=(n==="prepend");f.fn[n]=function(p){var q=this;if(!i(q)){return m.apply(q,arguments)}if(p!==c){q.filter(":tinymce").each(function(s,t){var r=j(t);r&&r.setContent(o?p+r.getContent():r.getContent()+p)});m.apply(q.not(":tinymce"),arguments);return q}}});f.each(["remove","replaceWith","replaceAll","empty"],function(l,n){var m=g[n]=f.fn[n];f.fn[n]=function(){k.call(this,n);return m.apply(this,arguments)}});g.attr=f.fn.attr;f.fn.attr=function(l,o,m){var q=this;if((!l)||(l!=="value")||(!i(q))){return g.attr.call(q,l,o,m)}if(o!==c){h.call(q.filter(":tinymce"),o);g.attr.call(q.not(":tinymce"),l,o,m);return q}else{var n=q[0],p=j(n);return p?p.getContent():g.attr.call(f(n),l,o,m)}}}})(jQuery);