/*
function FCKeditor_OnComplete(editorInstance) {

	if (editorInstance.EditMode == FCK_EDITMODE_WYSIWYG && document.getElementById('FCKeditor_html_field').value != 'Y') {
		toggleLayer('buttoncol','off');
		//editorInstance.SwitchEditMode();
	}
}
*/
function initHTMLEditor( editorInstance ) {
	if (editorInstance.EditMode == FCK_EDITMODE_WYSIWYG && document.getElementById('FCKeditor_html_field').value != 'Y') {
		toggleLayer('buttoncol','off');
		editorInstance.SwitchEditMode();
	}
}
function FCKeditor_OnComplete( editorInstance ) {
    //editorInstance.Events.AttachEvent( 'OnSelectionChange', initHTMLEditor ) ;
	editorInstance.Events.AttachEvent( 'OnFocus', clearEditorDefaultText ) ;
}

// clear the default text from the input box
function clearEditorDefaultText( editorInstance ) {
	if (typeof defaultEditorText != 'undefined') {
		var currentEditorText = editorInstance.GetXHTML();
		if(currentEditorText == defaultEditorText) {
			editorInstance.SetHTML('');
		}
	}
}

function enableHTMLEditor(messageValue) {
	//toggleLayer('buttoncol','on'); 
	document.getElementById('FCKeditor_html_field').value='Y';
	var oEditor = FCKeditorAPI.GetInstance(thisEditorField) ;
	//if (oEditor.EditMode != FCK_EDITMODE_WYSIWYG)
	//	oEditor.SwitchEditMode();
	if (messageValue)
		oEditor.SetHTML(messageValue);
}

function disableHTMLEditor(messageValue) {
	//toggleLayer('buttoncol','off');
	var oEditor = FCKeditorAPI.GetInstance(thisEditorField) ;
	//document.getElementById('FCKeditor_html_field').value='N';
	//if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG)
	//	oEditor.SwitchEditMode();
	if (messageValue) 
		oEditor.SetHTML(messageValue);
}

function executeFCKEditorCommand( commandName ) {
	// Get the editor instance that we want to interact with.
	var oEditor = FCKeditorAPI.GetInstance(thisEditorField) ;

	//if (commandName == 'Style')

	// Execute the command.
	oEditor.Commands.GetCommand( commandName ).Execute() ;
}

/*
function doSpellCheck() {
	if (thisEditForm.html.value == 'Y') {
		if (ExecuteCommand('SpellCheck')) {
			alert('spell check done');
			//return true;
		} else {
			alert('no return from spell check');
		}
	} else {
		return true;
	}
}
*/