CKEDITOR.plugins.add('entrylink', {
	icons: 'entrylink',
	init: function(editor) {
		editor.addCommand('entryLinkCommand', {
			exec: function(editor) {
				if (editor.getSelection().getNative().toString().replace(/\s*/,'')!='') {
					var url = 'popup_posts.php?editor='+editor.name;
					var p_win = 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('EntryLink', {			
			label: 'Entry Link Selection',
			command: 'entryLinkCommand',
			toolbar: 'insert'
		});

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