// Creates a new plugin class and a custom listbox
tinymce.create('tinymce.plugins.DrawToolPlugin', {

    init : function(ed, url) {
        // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('drawToolDlg');
        ed.addCommand('drawToolDlg', function() {
            ed.windowManager.open({
                file : url + '/js/drawtool_dlg.php',
                width : 660,//320 + parseInt(ed.getLang('example.delta_width', 0)),
                height :530, //120 + parseInt(ed.getLang('example.delta_height', 0)),
                inline : 1
            }, {
                plugin_url : url, // Plugin absolute URL
                some_custom_arg : 'custom arg' // Custom argument
            });
        });

        ed.addButton('drawtool', {
            title : 'Draw Tool',
            cmd : 'drawToolDlg',
            image : '/images/drawtool.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');
        //});
    }

});


