title: Create and register TinyMCE plugin with jQuery
body: <p>Using the jQuery TinyMCE, I'm trying to register a custom "plugin" (it's really just a menu within the toolbar)</p>
  
  <p>I'm trying to get this registered, but the code I found on <a href="http://www.tinymce.com/tryit/menu_button.php" rel="nofollow">http://www.tinymce.com/tryit/menu_button.php</a> doesn't seem to work with the jquery version of TinyMCE.  Ideally, I'd like to have my custom plugin code in a separate js file also.</p>
  
  <p>TinyMce init script</p>
  
  <pre><code>// Start TinyMce Editor
      $('#Template_Html').tinymce({
          // Location of TinyMCE script
          script_url: '@Url.Content("~/Scripts/tinymce/tiny_mce.js")',
  
          // General options
          theme: "advanced",
          plugins: "marcusinserts,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
  
          // Theme options
          theme_advanced_buttons1: "fullscreen,preview,code,|,cleanup,removeformat,|,undo,redo,|,cut,copy,paste,pastetext,pasteword,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,outdent,indent,blockquote,|,bullist,numlist,|,sub,sup,|,template,viewhtmlversion,taginserts",
          theme_advanced_buttons2: "bold,italic,underline,strikethrough,|,formatselect,|,link,unlink,anchor,image,|,forecolor,backcolor,|,tablecontrols,|,charmap,iespell,advhr",
          theme_advanced_buttons3: "",
          //theme_advanced_buttons3: "tablecontrols,|,hr,visualaid,|,sub,sup,|,charmap,iespell,advhr",
          //theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
          theme_advanced_toolbar_location: "top",
          theme_advanced_toolbar_align: "left",
          theme_advanced_statusbar_location: "bottom",
          theme_advanced_resizing: false,
  
          // Example content CSS (should be your site CSS)
          //content_css:'/Portal/Content/admin.css',
  
          // Drop lists for link/image/media/template dialogs
          template_external_list_url: "lists/template_list.js",
          external_link_list_url: "lists/link_list.js",
          external_image_list_url: "lists/image_list.js",
          media_external_list_url: "lists/media_list.js",
  
          // Preview options
          plugin_preview_width: "725",
          plugin_preview_height: "600",
  
          // Replace values for the template plugin
          template_replace_values: {
              username: "Some User",
              staffid: "991234"
          },
  
          // View HTML Version insert button
          setup: function (ed) {
              ed.addButton('viewhtmlversion', {
                  title: 'Insert View HTML version link',
                  image: '@Url.Content("~/Scripts/tinymce/themes/advanced/img/custom-icon-view-html.gif")',
                  onclick: function() {
                      ed.focus();
                      ed.selection.setContent('&lt;a href="{VR_HOSTED_LINK}"&gt;Click to view this email in a browser&lt;/a&gt;');
                  }
              });
          }
      });
      // End TinyMce Editor
  </code></pre>
  
  <p>The plugin I'm trying to create and setup:</p>
  
  <pre><code>tinymce.create('tinymce.plugins.MarcusInserts', {
  createControl: function (n, cm) {
      switch (n) {
          case 'taginserts':
              var c = cm.createMenuButton('taginserts', {
                  title: 'Tag Inserts',
                  image: '/Scripts/tinymce/themes/advanced/img/custom-icon-view-html.gif',
                  icons: false
              });
  
              c.onRenderMenu.add(function (c, m) {
                  m.add({ title: 'View in Browser', onclick: function () {
                      tinyMCE.activeEditor.execCommand('mceInsertContent', false, 'Some item 1');
                  } 
                  });
  
                  m.add({ title: 'Forward Link', onclick: function () {
                      tinyMCE.activeEditor.execCommand('mceInsertContent', false, 'Some item 2');
                  } 
                  });
  
                  m.add({ title: 'Social Media', onclick: function () {
                      tinyMCE.activeEditor.execCommand('mceInsertContent', false, 'Some item 2');
                  }
                  });
              });
  
              // Return the new menu button instance
              return c;
      }
  
      return null;
  }
  });
  
  // Register plugin with a short name
  tinymce.PluginManager.add('marcus-inserts', tinymce.plugins.MarcusInserts);
  </code></pre>