document.write("<script src=\"/common/fckeditor/fckeditor.js\"></script>");

var g_EditorID = null;
var g_EditorDefaultLanguage = null;
var g_EditorInstanceID = null;

function InitFCKEditor()
{
	var ta = document.getElementById(g_EditorID);
	
	var editor = new FCKeditor(g_EditorID, ta.style.width, ta.style.height);
	editor.Config["EnterMode"] = "br";
	editor.Config["ShiftEnterMode"] = "p";
	editor.Config["InstanceID"] = g_EditorInstanceID;
	editor.Config["DefaultLanguage"] = g_EditorDefaultLanguage;
	if (g_EditorDefaultLanguage == "UYG")
	{
		editor.Config["ContentLangDirection"] = "rtl";
		editor.Config["EditorAreaCSS"] = editor.BasePath + "editor/css/fck_editorarea" + g_EditorDefaultLanguage + ".css";
	}
	editor.ReplaceTextarea();
}

function FCKeditor_OnComplete(editor)
{
	if (g_EditorDefaultLanguage != "UYG")
		return;
	
	if(window.addEventListener)
	{
		editor.EditorDocument.addEventListener("keydown", OnEdit, false);
		editor.EditorDocument.addEventListener("keypress", OnEdit, false);
	}
	else
	{
		editor.EditorDocument.attachEvent("onkeydown", OnEdit);
		editor.EditorDocument.attachEvent("onkeypress", OnEdit);
	}
} 


if(window.addEventListener)
	window.addEventListener("load", InitFCKEditor, false); 
else
	window.attachEvent("onload", InitFCKEditor);
