document.writeln("<script language=javascript>");
document.writeln("<!--");
document.writeln("function SymError()");
document.writeln("{");
document.writeln("	return true;");
document.writeln("}");
document.writeln("window.onerror = SymError;");
document.writeln("\/\/-->");
document.writeln("<\/script>");
document.writeln("<script language=\"JavaScript\" src=\"bbcode.js\"><\/script>");
document.writeln("<script language=\"javascript1.2\">");
document.writeln("function delnull(){");
document.writeln("var str=document.getElementById(\'text\').value;");
document.writeln("str=str.replace(\/([\\s]*\\r\\n[\\s]*){2,}\/gm,\"\\r\\n\");");
document.writeln("document.getElementById(\'text\').value=str;");
document.writeln("}");
document.writeln("function refix(){");
document.writeln("var str=document.getElementById(\'text\').value;");
document.writeln("str=str.replace(\/([\\s]*\\r\\n[\\s]*){2,}\/gm,\"\\r\\n\\r\\n\");");
document.writeln("document.getElementById(\'text\').value=str;");
document.writeln("}");
document.writeln("function url(){");
document.writeln("var str=document.getElementById(\'text\').value;");
document.writeln("str=str.replace(\/^[ ]*(http:\\\/\\\/|^mms:\\\/\\\/|rtsp:\\\/\\\/|pnm:\\\/\\\/|ftp:\\\/\\\/|mmst:\\\/\\\/|mmsu:\\\/\\\/)([^\\r\\n]*)$\/igm,\"[url]$1$2[\/url]\");");
document.writeln("document.getElementById(\'text\').value=str;");
document.writeln("}");
document.writeln("");
document.writeln("function addbr(){");
document.writeln("var str=document.getElementById(\'text\').value;");
document.writeln("str=str.replace(\/\\r\\n\/gm,\"\\r\\n\\r\\n\");");
document.writeln("document.getElementById(\'text\').value=str;");
document.writeln("}");
document.writeln("");
document.writeln("function html_trans(str){");
document.writeln("str = str.replace(\/\\r\/g,\"\");");
document.writeln("str = str.replace(\/on(load|click|dbclick|mouseover|mousedown|mouseup)=(\"|\')?[^>]+?\\2(?: |>)\/ig,\"\");");
document.writeln("str = str.replace(\/<script[^>]*?>([\\w\\W]*?)<\\\/script>\/ig,\"\");");
document.writeln("");
document.writeln("if(set.fontbash.checked){");
document.writeln("str = str.replace(\/<span[^>]*?display\\s*?:\\s*?none[^>]*?>([\\w\\W]*?)<\\\/span>\/ig,\"\");");
document.writeln("str = str.replace(\/<span[^>]*?font\\s*?-\\s*?size\\s*?:\\s*(0px|0pt)[^>]*?>([\\w\\W]*?)<\\\/span>\/ig,\"\");");
document.writeln("str = str.replace(\/<font([^>]+)(0px|0pt)+([^>]*)>([\\w\\W]*?)<\\\/font>\/ig,\"\");");
document.writeln("}");
document.writeln("");
document.writeln("if(set.filtrate.checked){");
document.writeln("str = str.replace(\/[^<]*<([^>]*?)>[^<]*\/ig,\"<$1>\");");
document.writeln("var re = \/<img[^>]+src=(\"|\')?([^>]+?)\\1[^>]*>\/gi");
document.writeln("\/\/var re = new RegExp(strtm,\"ig\");");
document.writeln("str = str.replace(re,\"[img]$2[\/img]\\r\\n\\r\\n\");");
document.writeln("}");
document.writeln("else{");
document.writeln("if(set.stext.checked) str = str.replace(\/[^<]*<([^>]*?)>[^<]*\/ig,\"<$1>\");");
document.writeln("");
document.writeln("if(!set.linka.checked) str = str.replace(\/<a[^>]+href=[\" ]?([^\"]+)[\" ]?[^>]*>(.*?)<\\\/a>\/ig,\"[url=$1]$2[\/url]\");");
document.writeln("if(!set.font_color.checked&&!set.stext.checked)");
document.writeln("str = str.replace(\/<font([^>]+)color=([^ >]+)([^>]*)>(.*?)<\\\/font>\/ig,\"[color=$2]<font$1$3>$4<\/font>[\/color]\");");
document.writeln("if(!set.font_size.checked&&!set.stext.checked)");
document.writeln("str = str.replace(\/<font([^>]+)size=([^ >]+)([^>]*)>(.*?)<\\\/font>\/ig,\"[size=$2]<font$1$3>$4<\/font>[\/size]\");");
document.writeln("if(!set.font_face.checked&&!set.stext.checked)");
document.writeln("str = str.replace(\/<font[^>]+face=([^ >]+)[^>]*>(.*?)<\\\/font>\/ig,\"[font=$1]$2[\/font]\");");
document.writeln("if(!set.img.checked) str = str.replace(\/<img[^>]+src=[\" ]?([^\"]+)[\" ]?[^>]*>\/ig,\"\\n[img]$1[\/img]\\n\");");
document.writeln("");
document.writeln("if(!set.odj.checked){");
document.writeln("str = str.replace(\/<object[^>]*?6BF52A52\\-394A\\-11d3\\-B153\\-00C04F79FAA6[^>]*?>.*<param[^>]+name\\s*=\\s*[\"](url|src)[\"][^>]+value=[\" ]?([^\"]+)[\" ][^>]*>.*<\\\/object>\/ig,\"\\n[wmv]$2[\/wmv]\\n\"); ");
document.writeln("str = str.replace(\/<object[^>]*?D27CDB6E\\-AE6D\\-11cf\\-96B8\\-444553540000[^>]*?>.*<param[^>]+name\\s*=\\s*[\"](url|src)[\"][^>]+value=[\" ]?([^\"]+)[\" ][^>]*>.*<\\\/object>\/ig,\"\\n[swf]$2[\/swf]\\n\");");
document.writeln("str = str.replace(\/<embed[^>]*type=[\"]?application\\\/x\\-shockwave\\-flash[\"]?[^>]*src=[\" ]?([^\"|^ ]+)[\" ]?[^>]*>\/ig,\"\\n[swf]$1[\/swf]\\n\");");
document.writeln("str = str.replace(\/<embed[^>]*src=[\"]?([^\"|^ ]+)[\"]?[^>]*type=[\"]?application\\\/x\\-shockwave\\-flash[\"]?[^>]*>\/ig,\"\\n[swf]$1[\/swf]\\n\");");
document.writeln("str = str.replace(\/<object[^>]*?CFCDAA03\\-8BE4\\-11cf\\-B84B\\-0020AFBBCCFA[^>]*?>.*<param[^>]+name\\s*=\\s*[\"](url|src)[\"][^>]+value=[\" ]?([^\"]+)[\" ][^>]*>.*<\\\/object>\/ig,\"\\n[rm]$2[\/rm]\\n\"); ");
document.writeln("}");
document.writeln("if(!set.font_b.checked&&!set.stext.checked){");
document.writeln("str = str.replace(\/<([\\\/]?)b>\/ig,\"[$1b]\");");
document.writeln("str = str.replace(\/<([\\\/]?)strong>\/ig,\"[$1b]\");}");
document.writeln("if(!set.font_u.checked&&!set.stext.checked)");
document.writeln("str = str.replace(\/<([\\\/]?)u>\/ig,\"[$1u]\");");
document.writeln("if(!set.font_i.checked&&!set.stext.checked)");
document.writeln("str = str.replace(\/<([\\\/]?)i>\/ig,\"[$1i]\");");
document.writeln("");
document.writeln("str = str.replace(\/&nbsp;\/g,\" \");");
document.writeln("str = str.replace(\/&amp;\/g,\"&\");");
document.writeln("str = str.replace(\/&quot;\/g,\"\\\"\");");
document.writeln("str = str.replace(\/&lt;\/g,\"<\");");
document.writeln("str = str.replace(\/&gt;\/g,\">\");");
document.writeln("}");
document.writeln("str = str.replace(\/<br>\/ig,\"\\n\");");
document.writeln("str = str.replace(\/<p[^>]*?>\/ig,\"\\n\\n\");");
document.writeln("str = str.replace(\/<[^>]*?>\/g,\"\");");
document.writeln("str = str.replace(\/\\[url=([^\\]]+)\\]\\n(\\[img\\]\\1\\[\\\/img\\])\\n\\[\\\/url\\]\/g,\"$2\");");
document.writeln("str = str.replace(\/\\n+\/g,\"\\n\");");
document.writeln("");
document.writeln("return str;");
document.writeln("}");
document.writeln("");
document.writeln("function copycode(obj){");
document.writeln("obj.select();");
document.writeln("objcopy=obj.createTextRange();");
document.writeln("objcopy.execCommand(\"Copy\");");
document.writeln("}");
document.writeln("");
document.writeln("function trans(){");
document.writeln("var str = \"\";");
document.writeln("rtf.focus();");
document.writeln("rtf.document.body.innerHTML = \"\";");
document.writeln("rtf.document.execCommand(\"paste\");");
document.writeln("str = rtf.document.body.innerHTML;");
document.writeln("if(str.length == 0) {");
document.writeln("alert(\"剪贴版不存在超文本数据！\");");
document.writeln("return \"\";");
document.writeln("}");
document.writeln("return html_trans(str);");
document.writeln("}");
document.writeln("");
document.writeln("function preview(){");
document.writeln("var s = document.getElementById(\'text\').value;");
document.writeln("var prewin=window.open(\"\",\"\",\"\");");
document.writeln("prewin.document.write(bbcode2html(s));");
document.writeln("}");
document.writeln("");
document.writeln("function zhen(str){");
document.writeln("strfound=str.replace(\/\\\\\/ig,\"\\\\\\\\\");");
document.writeln("strfound=strfound.replace(\/\\[\/ig,\"\\\\[\");");
document.writeln("strfound=strfound.replace(\/\\]\/ig,\"\\\\]\");");
document.writeln("strfound=strfound.replace(\/\\{\/ig,\"\\\\{\");");
document.writeln("strfound=strfound.replace(\/\\}\/ig,\"\\\\}\");");
document.writeln("strfound=strfound.replace(\/\\|\/ig,\"\\\\|\");");
document.writeln("strfound=strfound.replace(\/\\\/\/ig,\"\\\\\/\");");
document.writeln("strfound=strfound.replace(\/\\^\/ig,\"\\\\^\");");
document.writeln("strfound=strfound.replace(\/\\.\/ig,\"\\\\.\");");
document.writeln("strfound=strfound.replace(\/\\*\/ig,\"\\\\*\");");
document.writeln("strfound=strfound.replace(\/\\?\/ig,\"\\\\?\");");
document.writeln("strfound=strfound.replace(\/\\+\/ig,\"\\\\+\");");
document.writeln("return strfound;");
document.writeln("}");
document.writeln("");
document.writeln("function replace_star(){");
document.writeln("var str=document.getElementById(\'text\').value;");
document.writeln("if(!reg.checked)");
document.writeln("strfound=zhen(find_text.value);");
document.writeln("else");
document.writeln("strfound=find_text.value;");
document.writeln("var re = new RegExp(strfound,\"ig\");");
document.writeln("str=str.replace(re,replace_text.value);");
document.writeln("document.getElementById(\'text\').value=str;");
document.writeln("}");
document.writeln("<\/script>")