<?xml version="1.0"?>
<labeltemplate>
   <label>
    <![CDATA[
	       <style type="text/css">
		    .askshowlist{border-bottom:1px solid #f1f1f1}
			.askshowlist li{line-height:26px;}
			.askshowlist li img{position:relative;top:7px;left:10px;display:block;width:15px;height:15px;float:left;}
            .askshowlist span.question{width:100%;font-weight:bold;font-size:14px}
		   </style>
      <script>
			 jQuery(document).ready(function(){
			   loadAskForm(1);
			 });
		
			 function loadAskForm(page){
				  jQuery.ajax({
				   type: "POST",
				   url: "{M:HomeDir}Shop/ProComment.ashx",
				   data: "page="+page+"&proid={KS:Current:ItemID}&action=LoadAskForm",
				   success: function(data){
          
				        var d=data.split("$#$");
						$("#askform").html(d[0]);
						$("#showasklist").html(d[1]);
						$("#totalAskNum").html(d[2]);
				   }
				});
			 }
			
			
	 function limitLength(obj){
	   if(obj.value.length >= 255) 
			  event.returnValue = false; 
	 }
	 function checkAsk(){
	  var content=$("#askcontent").val();
	  if (content==''){
	   KesionJS.Alert('请输入要咨询的内容!',"$('#askcontent').focus()");
	   return false;
	  }
	  
	  jQuery.ajax({
				   type: "POST",
				   cache:false,
				   url: "{M:HomeDir}Shop/ProComment.ashx",
				   data: "proid={KS:Current:ItemID}&action=SaveAsk&content="+content,
				   success: function(data){
					 if (data=="nologin"){
					  location.href='{M:HomeDir}Login.aspx';
					 }else if (data.indexOf('error:')!=-1){
					  KesionJS.Alert(data.split(':')[1]);
					 }else if (data=='success'){
					  loadAskForm(1);
					   KesionJS.Message('success.gif','恭喜，您的咨询已提交，请耐心等待商家的回复！','');
					 }else{
					  KesionJS.Alert('出错！');
					 }
				   }
				});
	  
	 }
	 </script>
	      
	       <div style="height:34px;line-height:34px;padding:5px;font-size:15px; font-family:'微软雅黑'">商家问答列表:</div>
		   <table width="100%" class="commentlist" cellspacing="0" cellpadding="0">
		    <tr>
			 <td>
			    <div id="showasklist"></div>
			 </td>
			 
			</tr>
		   </table>
		 
		<div class="cmtcontent" id="askform">loading...</div>

	]]>
   </label>
   
   <askform>
    <![CDATA[
	 问商家问题：<span style="color:#999">（问题提交后显示可能会延迟，请耐心等待）限制255个字符</span>
	 <br/>
	 <textarea name="askcontent" id="askcontent" onkeydown="limitLength(this)" style="width:94%;height:100px;border:1px solid #ddd;border-top:1px solid #ccc;margin-top:10px"></textarea>
	 <div style="text-align:right"><input type="button" onclick="checkAsk()" value="提交咨询" class="askbtn" style="width:100px;height:28px; background:#fff url(/Home/images/shop/bg12.png) repeat-x 0 100%;border:1px solid #ddd;border-radius: 3px;margin-top:15px" /></div>
	]]>
   </askform>
   <loopitem>
    <![CDATA[
	 <div class="askshowlist">
	 <span style="float:right;color:#999">{KS:Field:Adddate}</span>
	   <li><img src='{M:HomeDir}images/shop/ask.gif' align="middle"/><span class="question">问：{KS:Field:Content}</span></li>
	   <li id="Reply{KS:Field:ID}"><span style="float:right;color:#999">{KS:Field:Replydate}</span> <img src='{M:HomeDir}images/shop/answer.gif' align="middle"/>答：{KS:Field:ReplyContent}</li>
	 </div>
]]>
   </loopitem>
   
   
   
</labeltemplate>