var editor;
function makeEditor(editorHeight) {
	editor = CKEDITOR.replace('editor1', {height: editorHeight-80, customConfig : 'config_nml.js', skin : 'nml'});

	CKEDITOR.on( 'dialogDefinition', function( ev )	{
			var dialogName = ev.data.name;
			var dialogDefinition = ev.data.definition;

			if ( dialogName == 'link' )
				{
					var infoTab = dialogDefinition.getContents( 'info' );
					
					infoTab.remove( 'linkType' );
					infoTab.remove( 'browse' );
					infoTab.remove( 'protocol' );
					
					var targetTab = dialogDefinition.getContents( 'target' );
					var targetType = targetTab.get( 'linkTargetType' );
					targetType['default'] = '_blank';
					var targetName = targetTab.get( 'linkTargetName' );
					targetName['default'] = '_blank';
					
					dialogDefinition.removeContents( 'advanced' );
					dialogDefinition.getContents('target').hidden = true;
				}
			if ( dialogName == 'image' )
			{
				dialogDefinition.getContents('advanced').hidden=true;
				dialogDefinition.getContents('Link').hidden=true;
			}
	});		    
}

function resizeEditor(width, height){
	//editor.config.width = width - 10;
	editor.config.height = height - 80;
	editor.resize(editor.config.width, editor.config.height, true, false);
}

function destroyEditor() {
	if(CKEDITOR.instances.editor1){
		CKEDITOR.instances.editor1.destroy(true);
	}
}

function getHTML() {
	return CKEDITOR.instances.editor1.getData();
}
function setHTML(data) {
	CKEDITOR.instances.editor1.setData(data);
}
