<script type="text/javascript">
	var editorid = '$editorid';
	var wysiwyg = (is_ie || is_moz || (is_opera && opera.version() >= 9)) && parseInt('$editormode') && bbinsert == 1 ? 1 : 0;
	var allowswitcheditor = parseInt('$allowswitcheditor');
	var allowhtml = parseInt('$allowhtml');
	var forumallowhtml = parseInt('$forum[allowhtml]');
	var allowsmilies = parseInt('$forum['allowsmilies']');
	var allowbbcode = parseInt('$forum['allowbbcode']');
	var allowimgcode = parseInt('$forum['allowimgcode']');
	var smilies = new Array();
	<!--{if !empty($GLOBALS['_DCACHE']['smilies']) && is_array($GLOBALS['_DCACHE']['smilies'])}-->
		<!--{loop $_DCACHE['smilies_display'] $key $smiley}-->
		<!--{eval $smiley[code]=addslashes($smiley[code]);}-->
			smilies[$key]			= {'code' : '$smiley[code]', 'url' : '$smiley['url']'};
		<!--{/loop}-->
	<!--{/if}-->
	var BORDERCOLOR = "{BORDERCOLOR}";
	var ALTBG2 = "{ALTBG2}";

	function previewpost(){
		if(!validate($('postform'), true)) {
			$('subject').focus();
			return;
		}
		$("previewmessage").innerHTML = bbcode2html($('postform').message.value);

		$("previewtable").style.display = '';
		window.scroll(0, 0);
	}

	function clearcontent() {
		if(wysiwyg && bbinsert) {
			editdoc.body.innerHTML = is_moz ? '<br />' : '';
		} else {
			textobj.value = '';
		}
	}

	function resizeEditor(change) {
		var editorbox = bbinsert ? editbox : textobj;
		var newheight = parseInt(editorbox.style.height, 10) + change;
		if(newheight >= 100) {
			editorbox.style.height = newheight + 'px';
		}
	}
