<table id="chat" border="0" width="720" cellspacing="0" cellpadding="0" style="valign:top">
	<tr>
		<td height="20px" width="100%" class="b1"><span id="chattitle">{lang chat}</span></td>
	</tr>
	<tr>
		<td valign="top" class="b3" style="text-align: left" height="1px">
			<div id="chatlist" class="chatlist">
				<!--{loop $chatdata['msg'] $msg}-->
				$msg
				<!--{/loop}-->
			</div>
			<div id="newslist" style="display:none" class="newslist">
				<!--{eval $chat_news = nparse_news(0,$newslimit);}-->
				$chat_news
			</div>
		</td>
	</tr>
	<tr>
		<td class="b3" height="5"></td>
	</tr>
	<tr>
		<td class="b3" height="35">
			<div>
				<form type="post" id="sendchat" name="sendchat" action="chat.php" onsubmit="return false;">
					<input type="hidden" id="lastcid" name="lastcid" value="$chatdata['lastcid']">
					<input type="hidden" id="teamID" name="teamID" value="$teamID">
					<input type="hidden" id="sendmode" name="sendmode" value="ref">
					<span id="chattype">
						<select name="chattype" value="2">
							<option value="0" selected>$chatinfo[0]
								<!--{if $teamID}-->
							<option value="1">$chatinfo[1]
								<!--{/if}-->
						</select>
					</span>
					<input type="text" id="chatmsg" name="chatmsg" maxlength="60">
					<input type="button" id="send" onClick="
						if($('sendmode').value=='ref')
						{
							document['sendchat']['sendmode'].value='send';
							chat('send',$chatrefresh);
						}
						return false;"
						value="{lang send}">
					<input type="button" id="ref" onClick="
						if($('sendmode').value=='news'){
							chat('news',$chatrefresh);
						}else{
							document['sendchat']['sendmode'].value='ref';chat('ref',$chatrefresh);
						}
						return false;"
						value="{lang refresh}">
					<!-- 迷你进行状况 -->
					<input type="button" id="switch" onClick="
						if($('sendmode').value=='news'){
							$('sendmode').value='ref';
							$('chatlist').style.display='';
							$('newslist').style.display='none';
							$('chattitle').innerHTML='聊天讯息';
						}else{
							$('sendmode').value='news';
							$('chatlist').style.display='none';
							$('newslist').style.display='';
							$('chattitle').innerHTML='进行状况';
						}
					chat($('sendmode').value,$chatrefresh);
					return false;" value="{lang chatswitch}">
					<!-- 表情 -->
					<input type="button" id="embtn" value="{lang emoji}">
					<div id="empanel" style="display:none;">
						<!--{loop $emdata $em}-->
						$em
						<!--{/loop}-->
					</div>
				</form>
				<script type="text/javascript">chat('ref', $chatrefresh);</script>
			</div>
		</td>
	</tr>
</table>

<!-- JavaScript 代码 -->
<script>
	function insertEm(em) {
		document.getElementById('chatmsg').value += "[" + em + "]";
	}

	document.getElementById('embtn').addEventListener('click', function () {
		var panel = document.getElementById('empanel');
		panel.style.display = (panel.style.display == 'none') ? 'block' : 'none';
	});
</script>