(function() {
    tinymce.create('tinymce.plugins.table', {
        init : function(ed, url) {
            ed.addButton('table', {
                title : 'Add a table',
                image : url+'/images/table.png',
                onclick : function() {
		    
		       ed.selection.setContent('[table]\
			    <table>\
			    <thead>\
			    <tr>\
			    <th scope="col"><strong>Company</strong></th>\
			    <th scope="col">Head 1</th>\
			    <th scope="col">Head 2</th>\
			    <th scope="col">Head 3</th>\
			    <th scope="col">Head 4</th>\
			    </tr>\
			    </thead>\
			    <tfoot>\
			    <tr>\
			    <td colspan="5">footer here</td>\
			    </tr>\
			    </tfoot>\
			    <tbody>\
			    <tr>\
			    <td>Company2</td>\
			    <td>data</td>\
			    <td>data</td>\
			    <td>data</td>\
			    <td>data</td>\
			    </tr>\
			    <tr>\
			    <td>Company3</td>\
			    <td>data</td>\
			    <td>data</td>\
			    <td>data</td>\
			    <td>data</td>\
			    </tr>\
			    <tr>\
			    <td>Company4</td>\
			    <td>data</td>\
			    <td>data</td>\
			    <td>data</td>\
			    <td>data</td>\
			    </tr>\
			    </tbody>\
			    </table>\
			    [/table]');  

		}
            });
        },
        createControl : function(n, cm) {
            return null;
        }
    });
    tinymce.PluginManager.add('table', tinymce.plugins.table);
    
})();