</script>
<script type="text/javascript" src="include/bbcode.js"></script>
<!--{if $bbinsert}-->
	<script type="text/javascript" src="include/editor.js"></script>
	<script type="text/javascript">
		var lang				= new Array();
		lang["enter_tag_option"]		= "{lang post_discuzcode_tagoption}";
		lang["enter_list_item"]			= "{lang post_discuzcode_listitem}";
		lang["enter_link_url"]			= "{lang post_discuzcode_linkurl}";
		lang["enter_image_url"]			= "{lang post_discuzcode_imageurl}";
		lang["enter_email_link"]		= "{lang post_discuzcode_emaillink}";
		lang['enter_table_rows']		= "{lang post_discuzcode_tablerows}";
		lang['enter_table_columns']		= "{lang post_discuzcode_tablecolumns}";
		lang['fontname']			= "{lang post_discuzcode_fontname}";
		lang['fontsize']			= "{lang post_discuzcode_fontsize}";
		var custombbcodes = new Array();
		<!--{if $forum['allowbbcode'] && $allowcusbbcode}-->
			<!--{loop $_DCACHE['bbcodes_display'] $tag $bbcode}-->
				custombbcodes["$tag"] = "$bbcode[example]";
			<!--{/loop}-->
		<!--{/if}-->
		var fontoptions = new Array({lang post_discuzcode_fontoptions});
	</script>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="editor">
	<tr>
	<td id="{$editorid}_controls" class="editor_controlbar" colspan="2">

	<table cellpadding="0" cellspacing="0" border="0">
	<tr>

	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_removeformat" onclick="discuzcode('removeformat')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_removeformat.gif" width="21" height="20" title="{lang post_discuzcode_removeformat}" alt="{lang post_discuzcode_removeformat}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_undo" onclick="discuzcode('undo')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_undo.gif" width="21" height="20" title="{lang post_discuzcode_undo}" alt="{lang post_discuzcode_undo}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_redo" onclick="discuzcode('redo')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_redo.gif" width="21" height="20" title="{lang post_discuzcode_redo}" alt="{lang post_discuzcode_redo}" /></div></td>

	<td><img src="images/common/bb_separator.gif" width="6" height="20" alt="" /></td>

	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_bold" onClick="discuzcode('bold')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_bold.gif" width="21" height="20" title="{lang post_discuzcode_bold}" alt="{lang post_discuzcode_bold}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_italic" onclick="discuzcode('italic')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_italic.gif" width="21" height="20" title="{lang post_discuzcode_italic}" alt="{lang post_discuzcode_italic}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_underline" onclick="discuzcode('underline')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_underline.gif" width="21" height="20" title="{lang post_discuzcode_underline}" alt="{lang post_discuzcode_underline}" /></div></td>

	<td><img src="images/common/bb_separator.gif" width="6" height="20" alt="" /></td>

	<td id="{$editorid}_popup_fontname" title="{lang post_discuzcode_fontname}"><div class="editor_buttonnormal" onMouseOver="menuContext(this, 'mouseover')" onMouseOut="menuContext(this, 'mouseout')">
	<table cellpadding="0" cellspacing="0" border="0" unselectable="on">
	<tr>
	<td class="editor_menunormal" unselectable="on" id="{$editorid}_menu"><div id="{$editorid}_font_out" style="width:91px" unselectable="on">{lang post_discuzcode_fontname}</div></td>
	<td unselectable="on"><img src="images/common/bb_menupop.gif" width="7" height="4" alt="" /></td>
	</tr>
	</table>
	<script type="text/javascript">menuregister(true, "{$editorid}_popup_fontname")</script></div></td>

	<td id="{$editorid}_popup_fontsize" title="{lang post_discuzcode_fontsize}"><div class="editor_buttonnormal" onMouseOver="menuContext(this, 'mouseover')" onMouseOut="menuContext(this, 'mouseout')">
	<table cellpadding="0" cellspacing="0" border="0" unselectable="on">
	<tr>
	<td class="editor_menunormal" unselectable="on" id="{$editorid}_menu"><div id="{$editorid}_size_out" style="width:25px" unselectable="on">{lang post_discuzcode_fontsize}</div></td>
	<td unselectable="on"><img src="images/common/bb_menupop.gif" width="7" height="4" alt="" /></td>
	</tr>
	</table>
	<script type="text/javascript">menuregister(true, "{$editorid}_popup_fontsize")</script></div></td>

	<td id="{$editorid}_popup_forecolor" title="{lang post_discuzcode_forecolor}"><div class="editor_buttonnormal" onMouseOver="menuContext(this, 'mouseover')" onMouseOut="menuContext(this, 'mouseout')">
	<table cellpadding="0" cellspacing="0" border="0" unselectable="on">
	<tr>
	<td class="editor_colormenunormal" unselectable="on" id="{$editorid}_colormenu"><img src="images/common/bb_color.gif" width="21" height="16" alt="" /><br><img src="images/common/bb_clear.gif" id="{$editorid}_color_bar" alt="" style="background-color:black" width="21" height="4" /></td>
	<td unselectable="on"><img src="images/common/bb_menupop.gif" width="7" height="4" alt="" /></td>
	</tr>
	</table>
	<script type="text/javascript">menuregister(true, "{$editorid}_popup_forecolor")</script></div></td>

	<td><img src="images/common/bb_separator.gif" width="6" height="20" alt="" /></td>

	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_justifyleft" onclick="discuzcode('justifyleft')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_left.gif" width="21" height="20" title="{lang post_discuzcode_left}" alt="{lang post_discuzcode_left}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_justifycenter" onclick="discuzcode('justifycenter')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_center.gif" width="21" height="20" title="{lang post_discuzcode_center}" alt="{lang post_discuzcode_center}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_justifyright" onclick="discuzcode('justifyright')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_right.gif" width="21" height="20" title="{lang post_discuzcode_right}" alt="{lang post_discuzcode_right}" /></div></td>

	<td><img src="images/common/bb_separator.gif" width="6" height="20" alt="" /></td>

	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_insertorderedlist" onclick="discuzcode('insertorderedlist')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_orderedlist.gif" width="21" height="20" title="{lang post_discuzcode_orderedlist}" alt="{lang post_discuzcode_orderedlist}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_insertunorderedlist" onclick="discuzcode('insertunorderedlist')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_unorderedlist.gif" width="21" height="20" title="{lang post_discuzcode_unorderedlist}" alt="{lang post_discuzcode_unorderedlist}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_outdent" onclick="discuzcode('outdent')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_outdent.gif" width="21" height="20" title="{lang post_discuzcode_outdent}" alt="{lang post_discuzcode_outdent}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_indent" onclick="discuzcode('indent')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_indent.gif" width="21" height="20" title="{lang post_discuzcode_indent}" alt="{lang post_discuzcode_indent}" /></div></td>

	</tr>
	</table>

	<table cellpadding="0" cellspacing="0" border="0">
	<tr>

	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_createlink" onclick="discuzcode('createlink')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_url.gif" width="21" height="20" title="{lang post_discuzcode_url}" alt="{lang post_discuzcode_url}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_unlink" onclick="discuzcode('unlink')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_unlink.gif" width="21" height="20" title="{lang post_discuzcode_unlink}" alt="{lang post_discuzcode_unlink}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_email" onclick="discuzcode('email')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_email.gif" width="21" height="20" title="{lang post_discuzcode_email}" alt="{lang post_discuzcode_email}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_insertimage" onclick="discuzcode('insertimage')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_image.gif" width="21" height="20" title="{lang post_discuzcode_image}" alt="{lang post_discuzcode_image}" /></div></td>

	<td><img src="images/common/bb_separator.gif" width="6" height="20" alt="" /></td>

	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_wrap0_quote" onclick="discuzcode('quote')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_quote.gif" width="21" height="20" title="{lang post_discuzcode_quote}" alt="{lang post_discuzcode_quote}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_wrap0_code" onclick="discuzcode('code')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_code.gif" width="21" height="20" title="{lang post_discuzcode_code}" alt="{lang post_discuzcode_code}" /></div></td>
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_table" onclick="discuzcode('table')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/bb_table.gif" width="21" height="20" title="{lang post_discuzcode_table}" alt="{lang post_discuzcode_table}" /></div></td>

	<td><img src="images/common/bb_separator.gif" width="6" height="20" alt="" /></td>
	<!--{if $forum['allowbbcode'] && $allowcusbbcode}-->
	<!--{loop $_DCACHE['bbcodes_display'] $tag $bbcode}-->
	<td><div class="editor_buttonnormal" id="{$editorid}_cmd_custom{$bbcode[params]}_$tag" onclick="discuzcode('custom{$bbcode[params]}_$tag')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/$bbcode[icon]" width="21" height="20" title="$bbcode[explanation]" alt="$tag" /></div></td>
	<!--{/loop}-->
	<!--{/if}-->
	</tr>
	</table>
	<br>

	<div id="{$editorid}_switcher">
	<input type="button" id="bbcodemode" value="{lang editor_mode_discuzcode}" onclick="switchEditor(0)" class="editor_switcher_highlight">
	<input type="button" id="wysiwygmode" value="{lang editor_mode_wysiwyg}" onclick="switchEditor(1)" class="editor_switcher">
	</div>

	<!--{eval $fontoptions = array({lang post_discuzcode_fontoptions})}-->
	<div class="popupmenu_popup" id="{$editorid}_popup_fontname_menu" style="display: none">
	<table cellpadding="4" cellspacing="0" border="0" unselectable="on">
	<!--{loop $fontoptions $fontname}-->
		<tr><td class="popupmenu_option" onClick="discuzcode('fontname', '$fontname')" unselectable="on"><font face="$fontname" unselectable="on">$fontname</font></td></tr>
	<!--{/loop}-->
	</table></div>

	<!--{eval $sizeoptions = array(1, 2, 3, 4, 5, 6, 7)}-->
	<div class="popupmenu_popup" id="{$editorid}_popup_fontsize_menu" style="display: none">
	<table cellpadding="4" cellspacing="0" border="0" unselectable="on">
	<!--{loop $sizeoptions $size}-->
		<tr align="center"><td class="popupmenu_option" onClick="discuzcode('fontsize', $size)" unselectable="on"><font size="$size" unselectable="on">$size</font></td></tr>
	<!--{/loop}-->
	</table></div>

	<!--{eval $coloroptions = array('Black', 'Sienna', 'DarkOliveGreen', 'DarkGreen', 'DarkSlateBlue', 'Navy', 'Indigo', 'DarkSlateGray', 'DarkRed', 'DarkOrange', 'Olive', 'Green', 'Teal', 'Blue', 'SlateGray', 'DimGray', 'Red', 'SandyBrown', 'YellowGreen', 'SeaGreen', 'MediumTurquoise', 'RoyalBlue', 'Purple', 'Gray', 'Magenta', 'Orange', 'Yellow', 'Lime', 'Cyan', 'DeepSkyBlue', 'DarkOrchid', 'Silver', 'Pink', 'Wheat', 'LemonChiffon', 'PaleGreen', 'PaleTurquoise', 'LightBlue', 'Plum', 'White')}-->
	<div class="popupmenu_popup" id="{$editorid}_popup_forecolor_menu" style="display: none">
	<table cellpadding="4" cellspacing="0" border="0" unselectable="on"><tr>
	<!--{loop $coloroptions $key $colorname}-->
		<td class="editor_colornormal" onClick="discuzcode('forecolor', '$colorname')" unselectable="on" onMouseOver="colorContext(this, 'mouseover')" onMouseOut="colorContext(this, 'mouseout')"><div style="background-color: $colorname" unselectable="on"></div></td><!--{if ($key + 1) % 8 == 0}--></tr><tr><!--{/if}-->
	<!--{/loop}-->
	</tr></table></div>

	</td>
	</tr>
	</table>
<!--{else}-->
	<div class="editor_line"></div>
<!--{/if}-->