(function(){tinymce.create('tinymce.plugins.MoodleLinkPlugin',{init:function(ed,url){course_id=tinyMCE.activeEditor.getParam('moodleimage_course_id');ed.addCommand('mceMoodleLink',function(){ed.windowManager.open({file:url+'/link.php?id='+course_id,width:600+ed.getLang('example.delta_width',0),height:500+ed.getLang('example.delta_height',0),inline:1},{plugin_url:url,some_custom_arg:'custom arg'});});ed.addButton('moodlelink',{title:'Insert Link',cmd:'mceMoodleLink',image:url+'/img/link.gif'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('moodlelink',n.nodeName=='IMG');});},createControl:function(n,cm){return null;},getInfo:function(){return{longname:'Moodle Link plugin',author:'Glen Davies',authorurl:'http://www.canterbury.ac.nz',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',version:"1.0"};}});tinymce.PluginManager.add('moodlelink',tinymce.plugins.MoodleLinkPlugin);})();