//<![CDATA[
 
// The instanceReady event is fired when an instance of CKEditor has finished
// its initialization.
//CKEDITOR.on( 'instanceReady', function( ev )
	//{
		// Show the editor name and description in the browser status bar.
		//document.getElementById('eMessage').innerHTML = '<p>Instance "' + ev.editor.name + '" loaded.<\/p>' ;
 
		// Show this sample buttons.
		//document.getElementById('eButtons').style.visibility = '' ;
	//});
 
function InsertHTML()
{
	// Get the editor instance that we want to interact with.
	var oEditor = CKEDITOR.instances.msg ;
	var value = document.getElementById( 'plainArea' ).value ;
 
	// Check the active editing mode.
	if (oEditor.mode == 'wysiwyg' )
	{
		// Insert the desired HTML.
		oEditor.insertHtml( value ) ;
	}
	else
		alert( 'You must be on WYSIWYG mode!' ) ;
}
 
function SetContents()
{
	// Get the editor instance that we want to interact with.
	var oEditor = CKEDITOR.instances.msg ;
	var value = document.getElementById( 'plainArea' ).value ;
 
	// Set the editor contents (replace the actual one).
	oEditor.setData( value ) ;
}
 
function GetContents()
{
	// Get the editor instance that we want to interact with.
	var oEditor = CKEDITOR.instances.msg ;
 
	// Get the editor contents
	alert( oEditor.getData() ) ;
}
 
function ExecuteCommand( commandName )
{
	// Get the editor instance that we want to interact with.
	var oEditor = CKEDITOR.instances.msg ;
 
	// Check the active editing mode.
	if (oEditor.mode == 'wysiwyg' )
	{
		// Execute the command.
		oEditor.execCommand( commandName ) ;
	}
	else
		alert( 'You must be on WYSIWYG mode!' ) ;
}
 
function CheckDirty()
{
	// Get the editor instance that we want to interact with.
	var oEditor = CKEDITOR.instances.msg ;
	alert( oEditor.checkDirty() ) ;
}
 
function ResetDirty()
{
	// Get the editor instance that we want to interact with.
	var oEditor = CKEDITOR.instances.msg ;
	oEditor.resetDirty() ;
	alert( 'The "IsDirty" status has been reset' ) ;
}

function ClearEditor() {
	// Get the editor instance that we want to interact with.
	//var oEditor = CKEDITOR.instances.msg.onselectionchanged = alert('TEST') ;
	
	//oEditor.Events.AttachEvent( 'OnSelectionChange', alert('TEST') );
	//oEditor.AttachEvent( 'OnClick', oEditor.setData( 'TEST' ) );
	//oEditor.onclick = alert('TEST');
}
	//]]>
