var sRTE;

function word(sNodeBox, sHTML){
	this.oHead = new Object;
	this.oBody = new Object;
	var __method = this;
	this.oArea = document.createElement("textarea");
	this.posArr = ToolbarHTML();
	
	this.sRTE = sNodeBox + "_area";


function ShowMenu2(obj,w,h,ssrc){
	var left_offset = obj.offsetLeft;
	var top_offset = obj.offsetTop;
	var oheight=obj.offsetHeight;
	

	if(navigator.appName != "Microsoft Internet Explorer"){
		while ((obj = obj.offsetParent) != null) {
			left_offset += obj.offsetLeft;
			top_offset += obj.offsetTop;
		}
	}

	
	$("iframediv").style.top=top_offset+oheight;
	$("iframediv").style.left=left_offset;
	$("iframediv").style.height=left_offset;
	$("iframediv").style.width=w+2;
	$("iframediv").style.height=h+2;
	$("iframother").style.width=w;
	$("iframother").style.height=h;
	$("iframother").src=ssrc;
	$("iframediv").style.display="block";

}
function ShowMenu(obj,sobj){
	var left_offset = obj.offsetLeft;
	var top_offset = obj.offsetTop;
	var oheight=obj.offsetHeight;

	if(navigator.appName != "Microsoft Internet Explorer"){
		while ((obj = obj.offsetParent) != null) {
			left_offset += obj.offsetLeft;
			top_offset += obj.offsetTop;
		}
	}


	sobj.style.top=top_offset+oheight;
	sobj.style.left=left_offset;
	sobj.style.display="block";
}
function SelectFormat(sfont){
	
	
		var oRTE = getFrameNode(__method.sRTE);
		oRTE.focus();
		oRTE.document.execCommand("FormatBlock", false, sfont);
		$(sNodeBox+"formatdiv").style.display="none";
		oRTE.focus();

}
function SelectFont(sfont){

		var oRTE = getFrameNode(__method.sRTE);
		oRTE.focus();
		oRTE.document.execCommand("FontName", false, sfont);
		$(sNodeBox+"fontdiv").style.display="none";
		oRTE.focus();

}
function SelectFontSize(sfont){
		var oRTE = getFrameNode(__method.sRTE);
		oRTE.focus();
		oRTE.document.execCommand("FontSize", false, sfont);
		$(sNodeBox+"fontsizediv").style.display="none";
		oRTE.focus();

}


	function oInputFunc(){
		var oRTE = getFrameNode(__method.sRTE);
		oRTE.focus();
		var sEditBox = document.getElementById(sNodeBox + "Table");
		var sEditMode = sEditBox.style.display == "none" ? true : false;
		if(sEditMode){
			sEditBox.style.display = "";
			if(! window.Event){
				var sOutText = escape(oRTE.document.body.innerText);
				sOutText = sOutText.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E");
				sOutText = sOutText.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E");
				oRTE.document.body.innerHTML = unescape(sOutText);
			}else{
				var oMozText = oRTE.document.body.ownerDocument.createRange();
				oMozText.selectNodeContents(oRTE.document.body);
				oRTE.document.body.innerHTML = oMozText.toString();
			}
		}else{
			sEditBox.style.display = "none";
			if(! window.Event){
				oRTE.document.body.innerText = oRTE.document.body.innerHTML;
			}else{
				var oMozText = oRTE.document.createTextNode(oRTE.document.body.innerHTML);
				oRTE.document.body.innerHTML = "";
				oRTE.document.body.appendChild(oMozText);
			}
		}
	}

	this.save	= function(){
		if(this.oBody["input"].checked == true) {
			oInputFunc();
			this.oBody["input"].checked = false;
		}
		var oRTE = getFrameNode(this.sRTE);
		oRTE.focus();
		var sEditBox = document.getElementById(sNodeBox + "Table");
		var sEditMode = sEditBox.style.display == "none" ? true : false;
		if(sEditMode){
			if(!window.Event){	
				this.oArea.value = oRTE.document.body.innerText;
			}else{
				var oMozText = oRTE.document.body.ownerDocument.createRange();
				oMozText.selectNodeContents(oRTE.document.body);
				this.oArea.value = oMozText.toString();
			}
		}else{
			this.oArea.value = oRTE.document.body.innerHTML;
		}
	}
	

	function writeDesignMode(sNodeBox, sHTML) {
		enableDesignMode(sNodeBox, "on");
		var sFix = window.Event ? "" : "<div></div>";
		var frameHTML = "\
		<html>\n\
		<head>\n\
		<link rel=stylesheet href=/css/index.css>\n\
		<style>\n\
		body {\n\
			background: #ffffff;\n\
			margin:0px;\n\
			padding:0px;\n\
			font-size:12px;\n\
			overflow:auto;\n\
			scrollbar-face-color:#fff;\n\
			scrollbar-highlight-color:#c1c1bb;\n\
			scrollbar-shadow-color:#c1c1bb;\n\
			scrollbar-3dlight-color:#ebebe4;\n\
			scrollbar-arrow-color:#cacab7;\n\
			scrollbar-track-color:#f4f4f0;\n\
			scrollbar-darkshadow-color:#ebebe4;\n\
			word-wrap: break-word;\n\
			font-family: 'Courier New', Courier, '宋体';\n\
		}\n\
		</style>\n\
		</head>\n\
		<body>\n\
		" + sHTML + "\n\
		" + sFix + "\n\
		</body>\n\
		</html>";
	
		var oRTE = getFrameNode(sNodeBox).document;
		oRTE.open();
		oRTE.write(frameHTML);
		oRTE.close();
	}

	
function enableDesignMode(sNodeBox, sMode){
	document.frames ? document.frames[sNodeBox].document.designMode = sMode : document.getElementById(sNodeBox).contentDocument.designMode = sMode;
}

function wordChiCommand(_sCmd) {
	var oRTE = document.frames ? document.frames[__method.sRTE] : document.getElementById(__method.sRTE).contentWindow;
	sRTE=__method.sRTE;
	function oPenWin(_sTitle, _sWidth, _sHeight, _sUrl, _bDialog){
		_win_iframe_msg(_sUrl,_sTitle);
		return;
		if(window.Event) {
			window.open(_sUrl,"win","menubar=no,location=no,resizable=no,scrollbars=no,status=no,innerWidth="+(_sWidth+0)+",innerHeight="+(_sHeight + 0));
		}
		else {
			if(_bDialog == true) {
				showModelessDialog(_sUrl, window, "dialogHeight:"+(_sHeight+20)+"px;dialogWidth:"+_sWidth+"px;status:no;help:no;tustatus:no;");
			}else {
				showModalDialog(_sUrl, window, "dialogHeight:"+(_sHeight+20)+"px;dialogWidth:"+_sWidth+"px;status:no;help:no;tustatus:no;");
			}
			
		}
	}
	switch(_sCmd){
		
		case "":
			break;
		case "face":
			//oPenWin("插入表情图标", 280, 156, "dialog/Face.html");
			ShowMenu2($(sNodeBox+"e4"),300,120,"dialog/Face.html");
			break;
		case "link":
			oPenWin("请输入网页地址", 300, 140, "dialog/InsertLink.html");
			break;
		case "table":
			oPenWin("请选择表格属性", 300, 240, "dialog/InsertTable.html");
			break;
		case "img":
			oPenWin("请输入图片地址", 300, 140, "dialog/InsertImg.html");
			break;
		case "forecolor":
			//oPenWin("请选择文本颜色", 140, 162, "dialog/ForeColor.html", true);
			ShowMenu2($(sNodeBox+"f2"),150,140,"dialog/ForeColor.html");
			break;
		case "hilitecolor":
			//oPenWin("请选择背景颜色", 140, 162, "dialog/BackColor.html", true);
			ShowMenu2($(sNodeBox+"f3"),150,140,"dialog/BackColor.html");
			break;
		case "insertcode":
			oPenWin("插入程序代码", 140, 162, "code/insert.php", true);
			break;
		case "formatblock":
			//oPenWin("请选择段落风格", 160, 242, "dialog/FormatBlock.html", true);
			ShowMenu($(sNodeBox+"g1"),$(sNodeBox+"formatdiv"));
			break;
		case "fontsize":
			//oPenWin("请选择字体大小", 160, 186, "dialog/FontSize.html", true);
			ShowMenu($(sNodeBox+"g3"),$(sNodeBox+"fontsizediv"));
			break;
		case "fontname":
			//oPenWin("请选择字体样式", 160, 280, "dialog/FontName.html", true);
			ShowMenu($(sNodeBox+"g2"),$(sNodeBox+"fontdiv"));
			break;
		case "editmenu":
			oPenWin("开启功能列表", 156, 250, "dialog/menu.html");
			break;
		case "textarea":
			insetQUER();
			break;
		case "cclink":
			insetCCLink();
			break;
		default:
			oRTE.focus();
			oRTE.document.execCommand(_sCmd, false, null);
			oRTE.focus();
			break;
	}
}
function insetQUER() {
	var _sVal;
	var rng = {};
	var oRTE = getFrameNode(this.sRTE);
	if (document.all) {
		var selection = oRTE.document.selection; 
		if (selection != null) {
			rng = selection.createRange();
		}
	} else {
		var selection = oRTE.getSelection();
		
		rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
		rng.text = rng.toString();
	}
	_sVal = rng.text == "" ? "请在文本框输入文字" : rng.text;
	var html = "<table style='border:1px solid #999;width:80%;font-size:12px;' align='center'><tr><td>"+ _sVal +"</td></tr></table>";
	if(window.Event){
		oRTE.document.execCommand('insertHTML', false, html);
	}
	else {
		oRTE.focus();
		var oRng = oRTE.document.selection.createRange();
		oRng.pasteHTML(html);
		oRng.collapse(false);
		oRng.select();
	}
}
function insetCCLink() {
	var oRTE = getFrameNode(this.sRTE);
	var html = oRTE.document.body.innerHTML;

	// Remove all SPAN tags
	html = html.replace(/<\/?SPAN[^>]*>/gi, "" );
	html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
	// Remove Style attributes
	html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
	// Remove Lang attributes
	html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
	// Remove XML elements and declarations
	html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
	// Remove Tags with XML namespace declarations: <o:p></o:p>
	html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
	// Replace the &nbsp;
	html = html.replace(/&nbsp;/, " " );
	// Transform <P> to <DIV>
	var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ;	// Different because of a IE 5.0 error
	html = html.replace( re, "<div$2</div>" ) ;
	
	oRTE.document.body.innerHTML=html;
	
}
function getStatus(){
	var sFunc = getCookie("cuBlogWordFunc") ? getCookie("cuBlogWordFunc").split("_") : [];
	for(var i = 0; i < sFunc.length; i++){
		hideList(sFunc[i]);
	}
}

function swap(s,a,b,c){document.getElementById(s)[a]=document.getElementById(s)[a]==b?c:b;}
function saveWordStatus(_sFunc){
	var i = 1;
	var sFuncId = [];

	if(!_sFunc){
		_sFunc = getCookie("cuBlogWordFunc") != null ? getCookie("cuBlogWordFunc").split("_") : [];
	}

	for(var j = 0;j < _sFunc.length; j++){
		i = 1;
		sFuncId = _sFunc[j].split("@");
		while(document.getElementById(sFuncId[0] + i)){
			document.getElementById(sFuncId[0] + i).style.display = sFuncId[1] == "true" ? "none" : "";
			i++;
		}
		sFuncId = [];
	}

	setCookie("cuBlogWordFunc", _sFunc.join("_"), 7);
}





















	this.oHead["fontdiv"] = document.createElement("div");
	this.oHead["fontdiv"].id=sNodeBox+"fontdiv";
	this.oHead["fontdiv"].style.display="none";
	this.oHead["fontdiv"].style.position="absolute";
	this.oHead["fontdiv"].style.width="100";
	//this.oHead["fontdiv"].style.height="180";
	this.oHead["fontdiv"].style.border="1px solid #8DB2E3";
	this.oHead["fontdiv"].style.solid="#8DB2E3";
	this.oHead["fontdiv"].style.padding="1px";
	this.oHead["fontdiv"].style.background="#BFDBFF";
	
	this.oHead["fontdiv"].onmouseout=function () {this.style.display='none';};
	this.oHead["fontdiv"].onmouseover=function () {this.style.display='block';}
	var fontname="黑体,隶书,宋体,楷体,幼圆,Arial,Courier New,Georgia,Times New,Verdana,impact,system";
	arrFontname=fontname.split(",");
	this.oHead["table"] = document.createElement("table");
	this.oHead["table"].border="0";
	this.oHead["table"].cellspacing="0";
	this.oHead["table"].cellpadding="4";
	this.oHead["tbody"] = document.createElement("tbody");
	for(i=0;i<arrFontname.length;i++){

		this.oHead["tr"] = document.createElement("tr");
		this.oHead["td"] = document.createElement("td");
		this.oHead["a"] = document.createElement("a");
		this.oHead["a"].href="";
		this.oHead["a"].style.color="#000066";
		this.oHead["a"].style.className="list1";
		this.oHead["a"].style.fontFamily=arrFontname[i];
		this.oHead["a"].innerHTML=arrFontname[i];
		this.oHead["a"].onclick=function(){
			SelectFont(this.style.fontFamily);
			return false;

		}
		this.oHead["td"].appendChild(this.oHead["a"]);
		this.oHead["tr"].appendChild(this.oHead["td"]);
		this.oHead["tbody"].appendChild(this.oHead["tr"]);


	}
	//strfontdiv+="</table>";
	//this.oHead["fontdiv"].innerHTML=strfontdiv;
	this.oHead["table"].appendChild(this.oHead["tbody"]);
	this.oHead["fontdiv"].appendChild(this.oHead["table"]);

	document.getElementById(sNodeBox).appendChild(this.oHead["fontdiv"]);

	//字号
	this.oHead["fontsizediv"] = document.createElement("div");
	this.oHead["fontsizediv"].id=sNodeBox+"fontsizediv";
	this.oHead["fontsizediv"].style.display="none";
	this.oHead["fontsizediv"].style.position="absolute";
	this.oHead["fontsizediv"].style.width="100";
	//this.oHead["fontdiv"].style.height="180";
	this.oHead["fontsizediv"].style.border="1px solid #8DB2E3";
	this.oHead["fontsizediv"].style.solid="#8DB2E3";
	this.oHead["fontsizediv"].style.padding="1px";
	this.oHead["fontsizediv"].style.background="#BFDBFF";
	
	this.oHead["fontsizediv"].onmouseout=function () {this.style.display='none';};
	this.oHead["fontsizediv"].onmouseover=function () {this.style.display='block';}
	this.oHead["table"] = document.createElement("table");
	this.oHead["table"].border="0";
	this.oHead["table"].cellspacing="0";
	this.oHead["table"].cellpadding="4";
	this.oHead["tbody"] = document.createElement("tbody");
	var strfontsizediv="<table border='0' cellspacing='0' cellpadding='4' style='border-collapse: collapse' width='100%'>";
	for(i=1;i<8;i++){
		this.oHead["tr"] = document.createElement("tr");
		this.oHead["td"] = document.createElement("td");
		this.oHead["a"] = document.createElement("a");
		this.oHead["a"].href="";
		this.oHead["a"].style.color="#000066";
		this.oHead["a"].style.className="list1";
		this.oHead["a"]["fontsize"]=i;
		this.oHead["a"].innerHTML=i+" 号字";
		this.oHead["a"].onclick=function(){
			SelectFontSize(this["fontsize"]);
			return false;

		}
		this.oHead["td"].appendChild(this.oHead["a"]);
		this.oHead["tr"].appendChild(this.oHead["td"]);
		this.oHead["tbody"].appendChild(this.oHead["tr"]);

	}
	//strfontsizediv+="</table>";
	this.oHead["table"].appendChild(this.oHead["tbody"]);
	this.oHead["fontsizediv"].appendChild(this.oHead["table"]);
	document.getElementById(sNodeBox).appendChild(this.oHead["fontsizediv"]);

	//段落
	this.oHead["formatdiv"] = document.createElement("div");
	this.oHead["formatdiv"].id=sNodeBox+"formatdiv";
	this.oHead["formatdiv"].style.display="none";
	this.oHead["formatdiv"].style.position="absolute";
	this.oHead["formatdiv"].style.width="100";
	//this.oHead["fontdiv"].style.height="180";
	this.oHead["formatdiv"].style.border="1px solid #8DB2E3";
	this.oHead["formatdiv"].style.solid="#8DB2E3";
	this.oHead["formatdiv"].style.padding="1px";
	this.oHead["formatdiv"].style.background="#BFDBFF";
	
	this.oHead["formatdiv"].onmouseout=function () {this.style.display='none';};
	this.oHead["formatdiv"].onmouseover=function () {this.style.display='block';}
	this.oHead["table"] = document.createElement("table");
	this.oHead["table"].border="0";
	this.oHead["table"].cellspacing="0";
	this.oHead["table"].cellpadding="4";
	this.oHead["tbody"] = document.createElement("tbody");
	var arrFormat=[
		{v:"<h1>",t:"H1 标题"},	
		{v:"<h2>",t:"H2 标题"},	
		{v:"<h3>",t:"H3 标题"},	
		{v:"<h4>",t:"H4 标题"},	
		{v:"<h5>",t:"H5 标题"},	
		{v:"<h6>",t:"H6 标题"},	
		{v:"<p>",t:"P 段落"},	
		{v:"<address>",t:"<address>address 地址</address>"},	
		{v:"<pre>",t:"pre 固定格式"}

	];
	for(i=0;i<arrFormat.length;i++){
		this.oHead["tr"] = document.createElement("tr");
		this.oHead["td"] = document.createElement("td");
		this.oHead["a"] = document.createElement("a");
		this.oHead["a"].href="";
		this.oHead["a"].style.color="#000066";
		this.oHead["a"].style.className="list1";
		this.oHead["a"]["format"]=arrFormat[i]["v"];
		this.oHead["a"].innerHTML=arrFormat[i]["t"];;
		this.oHead["a"].onclick=function(){
			SelectFormat(this["format"]);
			return false;

		}
		this.oHead["td"].appendChild(this.oHead["a"]);
		this.oHead["tr"].appendChild(this.oHead["td"]);
		this.oHead["tbody"].appendChild(this.oHead["tr"]);

	}
	this.oHead["table"].appendChild(this.oHead["tbody"]);
	this.oHead["formatdiv"].appendChild(this.oHead["table"]);
	document.getElementById(sNodeBox).appendChild(this.oHead["formatdiv"]);

	//其他<IFRAME NAME="" SRC="" WIDTH="" HEIGHT=""></IFRAME>
	this.oHead["iframediv"] = document.createElement("div");
	this.oHead["iframediv"].id="iframediv";
	this.oHead["iframediv"].style.display="none";
	this.oHead["iframediv"].style.position="absolute";
	this.oHead["iframediv"].style.width="100";
	//this.oHead["fontdiv"].style.height="180";
	this.oHead["iframediv"].style.border="1px solid #8DB2E3";
	this.oHead["iframediv"].style.solid="#8DB2E3";
	this.oHead["iframediv"].style.padding="1px";
	this.oHead["iframediv"].style.background="#BFDBFF";
	
	this.oHead["iframediv"].onmouseout=function () {this.style.display='none';};
	this.oHead["iframediv"].onmouseover=function () {this.style.display='block';}
	this.oHead["iframediv"].innerHTML="<iframe name='iframother' id='iframother' src='' frameborder='0' scrolling='no' width='' height=''></iframe>";
	document.getElementById(sNodeBox).appendChild(this.oHead["iframediv"]);




	this.oHead["table"] = document.createElement("table");
	this.oHead["table"].cellSpacing = "0px";
	this.oHead["table"].cellPadding = "0px";
	this.oHead["table"].border = "0px";
	this.oHead["table"].id = sNodeBox + "Table";
	this.oHead["table"].className = "editerToolsBox";
	this.oHead["tbody"] = document.createElement("tbody");
	this.oHead["tr"] = document.createElement("tr");
	this.oHead["td"] = document.createElement("td");
	this.oHead["td"].className = "editerToolsBG";
	for(var i = 0; i < this.posArr.length; i ++) {
		this.oHead["items"] = document.createElement("img");
		this.posArr[i]["id"] ? this.oHead["items"].id = sNodeBox+this.posArr[i]["id"] : function(){};
		this.oHead["items"].src = "images/blank.gif";
		this.oHead["items"].style.margin = "0px";
		this.oHead["items"].className = "editerToolsIMG";
		this.oHead["items"].style.width = this.posArr[i]["w"];
		this.oHead["items"].style.backgroundPosition = this.posArr[i]["x"] + "px 0px";
		if(this.posArr[i]["func"] != null) {
			this.oHead["items"].title = this.posArr[i]["t"];
			this.oHead["items"]["func"] = this.posArr[i]["func"];
			this.oHead["items"].onmouseover = function () {
				var bp = this.style.backgroundPosition;
				this.style.backgroundPosition = bp.split(" ")[0] + " -20px";
			}
			this.oHead["items"].onmouseout = function () {
				var bp = this.style.backgroundPosition;
				this.style.backgroundPosition = bp.split(" ")[0] + " 0px";
			}
			this.oHead["items"].onclick = function () {
				
				wordChiCommand(this["func"]);
			}
		}
		this.oHead["td"].appendChild(this.oHead["items"]);
	}
	this.oHead["tr"].appendChild(this.oHead["td"]);
	this.oHead["td"] = document.createElement("td");
	this.oHead["td"].id = "editerArrow";
	this.oHead["td"].className = "editerToolsBG";
	this.oHead["td"].innerHTML = "<img width='18' border='0' src='images/blank.gif' />";
	this.oHead["tr"].appendChild(this.oHead["td"]);
	this.oHead["tbody"].appendChild(this.oHead["tr"]);
	this.oHead["table"].appendChild(this.oHead["tbody"]);
	document.getElementById(sNodeBox).appendChild(this.oHead["table"]);

	this.oBody["table"] = document.createElement("table");
	this.oBody["table"].cellSpacing = "0px";
	this.oBody["table"].cellPadding = "0px";
	this.oBody["table"].border = "0px";
	this.oBody["table"].className = "editerTextBox";
	this.oBody["table"].id = "editerTextBox";
	this.oBody["tbody"] = document.createElement("tbody");
	this.oBody["tr"] = document.createElement("tr");
	this.oBody["td"] = document.createElement("td");
	this.oBody["td"].className = "editerTextTopBG";
	this.oBody["tr"].appendChild(this.oBody["td"]);
	
	this.oBody["tbody"].appendChild(this.oBody["tr"]);
	this.oBody["tr"] = document.createElement("tr");
	this.oBody["td"] = document.createElement("td");
	this.oBody["td"].className = "editerTextBG";
	this.oBody["td"].id = sNodeBox + "Iframes";
	this.oBody["tr"].appendChild(this.oBody["td"]);
	this.oBody["tbody"].appendChild(this.oBody["tr"]);

	this.oBody["tr"] = document.createElement("tr");
	this.oBody["td"] = document.createElement("td");
	this.oBody["td"].className = "editerTextBottomBG";
	this.oBody["input"] = document.createElement("input");
	this.oBody["input"].type = "checkbox";
	this.oBody["input"].id = "EditerCMD";

	this.oBody["input"].onclick = oInputFunc;
	this.oBody["label"] = document.createElement("label");
	this.oBody["label"].style.fontSize = '12px';
	this.oBody["label"].htmlFor = "EditerCMD"
	this.oBody["label"].innerHTML = "显示源代码";
	this.oBody["td"].appendChild(this.oBody["input"]);
	this.oBody["td"].appendChild(this.oBody["label"]);
	this.oBody["tr"].appendChild(this.oBody["td"]);
	this.oBody["tbody"].appendChild(this.oBody["tr"]);

	this.oBody["table"].appendChild(this.oBody["tbody"]);
	document.getElementById(sNodeBox).appendChild(this.oBody["table"]);

	
	document.getElementById(sNodeBox + "Iframes").innerHTML = "<iframe frameborder='0' scrolling='yes' id=" + this.sRTE + " class='editerTextArea'></iframe>";

	this.oArea.name = sNodeBox;
	this.oArea.style.display = "none";
	this.oArea.value = sHTML;
	document.getElementById(sNodeBox).appendChild(this.oArea);




	writeDesignMode(this.sRTE, sHTML);
	
	saveWordStatus();











}
function ToolbarHTML(){
	
return [
	{w: 3, x: -2},
	{w: 20, x: -5, t: "撤销", func: "Undo", id: "a1"},
	{w: 20, x: -25, t: "重做", func: "Redo", id: "a2"},
	{w: 2, x: 0, id: "a3"},
	{w: 20, x: -45, t: "剪切", func: "Cut", id: "b1"},
	{w: 20, x: -65, t: "复制", func: "Copy", id: "b2"},
	{w: 20, x: -85, t: "粘贴", func: "Paste", id: "b3"},
	{w: 2, x: 0, id: "b4"},
	{w: 20, x: -225, t: "粗体", func: "Bold", id: "c1"},
	{w: 20, x: -245, t: "斜体", func: "Italic", id: "c2"},
	{w: 20, x: -265, t: "下划线", func: "Underline", id: "c3"},
	{w: 2, x: 0, id: "c4"},
	{w: 20, x: -285, t: "左对齐", func: "justifyleft", id: "d1"},
	{w: 20, x: -305, t: "居中", func: "justifycenter", id: "d2"},
	{w: 20, x: -325, t: "右对齐", func: "justifyright", id: "d3"},
	{w: 20, x: -345, t: "两端对齐", func: "justifyfull", id: "d4"},
	{w: 2, x: 0, id: "d5"},
	{w: 20, x: -145, t: "添加图片", func: "img", id: "e1"},
	{w: 20, x: -105, t: "插入链接", func: "link", id: "e2"},
	{w: 20, x: -125, t: "插入表格", func: "table", id: "e3"},
	{w: 20, x: -465, t: "插入UBB表情", func: "face", id: "e4"},
	{w: 20, x: -485, t: "插入文字框", func: "textarea", id: "e5"},
	{w: 20, x: -759, t: "清除Word垃圾代码", func: "cclink", id: "e6"},
	{w: 2, x: 0, id: "e4"},
	{w: 20, x: -165, t: "横线", func: "inserthorizontalrule", id: "f1"},
	{w: 20, x: -185, t: "文本颜色", func: "forecolor", id: "f2"},
	{w: 20, x: -205, t: "背景色", func: "hilitecolor", id: "f3"},
	{w: 2, x: 0, id: "f4"},
	{w: 40, x: -505, t: "段落样式", func: "formatblock", id: "g1"},
	{w: 40, x: -545, t: "字体", func: "fontname", id: "g2"},
	{w: 60, x: -585, t: "字体大小", func: "fontsize", id: "g3"},
	{w: 2, x: 0, id: "g4"},
	{w: 20, x: -365, t: "编号列表", func: "insertorderedlist", id: "h1"},
	{w: 20, x: -385, t: "项目符号列表", func: "insertunorderedlist", id: "h2"},
	{w: 20, x: -405, t: "减少缩进", func: "outdent", id: "h3"},
	{w: 20, x: -425, t: "增加缩进", func: "indent", id: "h4"},
	{w: 60, x: -780, t: "插入程序代码", func: "insertcode", id: "h4"},
	{w: 2, x: 0, id: "h5"}
	
	];
}

