// Creates a new plugin class and a custom listbox
tinymce.create('tinymce.plugins.CodeInsertPlugin', {

    init : function(ed, url) {
        // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('doodleDlg');
        ed.addCommand('doInsertCodeDlg', function() {
            ed.windowManager.open({
                file : url + '/js/code_insert_dlg.php',
                width : 420,//320 + parseInt(ed.getLang('example.delta_width', 0)),
                height :400, //120 + parseInt(ed.getLang('example.delta_height', 0)),
                inline : 1
            }, {
                plugin_url : url, // Plugin absolute URL
                some_custom_arg : 'custom arg' // Custom argument
            });
        });

        // Register example button
        ed.addButton('codeinsert', {
            title : 'Insert Code',
            cmd : 'doInsertCodeDlg',
            image : '/images/code_insert.png'
        });

        // Add a node change handler, selects the button in the UI when a image is selected
        //ed.onNodeChange.add(function(ed, cm, n) {
        //    cm.setActive('example', n.nodeName == 'IMG');
        //});

    }


});


