document.writeln("<table width=98% height=100% cellpadding=2 cellspacing=0 bgcolor=#eeeeee><tr><td align=left>");

//var FormatTextlist="粗体 bold|倾斜 italic|下划线 underline|上标 superscript|下标 subscript|删除线 strikethrough|删除文字格式 RemoveFormat|左对齐 Justifyleft|居中 JustifyCenter|右对齐 JustifyRight|插入超链接 createLink|去掉超链接 Unlink|"
var FormatTextlist="粗体 bold|倾斜 italic|下划线 underline|删除文字格式 RemoveFormat|左对齐 Justifyleft|居中 JustifyCenter|右对齐 JustifyRight|插入超链接 createLink|去掉超链接 Unlink"
var list= FormatTextlist.split ('|');
for(i=0;i<list.length;i++) {
if (list[i]=="<br>"){document.write("<br>");
}else{
var TextName= list[i].split (' '); 
document.write(" <img align=absmiddle src=../images/wbTextBox/"+TextName[1]+".gif alt="+TextName[0]+" style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\" onClick=FormatText('"+TextName[1]+"')> ");
}
}

document.writeln("<img id=wbTextBox_img1 src=../images/wbTextBox/fbcolor.gif alt=\"突出颜色\" align=absmiddle style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\" onClick=BackColor()>");
document.writeln("<img id=wbTextBox_img2 src=../images/wbTextBox/fgcolor.gif alt=\"字体颜色\" align=absmiddle style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\"  onClick=foreColor()>");
document.writeln("<img id=wbTextBox_img3 src=../images/wbTextBox/replace.gif alt=\"替换\" align=absmiddle style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\"  onClick=replace()>");
//document.writeln("<img id=wbTextBox_img4 src=../images/wbTextBox/img.gif alt=\"插入图片\" align=absmiddle style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\"  onClick=img()>");
//document.writeln("<img id=wbTextBox_img5 alt=\"插入FLASH文件\" src=../images/wbTextBox/swf.gif align=absmiddle style=cursor:hand onclick=flash()>");
//document.writeln("<img id=wbTextBox_img6 alt=\"插入Media Player文件\" src=../images/wbTextBox/wmv.gif align=absmiddle style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\"  onclick=MediaPlayer()>");
//document.writeln("<img id=wbTextBox_img7 alt=\"插入RealPlayer文件\" src=../images/wbTextBox/rm.gif align=absmiddle style=cursor:hand onclick=RealPlay()>");
document.writeln("<img id=wbTextBox_img8 alt=\"插入表情\" src=../images/wbTextBox/em.gif align=absmiddle style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\"  onclick=em()>");
document.writeln("<img id=wbTextBox_img9 alt=\"清理代码\" src=../images/wbTextBox/CleanCode.gif align=absmiddle style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\"  onclick=CleanCode()>");
//document.writeln("<img id=wbTextBox_img10 alt=\"在线帮助\" src=../images/wbTextBox/help.gif align=absmiddle style=cursor:hand align=center onmouseover=\"this.style.borderWidth='1pt';this.style.borderColor='#000000';this.style.borderStyle='solid'\" style=\"BORDER-RIGHT: white 1pt solid; BORDER-TOP: white 1pt solid; BORDER-LEFT: white 1pt solid; BORDER-BOTTOM: white 1pt solid\" onmouseout=\"this.style.borderWidth='1pt';this.style.borderColor='white';\"  onclick=help()>");
document.writeln("</td></tr><tr><td height=100%><iframe ID=\"HtmlEditor\" runat=\"server\" MARGINHEIGHT=5 MARGINWIDTH=5 width=100% height=100%></iframe></td></tr><tr></tr></table>");

if (document.all){var IframeID=frames["HtmlEditor"];}else{var IframeID=document.getElementById("HtmlEditor").contentWindow;}
if (navigator.appVersion.indexOf("MSIE 6.0",0)==-1){IframeID.document.designMode="On"}
IframeID.document.open();
IframeID.document.write ('<script>i=0;function ctrlenterkey(eventobject){if(event.ctrlKey && window.event.keyCode==13 && i==0){i=1;parent.document.form1.remenu.value=document.body.innerHTML;parent.document.form1.submit();parent.document.form1.submit1.disabled=true;}}<\/script><body onkeydown=ctrlenterkey()>');
IframeID.document.close();
IframeID.document.body.contentEditable = "True";
IframeID.document.body.innerHTML=document.getElementById("remenu").value;
IframeID.document.body.style.fontSize="10pt";


function show_disabled(distype)
{
    IframeID.document.body.disabled=distype;
    for(i=0;i<20;i++)
    {
        try
        {
            document.getElementById("wbTextBox_img"+i).disabled=distype;
        }
        catch(ee){}
    }
}


function em(){
var arr = showModalDialog("../js/inc/Emotion.htm", "", "dialogWidth:18em; dialogHeight:11em; status:0;help:0");
if (arr != null){
IframeID.focus()
sel=IframeID.document.selection.createRange();
sel.pasteHTML(arr);
}
}

function CleanCode(){
var body = IframeID.document.body;
var html = IframeID.document.body.innerHTML;
html = html.replace(/\<p>/gi,"[$p]");
html = html.replace(/\<\/p>/gi,"[$\/p]");
html = html.replace(/\<br>/gi,"[$br]");
html = html.replace(/\<[^>]*>/g,"");
html = html.replace(/\[\$p\]/gi,"<p>");
html = html.replace(/\[\$\/p\]/gi,"<\/p>");
html = html.replace(/\[\$br\]/gi,"<br>");
IframeID.document.body.innerHTML = html;
}


