(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaManagerPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){if(n.nodeName=='IMG'){return/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia|DivX|SilverLight|Audio|Video|Iframe)/.test(n.className)}return false};function isPopup(n){if((n.nodeName=='A'&&ed.dom.hasClass(n,'jcepopup'))||ed.dom.getParent(n,'a.jcepopup')){return/(flash|quicktime|director|shockwave|windowsmedia|mplayer|real|realaudio|divx|video|audio)/.test(n.type)||/(youtube|google|metacafe)/.test(n.href)}return false};ed.addCommand('mceMediaManager',function(){ed.windowManager.open({file:ed.getParam('site_url')+'index.php?option=com_jce&view=editor&layout=plugin&plugin=mediamanager',width:765+ed.getLang('mediamanager.delta_width',0),height:640+ed.getLang('mediamanager.delta_height',0),inline:1,popup_css:false},{plugin_url:url})});ed.addButton('mediamanager',{title:'mediamanager.desc',cmd:'mceMediaManager',image:url+'/img/mediamanager.png'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('mediamanager',isMediaElm(n)||isPopup(n));if(isPopup(n)){ed.selection.select(n)}});ed.onInit.add(function(){if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){m.add({title:'mediamanager.desc',icon_src:url+'/img/mediamanager.png',cmd:'mceMediaManager'})})}})}});tinymce.PluginManager.add('mediamanager',tinymce.plugins.MediaManagerPlugin)})();