{include file="page_header.htm"}
<div class="main-div">
  <form name="theForm" method="post" action="wx_send.php" >
  
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_form">
  <tr>
    <td class="label">接收人:</td>
    <td>
    {foreach from=$user item=list}
    {$list.nickname},
    <input type="hidden" name="user_list[]" value="{$list.uid}" />
    {/foreach}
    </td>
  </tr>
  
  <tr>
    <td class="label">主题:</td>
    <td>
    <input type="text" class="FormSmall" name="subject" size="20" value=""/>
    </td>
  </tr> 
  
  <tr>
    <td class="label">类型:</td>
    <td>
    <select name="type" onchange="get_content(this.options[this.options.selectedIndex].value);">
	{foreach from=$send_type item=name key=k}
    <option value="{$k}">{$name}</option>
	 {/foreach}
    </select>    
    </td>
  </tr>
  
 <tr>
    <td colspan="2" id="html_content" style="padding:0px; margin:0px;"></td>
  </tr>

  <tr>
	<td></td>
    <td  align="left">
    <input type="hidden" name="act" value="{$form_action}" />
      <input type="submit" value="提交" class="bginput" />
      <input type="reset" value="重置" class="bginput"  />
    </td>
  </tr>
</table>
  </form>
</div>
<script language="JavaScript">
var reply_id = {$reply.id|default:0};
{literal}
function validate()
{
  /*var validator = new Validator('theForm');
  validator.required('name', '名称不能为空。');
  validator.required('keyword', '关键词不能为空。');
  return validator.passed();*/
}

function get_content(type){
    if (type == ''){
        return;
    }
	$.ajax({ 
			url:"wx_send.php?is_ajax=1&act=get_content", 
			type:"get",
			dataType:"json",
			data:{"id":reply_id,"type":type},
			beforeSend:function(){
				$("#loading").fadeIn("fast");
			},
			complete:function(){
				$("#loading").stop();
				$("#loading").fadeOut("fast");
			},
			success: function(result){
				if(result.error == 1){
					alert(result.message);
					return false;
				}else{
					$('#html_content').html(result.content);
					return true;
				}
			}
	});		
}



if(reply_id!=0){
	{/literal}
	get_content('{$reply.type}');
	{literal}
}else{
	get_content('text');
}
{/literal}
</script>
{include file="page_footer.htm"}