function FormatText(command,option){IframeID.focus();IframeID.document.execCommand(command,true,option);}

function CheckLength(){alert("最大字符为 "+5000000+ " 字节\n您的内容已有 "+IframeID.document.body.innerHTML.length+" 字节");}

function DoTitle(addTitle) {
var revisedTitle;var currentTitle = document.form1.topic.value;revisedTitle = addTitle+currentTitle;document.form1.topic.value=revisedTitle;document.form1.topic.focus();
}
function CheckForm1(form)
{
document.getElementById("remenu").value=IframeID.document.body.innerHTML; 
MessageLength=IframeID.document.body.innerHTML.length;
if(MessageLength<2){alert("文章内容不能小于2个字符！");waitSubmit('div_b1','Layer1');show_disabled(false);return false;}
if(MessageLength>5000000){alert("文章内容不能超过5000000个字符！");waitSubmit('div_b1','Layer1');show_disabled(false);return false;}
startRequest_Reply();
}
function CheckForm(form){
form.remenu.value=IframeID.document.body.innerHTML; 
MessageLength=IframeID.document.body.innerHTML.length;
copyText1(form.remenu); //新增复制内容到剪贴板中
if(MessageLength<2){alert("文章内容不能小于2个字符！");return false;}
if(MessageLength>5000000){alert("文章内容不能超过5000000个字符！");return false;}
//document.form1.submit1.disabled = true;
}
//以下新加
function copyText1(obj) {
	clipboardData.setData('Text',obj.value);
}
//以上新加

function yinyong(obj) {
	IframeID.document.body.innerHTML="[quote]"+obj+"[/quote]";
	IframeID.focus();
}

function Gopreview()
{
document.preview.remenu.value=IframeID.document.body.innerHTML; 
window.open('', 'preview_page', 'resizable,scrollbars,width=750,height=450');
document.preview.submit()
}

function BackColor()
{
  var arr = showModalDialog("../js/inc/selcolor.htm", "", "dialogWidth:18em; dialogHeight:17.5em; status:0;help:0");
  if (arr != null) FormatText('BackColor', arr);
  else IframeID.focus();
}

function foreColor()
{
  var arr = showModalDialog("../js/inc/selcolor.htm", "", "dialogWidth:18em; dialogHeight:17.5em; status:0;help:0");
  if (arr != null) FormatText('forecolor', arr);
  else IframeID.focus();
}

//////替换内容
function replace()
{
  var arr = showModalDialog("../js/inc/replace.html", "", "dialogWidth:22em;dialogHeight:10em;status:0;help:0");
	if (arr != null){
		var ss;
		ss = arr.split("*")
		a = ss[0];
		b = ss[1];
		i = ss[2];
		con = IframeID.document.body.innerHTML;
		if (i == 1)
		{
			con = Ftbbs_code(con,a,b,true);
		}else{
			con = Ftbbs_code(con,a,b);
		}
		IframeID.document.body.innerHTML = con;
	}
	else IframeID.focus();
}
function Ftbbs_code(s,a,b,i){
	a = a.replace("?","\\?");
	if (i==null)
	{
		var r = new RegExp(a,"gi");
	}else if (i) {
		var r = new RegExp(a,"g");
	}
	else{
		var r = new RegExp(a,"gi");
	}
	return s.replace(r,b); 
}
//////替换内容结束

function img(){
//url=showModalDialog("../js/inc/upload.aspx", "", "dialogWidth:30em; dialogHeight:12em; status:0;help:0");
//if(!url || url=="http://") return;
//IframeID.focus();
//sel=IframeID.document.selection.createRange();
//sel.pasteHTML("<img src="+url+" border=0 resize=1 vspace=5>");
document.getElementById("div_upload").style.display = "inline";
//alert((document.documentElement.scrollLeft+(document.documentElement.clientWidth-document.getElementById("div_upload").offsetWidth)/2)+"px");
document.getElementById("div_upload").style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("div_upload").offsetHeight)/2)+"px";
document.getElementById("div_upload").style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-document.getElementById("div_upload").offsetWidth)/2)+"px";

}

function RealPlay(){
var arr = showModalDialog("../js/inc/RealPlay.htm", "", "dialogWidth:22em; dialogHeight:9em; status:0;help:0");
if (arr != null){
IframeID.focus()
sel=IframeID.document.selection.createRange();
sel.pasteHTML(arr);
}
}

function MediaPlayer(){
var arr = showModalDialog("../js/inc/MediaPlayer.htm", "", "dialogWidth:22em; dialogHeight:9em; status:0;help:0");
if (arr != null){
IframeID.focus()
sel=IframeID.document.selection.createRange();
sel.pasteHTML(arr);
}
}

function flash(){
var arr = showModalDialog("../js/inc/flash.htm", "", "dialogWidth:22em; dialogHeight:9em; status:0;help:0");
if (arr != null){
IframeID.focus()
sel=IframeID.document.selection.createRange();
sel.pasteHTML(arr);
}
}

function help()
{
	var arr=showModalDialog("../js/inc/help.html",window, "dialogWidth:23em; dialogHeight:11em; status:0; help:0");
}
