// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \\
function Editor_getSelText() 
{
	var oSelect,oSelectRange;
	document.GHOST_form.message.focus();
    oSelect = document.selection;
    oSelectRange = oSelect.createRange();
    return oSelectRange; 
}
// ------------------------------------------------
function Editor_addCode(tag1,tag2) 
{	
  var oSelText = Editor_getSelText();
  if (oSelText.text == "")
     alert(GHOST_phrase["mtool_highlight_first"]);
  else
     oSelText.text = tag1 + oSelText.text + tag2;     
}
// ######################################################################################
// ######################################################################################
// بداية الاكواد
// ######################################################################################
// ######################################################################################
function EditorFunctions(tag) 
{
	if (tag == "bold") 
	{
		Editor_addCode("<B>","</B>");
	}
	else if (tag == "italic") 
	{
		Editor_addCode("<I>","</I>");
	}
	else if (tag == "uline") 
	{
		Editor_addCode("<U>","</U>");
	}
	else if (tag == "mleft" || tag == "mright" || tag == "mup" || tag == "mdown") 
	{
		Editor_addCode("<move="+tag.substr(1).toLowerCase()+">","</move>");
	}
	else if (tag == "hide") 
	{
		Editor_addCode("<hide>","</hide>");
	} 
	else if (tag == "line") 
	{
		var oSelText = Editor_getSelText();
		oSelText.text = "<hr>";
	}
	else if (tag == "cut" || tag == "copy" || tag == "paste") 
	{
		var oSelText = Editor_getSelText();
		oSelText.execCommand(tag);
	}
	else if (tag == "undo") 
	{
		alert(GHOST_phrase["undo"]);
	}
	else if (tag == "redo") 
	{
		alert(GHOST_phrase["redo"]);
	}
}
// ######################################################################################
// ######################################################################################
// نهاية الاكواد
// ######################################################################################
// ######################################################################################
