/*
 * Licensed under the terms of the GNU Lesser General Public License:
 * 		http://www.opensource.org/licenses/lgpl-license.php
 * 
 * File Name: toggleFCKeditorInfo.js
 * This file provides in depth information on the toggleFCKeditor function, see toggleFCKeditor.js (http://www.saulmade.nl/FCKeditor/FCKSnippets.php)
 * 
 * File Authors:
 * 		Paul Moers (http://www.saulmade.nl, http://www.saulmade.nl/FCKeditor/FCKPlugins.php)
 *
 * Special thanks to Paul York for supporting me!
*/


		// When you call the function you need to pass the editorInstance as an attribute.
		// To get the editorInstance, see 'Retrieving an Editor Instance' in the wiki: http://wiki.fckeditor.net/Developer%27s_Guide/Javascript_API
		// Example (HTML code with inline javascript event) :
		<span onclick="toggleFCKeditor(FCKeditorAPI.GetInstance('FCKeditor1'))">toggle FCKeditor</span>

		// In the onload event of the FCKeditor, the editorInstance is passed as an attribute, see the 'Events' section of the wiki page mentioned above
		// Example :
		function FCKeditor_OnComplete(editorInstance)
		{
			toggleFCKeditor(editorInstance);
		}



		// In depth information on the code :


		// --- editorArea ---

		// disable the editArea. Doing this in IE will break the FCKeditor, a new extra toolbarset will be loaded in the editorArea!?
		editorInstance.EditorDocument.designMode = 'off';
		// setting it back on
		 editorInstance.EditorDocument.designMode = 'on';

		// disabling the body. Greys out the editorArea. Only works in IE.
		editorInstance.EditorDocument.body.disabled = true;
		// enabling it again
		editorInstance.EditorDocument.body.disabled = false;


		// --- toolbar ---

		// disabling all buttons at once can be done by disabling the toolbarset
		// To disable specific button see my HOWTO https://sourceforge.net/forum/forum.php?thread_id=1598024&forum_id=257180 (Using the Disable function of a button is the proper way of disabling instead of overwriting the Execute command of a button which was described in the first post of the HOWTO thread)
		editorInstance.EditorWindow.parent.FCK.ToolbarSet.Disable();
		// enabling it again
		editorInstance.EditorWindow.parent.FCK.ToolbarSet.Enable();

		// now when you would click in the editorArea all buttons would be updated so we would have disabled the toolbar for nothing
		// For this we need to disable the refresh function of the buttons and specialCombos
		// You can clone them for restoration when you want the FCKeditor back enabled
		buttonRefreshStateClone = editorInstance.EditorWindow.parent.FCKToolbarButton.prototype.RefreshState;
		specialComboRefreshStateClone = editorInstance.EditorWindow.parent.FCKToolbarSpecialCombo.prototype.RefreshState;
		editorInstance.EditorWindow.parent.FCKToolbarButton.prototype.RefreshState = function(){return false;};
		editorInstance.EditorWindow.parent.FCKToolbarSpecialCombo.prototype.RefreshState = function(){return false;};
		// enabling them again would be
		editorInstance.EditorWindow.parent.FCKToolbarButton.prototype.RefreshState = buttonRefreshStateClone;
		editorInstance.EditorWindow.parent.FCKToolbarSpecialCombo.prototype.RefreshState = specialComboRefreshStateClone;

		// another thing you could do is to collapse the toolbars, like normally done with the small arrow
		editorInstance.EditorWindow.parent.FCK.ToolbarSet._ChangeVisibility(true);
		// expanding it again is
		editorInstance.EditorWindow.parent.FCK.ToolbarSet._ChangeVisibility(false);

		// Just hiding the toolbar can be done too
		editorInstance.EditorWindow.parent.document.getElementById("xExpanded").style.display = "none";
		// And hiding the small bar showing when the toolbar is collapsed is this
		editorInstance.EditorWindow.parent.document.getElementById("xCollapsed").style.display = "none";

		// when you want to hide the collapse handle do
		editorInstance.EditorWindow.parent.document.getElementById("xCollapseHandle").style.display = "none";
		// or hiding the expand handle. This seems to be the same as hiding the object with id 'xCollapsed' mentioned above
		editorInstance.EditorWindow.parent.document.getElementById("xExpandHandle").style.display = "none";

