<script type="text/javascript">
var HS_PATH = '<?php echo HS_PATH;?>';
var editorWidth = <?php echo $width;?>;
var editorHeight = <?php echo $height;?>;
var editorCss = '<?php echo $editorCss;?>';
var editorKeyid = '<?php echo $editorKeyid;?>';
var editorCharset = '<?php echo $CONFIG['charset'];?>';
var editorCid = '<?php echo $textareaid;?>';
var isIE = (document.all && window.ActiveXObject && !window.opera) ? true : false;
</script>

<link rel="stylesheet" type="text/css" href="<?php echo HS_PATH;?>editor/css/default.css">

<table cellspacing="0" cellpadding="2" class="tb" style="BORDER-RIGHT: #666 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #666 1px solid; PADDING-LEFT: 2px; BACKGROUND: #fff; PADDING-BOTTOM: 2px; BORDER-LEFT: #666 1px solid; COLOR: #d6b359; PADDING-TOP: 2px; BORDER-BOTTOM: #666 1px solid;height:21px;">
<tbody id="ToolBar" oncontextmenu="return false">
<tr>
<td style="padding-left:20px;border-bottom:1px solid #ddd">
<select onchange="FormatText('fontname', this.value);" class="select" style="width:60px;">
<option selected>字体</option>
<option value="宋体">宋体</option>
<option value="楷体_GB2312">楷体</option>
<option value="新宋体">新宋体</option>
<option value="黑体">黑体</option>
<option value="隶书">隶书</option>
<option value="幼圆">幼圆</option>
<option value="Arial">Arial</option>
<option value="Tahoma">Tahoma</option>
<option value="Verdana">Verdana</option>
</select>

<select onChange="FormatText('fontsize',this.value);" class="select" style="width:50px;">
<option class="heading" selected>字号</option> 
<option value="7">一号</option> 
<option value="6">二号</option> 
<option value="5">三号</option>  
<option value="4">四号</option>  
<option value="3">五号</option>  
<option value="2">六号</option>  
<option value="1">七号</option>
</select>
<img src="<?PHP echo HS_PATH;?>editor/images/forecolor.gif" alt="文字颜色" onclick="FormatText('forecolor', PickColor())" onmouseover="this.className='ov';" onmouseout="this.className='ot';" />

<img src="<?PHP echo HS_PATH;?>editor/images/backcolor.gif" alt="背景颜色" onclick="FormatText('backcolor', PickColor())" onmouseover="this.className='ov';" onmouseout="this.className='ot';" />

<img src="<?PHP echo HS_PATH;?>editor/images/bold.gif" alt="粗体" onclick="FormatText('bold', '')" onmouseover="this.className='ov';" onmouseout="this.className='ot';" /> 

<img src="<?PHP echo HS_PATH;?>editor/images/italic.gif" alt="斜体" onclick="FormatText('italic', '')" onmouseover="this.className='ov';" onmouseout="this.className='ot';" />

<img src="<?PHP echo HS_PATH;?>editor/images/underline.gif" alt="下划线" onclick="FormatText('underline', '')" onmouseover="this.className='ov';" onmouseout="this.className='ot';" /> 

<img src="<?PHP echo HS_PATH;?>editor/images/Aleft.gif" onclick="FormatText('Justifyleft', '')" alt="左对齐"  onmouseover="this.className='ov';" onmouseout="this.className='ot';" /> 

<img src="<?PHP echo HS_PATH;?>editor/images/Acenter.gif" alt="居中" onclick="FormatText('JustifyCenter', '')" onmouseover="this.className='ov';" onmouseout="this.className='ot';" /> 

<img src="<?PHP echo HS_PATH;?>editor/images/Aright.gif" alt="右对齐"  onclick="FormatText('JustifyRight', '')" onmouseover="this.className='ov';" onmouseout="this.className='ot';" /> 

<img src="<?PHP echo HS_PATH;?>editor/images/list.gif" alt="插入项目符号" onclick="FormatText('InsertUnorderedList', '')" onmouseover="this.className='ov';" onmouseout="this.className='ot';" />

<img src="<?PHP echo HS_PATH;?>editor/images/num.gif" alt="插入编号" onclick="FormatText('insertorderedlist', '')" onmouseover="this.className='ov';" onmouseout="this.className='ot';" />
</td>
</tr>
</tbody>
<tr>
<td>
<script type="text/javascript">
document.write ('<iframe id="EditorAREA" width="'+editorWidth+'" height="'+editorHeight+'" frameborder="0"></iframe>')
var editor;
editor = $("EditorAREA").contentWindow;
editor.document.designMode = 'On';
editor.document.contentEditable = true;
editor.document.open();
editor.document.writeln('<html>');
editor.document.writeln('<http-equiv="Content-Type" content="text/html; charset='+editorCharset+'">');
editor.document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo HS_PATH;?>editor/css/style.css">');
editor.document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo HS_PATH;?>editor/css/editor.css">');
editor.document.writeln('<body>');
editor.document.writeln('</body>');
editor.document.writeln('</html>');
editor.document.close();
function setMode()
{
	if ($('Mode_Img').src.indexOf('design.gif') == -1) 
	{
		$('Mode_Img').src = '<?PHP echo HS_PATH;?>editor/images/design.gif';
		if(isIE)
		{
			editor.document.body.innerText=editor.document.body.innerHTML;
		}
		else
		{
			editor.document.body.textContent=editor.document.body.innerHTML;
		}
		$('ToolBar').style.display = 'none';
		$('EditorAREA').height = Number($('EditorAREA').height)+78;
	} 
	else
	{
		$('Mode_Img').src = '<?PHP echo HS_PATH;?>editor/images/code.gif';
		editor.document.body.innerHTML= isIE ? editor.document.body.innerText : editor.document.body.textContent;
		$('ToolBar').style.display = '';
		$('EditorAREA').height = Number($('EditorAREA').height)-78;
	}
	editor.focus();
}
$(editorCid).style.display = 'none';
if(isIE)
{
	document.myform.attachEvent("onsubmit", getData);
	editor.document.body.innerHTML = $(editorCid).value;
	editor.focus();
}
else
{
	//document.myform.addEventListener("submit", getData, false);
	setInterval("getData()",1000);
	$('ToolBar').style.display = 'none';
	window.onload = function()
	{
		editor.document.body.innerHTML = $(editorCid).value ? $(editorCid).value : '';
	}
}

function getData()
{
	try{ $(editorCid).value=editor.document.body.innerHTML; } catch(e){}
	if(isIE) clipboardData.setData('text', editor.document.body.innerHTML);
}
</script>
<script type="text/javascript" src="<?php echo HS_PATH;?>editor/js/pickcolor.js"></script>
<script type="text/javascript" src="<?php echo HS_PATH;?>editor/js/editor.js"></script>
</td>
</tr>
<tr oncontextmenu="return false">
<td style="border-top:1px solid #ddd" onclick="setMode();" style="cursor:pointer;" width="60"><img src="<?PHP echo HS_PATH;?>editor/images/code.gif" valign="absmiddle" id="Mode_Img" />
</td>
</tr>
	</table>
