<div class="askInfoBox">
		<h3 class="h3">问题详情</h3>
		<!---->
		
		<div class="askText">
				<div class="clearfix"> <em class="askIco askIco01">&nbsp;</em>
						<h3 class="h4"><?=$qdata['q_message']?></h3>
				</div>
            <?php if($qdata['q_description'] != ''){ ?>
				<div class="askInfoInner"><?=$qdata['q_description']?></div>
            <?php }?>
        </div>
		<!---->
        <span id="newreply">
		 <?php if($myanswer || $answarr){ ?>
		<div class="askText">
				<div class="clearfix" ><em class="askIco askIco02">&nbsp;</em>
						<h3 class="h5">我的回答</h3>
                        <?php if($qdata['q_answer_type'] == 1 && $uid == $qdata['q_answer_uid']){ ?>
                        <img class="imgGood" alt="最佳答案" src="http://esf.s.house365.com/zsb/images/v1.0/zjda_ask.gif" >
                        <?php }?>
                </div>
				<div class="askInfoInner"><?=$myanswer['a_message']?> </div>
				<?php if($myreqarr){ 
		              $num = count($myreqarr) -1;
		           ?>
                <span id="addzuiwenAnswer"></span>
		        <?php foreach($myreqarr as $key=>$req){ ?>
				<div class="askedInner clearfix"><div class="askd"><span class="t"><?php echo $req['a_type'] == 1 ? "追问：" : "回答："; ?></span><?=$req['a_message']?></div>
                    <?php if($allowtoanswer && $req['a_type'] == 1 && $num == $key){ ?>
                    <a class="btn btnConColor radius5" href="javascript:void(0);" id="rereply" aid="<?=$myanswer['a_id']?>">回答</a> 
                    <?php }?>
                </div>
                <?php }?>
                <?php }?>    
        </div>
         <?php }?>
        </span>
		<!---->    

		<!---->
        <?php if($allowtoanswer && empty($myanswer)){ ?>
		<div class="askText" id="replyText">
				<div class="clearfix"> <em class="askIco askIco05">&nbsp;</em>
						<h3 class="h5 h5_02">我来回答</h3>
				</div>
				<div id="atextareaAsk">
						<textarea id="js_textareaAsk" class="textareaAsk textareaAsk-active AskTextareanew" maxlength="1000" ></textarea>
				</div>
            	<input id="qid" type="hidden" name="id" value="<?=$qid?>" />
				<input type="hidden" id="reqid" name="reqid" value="" />
				<input id="type" type="hidden" name="type" value="submit_answer" />
                <div class="askInfoInner askInfoInner03 clearfix"><a class="btn btnConColor radius5" id="reqbtn" href="javascript:void(0);">提交答案</a>
						<p class="tex">还剩<strong class="num" id="js_numAsk">1000</strong>字</p>
				</div>
		</div>
            
        <?php } ?>
</div>





<div id="js_open_ask" class="dialog dialogW430 radius5" style="display:none">
		<div class="hd">
				<h3 class="h3">回答</h3>
				<p class="close close-win" title="关闭">关闭 </p>
		</div>
		<div class="mod">
			<div id="atextareaAsk" class="winAskTextareaBox">
					<textarea class="winAskTextarea AskTextareanew" id="js_textareaAsk02" maxlength="1000"></textarea>
			</div>
            <input id="qid" type="hidden" name="id" value="<?=$qid?>" />
			<input type="hidden" id="reqid" name="reqid" value="" />
			<input id="type" type="hidden" name="type" value="submit_req_answer" />
			<div class="tipWinAskTextarea">还剩<strong id="js_numAsk02" class="num">1000</strong>字</div>
			<div class="tipWinAskTextarea tipWinAskTextareaError">请输入内容。</div>
			<div class="winAskBtn"><a href="javascript:void(0)" class="btn btnCon radius5 " id="reqbtn">确认</a><a href="javascript:void(0)" class="btn btnCon radius5 close-win">取消</a></div>
		</div>
</div>



<script>
   
   
$("#rereply").bind("click",function(){     
    var aid = $(this).attr("aid");
    $("#reqid").val(aid);    
     openWin('js_open_ask');    
});
function close_doaction_loading()
{   
    $('#docation_loading').hide();
}

function countFunAsk(obj,oNum,oNumBox){
		$("#"+obj).live("keyup blur",function(){ 
			var num = this.value.length; 	
			var nums = oNum - num;	
			if(nums < 0){ 		
				$("#"+obj).val($(this).val().substring(0,oNum))
				$("#"+oNumBox).html("0");
			}else{ 		
				$("#"+oNumBox).html(nums); 	
			} 
		});	
};


$(function(){
	countFunAsk("js_textareaAsk","1000","js_numAsk");
	countFunAsk("js_textareaAsk02","1000","js_numAsk02");
});


$(function(){

		$("#reqbtn").click(function(){
			var _id = $(this).parent().parent().children("#qid").val();  
			var text = $(this).parent().parent().children("#atextareaAsk").children(".AskTextareanew").val();   
			var _type = $(this).parent().parent().children("#type").val();
			if(text == ""){
				alert("提交的内容不能为空！");
				return false;
			}
			_type = encodeURI(_type,"UTF-8");
			openWin('docation_loading');		
		
			$.ajax({ 
				type: 'post',
				url : '/ask/answer/',
				data: {id : _id,answerText : text,type : _type},
				dataType : 'json',
				success: function(data){                      
					close_doaction_loading();
					$("#gTipsCoverdocation_loading").remove();                  
					if(data.mid == 1){
					   $("#message").html("提交失败，您是禁言用户，暂时无法再次回复！");   
					   openWin("jsDialog_13_31");
					}else if(data.mid == 2){
						$("#message").html("回复成功！");     
						openWin("jsDialog_13_31");
						$("#replyText").remove();   
						if(_type == 'submit_answer'){
							var replyText = "<div class='askText'><div class='clearfix' ><em class='askIco askIco02'>&nbsp;</em><h3 class='h5'>我的回答</h3></div><div class='askInfoInner'>"+data.answerText+"</div></div>";              
							$("#newreply").html(replyText);
						}else if(_type == 'submit_req_answer'){ 
							 var replyText = "<div class='askedInner clearfix'><div class='askd'><span class='t'>回答：</span>"+data.answerText+"</div></div>";              
							 $("#addzuiwenAnswer").html(replyText);
						}                
						
					}else if(data.mid == 3){
						$("#message").html("该问题不存在！");   
						openWin("jsDialog_13_31");
					}else if(data.mid == 4){
						$("#message").html("回复失败！");   
						openWin("jsDialog_13_31");
					}           
				   
				}
			});
		
			
		})

})
</script>


<!--页面处理中弹层-->
<div style="display:none; text-align: center;" id ='docation_loading'>
    <img src ="http://esf.s.house365.com/common/images/loading_6.gif">
    <p style="font-size: 16px; font-family:'微软雅黑'; line-height: 30px; color: #fff;">正在处理</p>
</div>


<div class="dialog radius5" id="jsDialog_13_31" style="display: none">
    <div class="hd">
        <h3 class="h3">提示</h3>
        <span class="close close-win" title="关闭">Χ</span> </div>
    <div class="mod">
        <div class="text" id="message">
           
        </div>
        <div style="text-align:center; padding-top:8px;"></div>
    </div>
</div>