function getCookie(name){
	var result = null; 
	var myCookie = document.cookie + ";"; 
	var searchName = name + "="; 
	var startOfCookie = myCookie.indexOf(searchName); 
	var endOfCookie; 
	if (startOfCookie != -1)
	{ 
		startOfCookie += searchName.length; 
		endOfCookie = myCookie.indexOf(";", startOfCookie); 
		result = unescape(myCookie.substring(startOfCookie, endOfCookie)); 
	} 
	return result; 
}
function setCookie(name, value, expires, path, domain, secure){
	var expDays = expires * 24 * 60 * 60 * 1000;
	var expDate = new Date(); 
	expDate.setTime(expDate.getTime() + expDays); 
	var expString = ((expires == null) ? "" : (";expires=" + expDate.toGMTString())) 
	var pathString = ((path == null) ? "" : (";path=" + path)) 
	var domainString = ((domain == null) ? "" : (";domain=" + domain)) 
	var secureString = ((secure == true) ? ";secure" : "" )
	document.cookie = name + "=" + escape(value) + expString + pathString + domainString + secureString;
}
function hide(_sId){
	document.getElementById(_sId).style.display = document.getElementById(_sId).style.display == "none" ? "" : "none" ;
}

function getFrameNode(sNode){
	return document.frames ? document.frames[sNode] : document.getElementById(sNode).contentWindow;
}
