(function() {

	tinymce.PluginManager.requireLangPack('insertmedia');

	tinymce.create('tinymce.plugins.CommunityServerInsertMediaPlugin', {
		init : function(ed, url) {

			ed.addCommand('mceInsertMedia', function() {
				if (tinyMCE_CommunityServerOptions)
		    		tinyMCE_CommunityServerOptions.InsertMediaOpenFunction();
			});

			ed.addButton('insertmedia', {
				title : 'insertmedia.desc',
				cmd : 'mceInsertMedia',
				image : url + '/img/insert_media.gif'
			});
		},

		createControl : function(n, cm) {
			return null;
		},

		getInfo : function() {
			return {
				longname : 'Community Server Insert Media Plugin',
				author : 'Telligent',
				authorurl : 'http://telligent.com/',
				infourl : 'http://telligent.com/',
				version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
			};
		}
	});

	tinymce.PluginManager.add('insertmedia', tinymce.plugins.CommunityServerInsertMediaPlugin);
})();