title: Adding multiple buttons in TinyMce in a loop doesn't work
body: <p>I have a config list for buttons like this:</p>
  
  <pre><code>var config = [{
    name: 'first',
    insertionConfig: {
      title: 'first button',
      onsubmit: function(){
      // do sth
      }
    }
  },{
    name: 'second',
    insertionConfig: {
      title: 'second button',
      onsubmit: function(){
      // do sth
      }
    }
  }
   ]
  </code></pre>
  
  <p>and in my TinyMce plugin I want to add all buttons according to their config. So it would end up like this:</p>
  
  <pre><code>tinymce.PluginManager.add('myPlugin', function(editor, url) {
        for (var i in config) {
          item = config[i];
          editor.addButton(item.name, {
            text: item.name,
            onclick: function() {
              editor.windowManager.open({
                  title: item.insertionConfig.title,
                  onsubmit: item.insertionConfig.onsubmit
                }
              };
            }
          });
  </code></pre>
  
  <p>but when I click on first button, it shows the second button's title. all configs of buttons refer to last added button. I know problem is something about the 'item' in the loop (all buttons refer to same item object which is the last one) but I don't know how to fix it. </p>