<include file="Global:header_top" />
<script type="text/javascript" src="__PUBLIC__/ueditor/third-party/SyntaxHighlighter/shCore.js"></script>
<link rel="stylesheet" href="__PUBLIC__/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css" type="text/css" />
<link rel="stylesheet" href="__PUBLIC__/prettyPhoto/css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
<script type="text/javascript" src="__PUBLIC__/rotate.js"></script>
<script src="__PUBLIC__/prettyPhoto/js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var qid=<php>echo $_GET['qid'];</php>;
	var quid=@#$question['uid']#@;
	var reply_min_wordcount=@#$setting['reply_min_wordcount']#@;
	var focus_ini=@#$focus_ini#@;
	var my_avatar='__PUBLIC__<php>echo get_avatar($user['id'],'min');</php>';
	var issolve=<php>echo $question['issolve'];</php>;
	var p='<php>echo $_GET['p'];</php>';
	var pa='<php>echo $_GET['noticepage'];</php>';
	var helpless_min_count='@#$setting['helpless_min_count']#@';
	SyntaxHighlighter.all();
</script>
<script type="text/javascript" src="__PUBLIC__/jUploader.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/question.js"></script>
<div id="main">
	<div id="main_left">
    	<div id="view_title">
            <h1 id="title_left">
            @#$question['title']#@
            </h1>
            <div class="avatar_wrapper" id="title_avatar" >
                 <img src="__PUBLIC__<php>echo get_avatar($question['uid'],'min');</php>" class="avatar" />
                 <img src="__PUBLIC__/css/avatar_cover.png" class="avatar_cover" /> 
                 <input type="hidden" value="@#$question['uid']#@" class="avatar_hidden" /> 
            </div>
            <div class="clear"></div>
        </div>
        <div class="opt" id="view_opt">
                 <div class="q_option_left"></div>
                 <div class="q_option_mid">
                   时间： <php> echo time_mode($question['pubtime']);</php><img src="__PUBLIC__/css/devider.png" />
                   回复: @#$question['answercount']#@<img src="__PUBLIC__/css/devider.png" />
                   浏览: @#$question['viewcount']#@<img src="__PUBLIC__/css/devider.png" />
                   关注: @#$question['focuscount']#@<img src="__PUBLIC__/css/devider.png" />
                   <a id="recommend_btn">推荐一下:</a> @#$question['recommendcount']#@<img src="__PUBLIC__/css/devider.png" />
                   <php>if($question['issolve']==0){echo '未解决';}else{echo '已解决';}
                   echo $is_me?'<img src="__PUBLIC__/css/devider.png" /><a href="'.U('Question/edit?qid='.$_GET['qid']).'" class="edi_question">编辑</a>':'';
                   </php>
                  </div>
                  <div class="q_option_right"></div>
        		  <a id="up_num">+1</a>
                  <div class="clear"></div>
        </div>
        <h2 id="view_detail">
        <php>echo stripslashes(htmlspecialchars_decode($question['detail']));</php>
        <div class="clear"></div>
        </h2>
        <div id="reply_div">
            <div id="q_opt">
            	<div id="topic_data" class="none">
                	<php>
                	if($question['topic'])
                    	{
                        	foreach($question['topic'] as $k=>$v)
                                {
                                   echo '<div class="topic_add_name"><div class="q_option_left"></div><div class="q_option_mid"><a href="'.U('Topic/view?tid='.$v['id']).'" target="_blank">'.$v['name'].'</a><input type="hidden" name="topic_name" class="tpc_name" value="'.$v['name'].'" /><input type="hidden" name="topic_id" value="'.$v['id'].'" /><img class="topic_close none" src="__PUBLIC__/css/topic_close.gif" /></div><div class="q_option_right"></div></div>';
                                }
                        }
                    </php>
                </div>
            	<div id="q_topic_div">
                	<div id="q_topic_list">
                	<php>
                	if($question['topic'])
                    	{
                        	foreach($question['topic'] as $k=>$v)
                                {
                                   echo '<div class="topic_add_name"><div class="q_option_left"></div><div class="q_option_mid"><a href="'.U('Topic/view?tid='.$v['id']).'" target="_blank">'.$v['name'].'</a><input type="hidden" name="topic_name" class="tpc_name" value="'.$v['name'].'" /><input type="hidden" name="topic_id" value="'.$v['id'].'" /><img class="topic_close none" src="__PUBLIC__/css/topic_close.gif" /></div><div class="q_option_right"></div></div>';
                                }
                        }
                    </php>
                    </div>
                    <div id="topic_div" class="none">
                            <input maxlength="8" id="search_topic" name="topic" type="text" />
                            <div class="s_btn" id="q_add_btn">添加话题</div>
                            <div class="s_btn" id="q_save_btn">保存当前</div>
                            <div class="s_btn" id="q_cancel_btn">放弃更改</div>
                    </div>
                    <a id="q_topic_edit"><php>echo $topic_list_arr?'编辑话题':'点此编辑话题';</php></a>
                </div>
                <div class="tab <php> $_GET['order']=='agreedec'&&print 'tab_bottom';</php>">
                    <a id="time_inc" href="<php>echo U('Question/view?qid='.$question['id'].'&order=timeinc');</php>">时间增序</a>
                    <a id="agree_dec" href="<php>echo U('Question/view?qid='.$question['id'].'&order=agreedec');</php>">赞成数降序</a>
                </div>
                <div class="clear"></div>
            </div>
        <div id="r_list">    
        <php>
        if($answer==NULL)
        	{
            	echo '<div id="reply_zero">暂无回复</div>';
            }else{
       	foreach($answer as $k=>$v)
        	{
            	($v['bestanswer']==1&&$setting['is_quora']==1)?($solve='_solve'):($solve='');
                $v['img']!=NULL?($img='<a href="__PUBLIC__/upload/'.$v['img'].'" rel="prettyPhoto"><img src="__PUBLIC__/upload/'.$v['img'].'" width="'.$v['imgwidth'].'" height="'.$v['imgheight'].'" border="0" /></a>'):($img=NULL);
            	if($k%2==0)
                	{
                    	echo '
                        <div class="reply_wrapper reply_list" id="qcs_'.$k.'">
           	  <table class="reply_tab" border="0" cellspacing="0" cellpadding="0">
            	  <tr>
            	    <td class="td1'.$solve.'"></td>
            	    <td class="td2'.$solve.'"></td>
            	    <td class="td3'.$solve.'"></td>
          	      </tr>
            	  <tr>
            	    <td class="td4'.$solve.'"></td>
            	    <td class="td5'.$solve.'">';
                    if($v['extra']!='')
                    	{
                        	echo '<div class="reply_quote">回复
                                    <img src="__PUBLIC__/css/quot_left.png" />
                                    '.$v['extra'].'
                                    <img src="__PUBLIC__/css/quot_right.png" />：
                                </div>';
                        }
                    	echo '<p>'.$v['content'].$img.'</p>
                    </td>
            	    <td class="td6'.$solve.'"></td>
          	     </tr>
            	  <tr>
            	    <td class="td7'.$solve.'">
                    	<div class="avatar_wrapper reply_avatar">
                             <img src="__PUBLIC__'; echo get_avatar($v['uid'],'min');echo '" class="avatar" />
                             <img src="__PUBLIC__/css/avatar_cover.png" class="avatar_cover" /> 
                             <input type="hidden" value="'.$v['uid'].'" class="avatar_hidden" /> 
                        </div>
                    </td>
            	    <td class="td8'.$solve.'"></td>
            	    <td class="td9'.$solve.'"></td>
          	    </tr>
          	  </table>
              <div class="clear"></div>
               <div class="reply_opt">
               		<div class="reply_icon_time">时间:'.time_mode($v['addtime']).'</div>
                    <div class="reply_icon_agree">顶:<a>'.$v['agreecount'].'</a></div>
                    <div class="reply_icon_against">踩:<a>'.$v['againstcount'].'</a></div>
                    <div class="reply_icon_useless">无帮助:<a>'.$v['uselesscount'].'</a></div>
                    <input type="hidden" value="'.$v['bestanswer'].'" class="best_answer_hidden" />
                    ';if($question['issolve']==0||$setting['is_quora']==0){echo'<div class="reply_icon_reply">回复</a></div>';};
                    if($v['bestanswer']==1&&$setting['is_quora']==1){echo '<div class="reply_icon_adopted">最佳答案</div>';}else if($is_me&&$question['issolve']==0&&$setting['is_quora']==1){echo '<div class="reply_icon_adopting hidden">设为答案</div>';} echo '
                    <input type="hidden" class="aid_hidden" value="'.$v['id'].'" />
                    <input type="hidden" class="auid_hidden" value="'.$v['uid'].'" />
               </div>
        	</div>
            <div class="clear"></div>';
                    }else{
                    		echo '
                            <div class="reply_wrapper_right reply_list" id="qcs_'.$k.'">
           	  <table class="reply_tab_right" border="0" cellspacing="0" cellpadding="0">
            	  <tr>
            	    <td class="td1_right"></td>
            	    <td class="td2"></td>
            	    <td class="td3_right"></td>
          	      </tr>
            	  <tr>
            	    <td class="td4_right"></td>
            	    <td class="td5 td_mid">';
                    if($v['extra']!='')
                    	{
                        	echo '<div class="reply_quote">回复
                                    <img src="__PUBLIC__/css/quot_left.png" />
                                    '.$v['extra'].'
                                    <img src="__PUBLIC__/css/quot_right.png" />：
                                </div>';
                        }
                    	echo '<p>'.$v['content'].$img.'</p>
                    </td>
            	    <td class="td6_right"></td>
          	    </tr>
            	  <tr>
            	    <td class="td7_right"></td>
            	    <td class="td8"></td>
            	    <td class="td9_right">
                    	<div class="avatar_wrapper reply_avatar_right">
                             <img src="__PUBLIC__'; echo get_avatar($v['uid'],'min');echo '" class="avatar" />
                             <img src="__PUBLIC__/css/avatar_cover.png" class="avatar_cover" /> 
                             <input type="hidden" value="'.$v['uid'].'" class="avatar_hidden" /> 
                        </div>
                    </td>
          	    </tr>
          	  </table>
               <div class="clear"></div>
               <div class="reply_opt_right">
               		<div class="reply_icon_time">时间:'.time_mode($v['addtime']).'</div>
                    <div class="reply_icon_agree">顶:<a>'.$v['agreecount'].'</a></div>
                    <div class="reply_icon_against">踩:<a>'.$v['againstcount'].'</a></div>
                    <div class="reply_icon_useless">无帮助:<a>'.$v['uselesscount'].'</a></div>
                    <input type="hidden" value="'.$v['bestanswer'].'" class="best_answer_hidden" />
                     ';if($question['issolve']==0||$setting['is_quora']==0){echo'<div class="reply_icon_reply">回复</a></div>';};
                     if($is_me&&$question['issolve']==0&&$setting['is_quora']==1){echo '<div class="reply_icon_adopting hidden">设为答案</div>';}echo '
                    <input type="hidden" class="aid_hidden" value="'.$v['id'].'" />
                    <input type="hidden" class="auid_hidden" value="'.$v['uid'].'" />
               </div>
        	</div>
            <div class="clear"></div>';
                    	 }
            }
           } 
        </php>
        </div>	
            
            <div class="clear"></div>
            <div id="page" align="center">
                @#$page#@
            </div>
        </div>
        <div id="reply_textarea_wrapper">
        <?php if($user['id']!='')
        	{
            if($question['issolve']==1&&$setting['is_quora']==1){
            echo '<div class="reply_textarea" align="center">
            	<div id="unreply">
                	该问题已有最佳答案
                </div>
            </div>';
            }else if($setting['reply_self']==0&&$question['uid']==$user['id'])
            	{
                	echo '<div class="reply_textarea" align="center">
                            <div id="unreply">
                                不能对自己的'.$sign.'回复
                            </div>
                        </div>';
                }
            else{
            	echo '
            <form>
                <textarea class="reply_textarea" id="reply_area"></textarea>
                <div id="reply_extra">
                <div id="reply_extra_con">回复：</div>
                <div id="extra_close"></div>
                </div>
                <div id="reply_upload"></div>
                <div class="reply_btn" id="reply">回复</div>
                <div id="upload_preview">
                	<div class="q_option_left"></div>
                    <div class="q_option_mid">
                        <a id="preview_con" rel="prettyPhoto" href=""></a>
                        <img id="del_upload" src="__PUBLIC__/css/topic_close.gif" />
                    </div><div class="q_option_right"></div>
                </div>    
                <div class="clear"></div>
            </form>
            ';}
            }else{
            echo '
            <div class="reply_textarea" align="center">
            	<div id="unreply">
                	回复请先<a href="'.U('Account/login').'">登录</a>或<a href="'.U('Account/register').'">注册</a>
                </div>
            </div>';
            }?>
        </div>
    </div>
    <div id="main_right">
    	<div id="focus" class="@#$focus_class#@"></div>
        <div class="search" id="invite_search">
            <input type="text" id="invite_input" class="focus" title="邀请网友解答" value="邀请网友解答" />
        </div>
        <div class="clear"></div>
        <div class="side_wrapper">
        	<div class="side_title">热门推荐</div>
        	<php>echo S('side_recommend_question');</php>
        </div>
        <div class="side_wrapper">
        	<div class="side_title">关注该<php>echo $sign;</php>用户(<php>echo count($focus_uid);</php>)</div>
        	<php>
            if($focus_uid==0)
            	{
                	echo '<div id="no_focus_user">暂无用户关注该'.$sign.'</div>';
                }else{
                		foreach($focus_uid as $k=>$v)
                            {
                                echo '<div class="avatar_wrapper avatar_left">
                                     <img src="__PUBLIC__'.get_avatar($v['uid'],'min').'" class="avatar" />
                                     <img src="__PUBLIC__/css/avatar_cover.png" class="avatar_cover" />
                                     <input type="hidden" value="'.$v['uid'].'" class="avatar_hidden" /> 
                                </div>';
                            }
                }
             </php>   
            <div class="clear"></div>
        </div>
        <div class="side_wrapper">
        	<div class="side_title">@#$related_title#@</div>
        	@#$related_question#@
        </div>
        <div class="side_wrapper">
        	<div class="side_title">分享到</div>
        	<!-- Baidu Button BEGIN -->
            <div id="bdshare" class="bdshare_t bds_tools_32 get-codes-bdshare">
            <a class="bds_tsina"></a>
            <a class="bds_qzone"></a>
            <a class="bds_tqq"></a>
            <a class="bds_renren"></a>
            <a class="bds_kaixin001"></a>
            </div>
            <script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=66969" ></script>
            <script type="text/javascript" id="bdshell_js"></script>
            <script type="text/javascript">
            document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
            </script>
            <!-- Baidu Button END -->
        </div>
    </div>
</div>      
<div id="loading_small"></div>
<include file="Global:footer" />