(function(){tinymce.create('tinymce.plugins.MoodleImagePlugin',{init:function(ed,url){course_id=tinyMCE.activeEditor.getParam('moodleimage_course_id');ed.addCommand('mceMoodleImage',function(){ed.windowManager.open({file:url+'/insert_image.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('moodleimage',{title:'Insert Image',cmd:'mceMoodleImage',image:url+'/img/image.gif'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('moodleimage',n.nodeName=='IMG');});},createControl:function(n,cm){return null;},getInfo:function(){return{longname:'Moodle Image 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('moodleimage',tinymce.plugins.MoodleImagePlugin);})();