CKEDITOR.plugins.add('media', {
	icons: 'media',
	init: function(editor) {
		editor.addCommand('mediaCommand', {
			exec: function(editor) {
				var url = 'media.php?popup=1&editor='+editor.name;
				var popup_media = window.open(url,'dc_popup'
							      ,'alwaysRaised=yes,dependent=yes,toolbar=yes,'+
							      'height=420,width=520,menubar=no,resizable=yes,scrollbars=yes,status=no');
			}
		});

		editor.ui.addButton('Media', {			
			label: 'Media Selection',
			command: 'mediaCommand',
			toolbar: 'insert'
		});

		editor.on('doubleclick',function(e) {
			return false;
		});
	}
});
