<!--{if $a == "addto"}-->
<div class="oe_comment_addto">
  <h2 style="display:none;">添加店铺追评</h2>
  <dl>
    <dt><font color="red">*</font> 追评内容：</dt>
	<dd>
	  <textarea id="content" style="width:400px;height:120px;"></textarea>
	  <p>请填写追评内容，500个字以内。<em id="words_count">0</em>/500</p>
	</dd>
	<div class="clear"></div>
  </dl>
  <dl>
    <dt>&nbsp;</dt>
	<dd><i f="addtopost">发表保存</i>&nbsp;&nbsp;&nbsp;<span id="words_tips"></span></dd>
	<div class="clear"></div>
  </dl>
</div>
<script type="text/javascript">
$(function(){
	
	$("[f='addtopost']").bind("click", function(){ //保存发表
	
		$words_tips = $("#words_tips");
		$content = $("#content").val();
		if ($content.length == 0) {
			$words_tips.html("<font color='red'>请填写追评内容</font>");
			return false;
		}
		$.ajax({
			type: "POST",
			url: _ROOT_PATH + "index.php?m=user",
			cache: false,
			data: {c:"shopcomment", a:"saveaddto", content:$content, commid:"<!--{$commid}-->", r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") {
					$words_tips.html("<font color='green'>发表成功</font>");
					setTimeout(function(){
						window.location.reload();
					}, 800);

				}
				else {
					if ($result.length > 0) {
						$words_tips.html("<font color='red'>"+$result+"</font>");
					}
					else {
						$words_tips.html("<font color='red'>发表失败</font>");
					}
				}
			},
			error: function() {
				$words_tips.html("<font color='red'>发表失败，请检查网络！</font>");
			}
		});

	});

});
</script>
<!--{/if}-->

<!--{if $a == "editto"}-->
<div class="oe_comment_addto">
  <h2 style="display:none;">编辑店铺追评</h2>
  <dl>
    <dt><font color="red">*</font> 追评内容：</dt>
	<dd>
	  <textarea id="content"><!--{$reply.content}--></textarea>
	  <p>请填写追评内容，500个字以内。<em id="words_count">0</em>/500</p>
	</dd>
	<div class="clear"></div>
  </dl>
  <dl>
    <dt>&nbsp;</dt>
	<dd><i f="addtopost">编辑保存</i>&nbsp;&nbsp;&nbsp;<span id="words_tips"></span></dd>
	<div class="clear"></div>
  </dl>
</div>
<script type="text/javascript">
$(function(){
	
	$("[f='addtopost']").bind("click", function(){ //保存发表
	
		$words_tips = $("#words_tips");
		$content = $("#content").val();
		if ($content.length == 0) {
			$words_tips.html("<font color='red'>请填写追评内容</font>");
			return false;
		}
		$.ajax({
			type: "POST",
			url: _ROOT_PATH + "index.php?m=user",
			cache: false,
			data: {c:"shopcomment", a:"saveeditto", content:$content, id:"<!--{$reply.replyid}-->", r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") {
					$words_tips.html("<font color='green'>修改成功</font>");
					setTimeout(function(){
						window.location.reload();
					}, 800);

				}
				else {
					if ($result.length > 0) {
						$words_tips.html("<font color='red'>"+$result+"</font>");
					}
					else {
						$words_tips.html("<font color='red'>修改失败</font>");
					}
				}
			},
			error: function() {
				$words_tips.html("<font color='red'>修改失败，请检查网络！</font>");
			}
		});

	});

});
</script>
<!--{/if}-->

<script type="text/javascript">
$(function(){
	
	//字数统计
	$("#content").bind("keydown", function(){
		$len = $(this).val().length;
		$("#words_count").html($len);
	});

	$("#content").bind("keyup", function(){
		$len = $(this).val().length;
		$("#words_count").html($len);
	});

});
</script>