<?php TPL::output('global/header.tpl.htm'); ?>

<div class="tny-basic main tny-clear allbg">
	<div class="tny-left lsidebar">
		<div class="tindex rel cMain bx">
			<h3 class="tny-basicted rel">
                   <div class="q_rightBar abs">
						<?php if ($this->user_id) { ?><a class="btn-blue2<?php if ($this->topic_info['has_focus']) { ?> cur<?php } ?>" href="javascript:" onclick="focus_topic($(this), $(this), <?php echo $this->topic_info['topic_id']; ?>);"><?php if ($this->topic_info['has_focus']) { ?>Un<?php } ?>follow</a><?php } ?><?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?><a onclick="$(this).siblings('.tipis').toggle();" class="q_setBtn" href="javascript:;"></a>
					<div class="tny-data_list abs tipis" style="display: none;">
						<em class="arrows"></em>
						<p class="tny-list_p"><a href="topic/edit/<?php echo $this->topic_info['topic_id']; ?>">Edit topic</a></p>
						<p class="tny-list_p"><a href="topic/manage/<?php echo $this->topic_info['topic_id']; ?>">Manage topic</a></p>
					</div><?php } ?>
					</div><b><?php echo $this->topic_info['topic_title']; ?></b> <?php if ($this->topic_info['topic_lock']) { ?><em class="tny-lock tny-small" title="This topic is locked">Locking</em><?php } ?></h3>
			<p class="txtBreak tny-cl_01 tags_Mark"><?php echo $this->topic_info['topic_description']; ?></p>
			<a class="topicHead abs"><img src="<?php echo get_topic_pic_url('max', $this->topic_info['topic_pic']); ?>" class="tny-radiu5" alt="<?php echo $this->topic_info['topic_title']; ?>" title="<?php echo $this->topic_info['topic_title']; ?>"/></a>
		</div>
		<div class="b_restrain">
		<h3 class="trends-H3 qAll rel content-H3 ">
			<p class="navC abs" id="Elm">
				<a href="javascript:;" id="tny-favorite" style="display:none">My favorite</a>
				<a href="javascript:;">Popular</a>
				<a href="javascript:;">Unanswered</a>
				<a href="javascript:;" class="cur">All questions</a>
			</p>
		</h3>
		
		<div class="flx">
			<div id="Elm_0" class="tny-hide">
				<!--Content fill Cycle-->
				<div class="rel" id="c_favorite_list"></div>
				<!--Content fill Cycle-->
				
				<p id="fav-more"><a class="ajax-more" href="javascript:;" title="See more »">Show More</a></p>
			</div>
			
			<div id="Elm_1" class="tny-hide">
				<!--Content fill Cycle-->
				<div class="rel" id="c_best_question_list"></div>
				<!--Content fill Cycle-->
				
				<p id="io_best_question_more"><a class="ajax-more" href="javascript:;" title="See more »">Show More</a></p>
			</div>
			
			<div id="Elm_2" class="tny-hide">
				<!--Content fill Cycle-->
				<div class="rel" id="c_noanswer_list"></div>
				<!--Content fill Cycle-->
				
				<p id="noanswer-more"><a class="ajax-more" href="javascript:;" title="See more »">Show More</a></p>
			</div>
			
			<div id="Elm_3">
				<!--Content fill Cycle-->
				<div class="rel" id="c_all_list"></div>
				<!--Content fill Cycle-->
				
				<p id="all-more"><a class="ajax-more" href="javascript:;" title="See more »">Show More</a></p>
			</div>
		</div>
        </div>
	</div>

	<div class="rsidebar"> 
		<div class="rightMain">
			<?php TPL::output('topic/related_topics.tpl.htm'); ?>
			
			<?php if (is_array($this->best_answer_users)) { ?>
			<div class="interest-user">
				<h3>Best replier</h3>
				
				<?php foreach ($this->best_answer_users AS $key => $val) { ?>
				<p class="add_ls">
					<a class="addUser" href="people/<?php echo $val['user_info']['url_token']; ?>"><img class="umsg" data-message="&uid=<?php echo $val['user_info']['uid']; ?>&card=user" title="<?php echo $val['user_info']['user_name']; ?>" alt="<?php echo $val['user_info']['user_name']; ?>" src="<?php echo get_avatar_url($val['user_info']['uid'], 'mid'); ?>" /></a>
					<a class="umsg" data-message="&uid=<?php echo $val['user_info']['uid']; ?>&card=user" href="people/<?php echo $val['user_info']['url_token']; ?>"><?php echo $val['user_info']['user_name']; ?></a> <?php if ($this->user_id != $val['uid'] AND $this->user_id) { ?><span class="add-attention<?php if ($val['user_info']['focus']) { ?> cur<?php } ?>" onclick="follow_people($(this), $(this).find('em'), <?php echo $val['user_info']['uid']; ?>);"><em><?php if ($val['user_info']['focus']) { ?>Un<?php } ?>follow</em></span><?php } ?>
					<span class="add_gray">Obtain <b><?php echo $val['agree_count'];?></b> Agree, <b><?php echo $val['thanks_count'];?></b> Thanks again
					</span>
				</p>
				<?php } ?>
			</div>
			<?php } ?>

			<div class="interest-user">
				<h3><a><?php echo $this->topic_info['focus_count']; ?></a>  followed</h3>
				
				<p class="quserList stpd" id="focususers"></p>
			</div>
            <div class="interest-user"><h3 style="cursor:pointer;" class="am_notes" onclick="$.topic.hideTopic(this,$('#topic_listam'));"><em class="x2 tny-small">x</em>Topic modify records</h3>
            	<p class="trecord" id="topic_listam" style="display:none;">			
					<?php if ($this->log_list) { ?>
						<?php foreach ($this->log_list as $key => $val) { ?>
						<span><em class="tny-right"><?php echo $val['add_time']; ?></em><a href="javascript:;" onclick="$.sQuestions({flgs:7,html:(decodeURIComponent('<?php echo rawurlencode('<div style="padding: 10px 0;">' . $val['add_time'] . ': ' .$val['title']) . '</div>'; ?>'))});"><?php echo $val['user_name']; ?></a></span>
						<?php } ?>
					<?php } ?>
				</p>
            </div>
            <div class="interest-user" style="cursor:pointer;" onclick="$.sQuestions({flgs:2,number:0,share_type:'topic',target_id:<?php echo $this->topic_info['topic_id']; ?>});"><h3>Share/Invite friends</h3></div>
            
            <p class="tshare stpd tny-gray">
				<a href="javascript:;" class="w" title="Share to other sites" onclick="$.sQuestions({flgs:2,number:0,share_type:'topic',target_id:<?php echo $this->topic_info['topic_id']; ?>});">External site</a>
				<?php if ($this->user_id){ ?>
					<a href="javascript:;" class="s" title="Private letter to the station way to share or Invite friends to perfect this topic" onclick="$.sQuestions({flgs:2,number:1,share_type:'topic',target_id:<?php echo $this->topic_info['topic_id']; ?>});">Message</a>
				<?php } ?>
			
				<a href="javascript:;" class="y" title="Shared in the form by mail or Invite friends to perfect this topic" onclick="$.sQuestions({flgs:2,number:2,share_type:'topic',target_id:<?php echo $this->topic_info['topic_id']; ?>});">Mail</a>
			</p>
		</div>
	</div>
</div>

<script type="text/javascript">
	var TOPIC_ID = '<?php echo $this->topic_info['topic_id']; ?>';
	var TOPIC_TITLE = '<?php echo $this->topic_info['topic_title']; ?>';
</script>

<script type="text/javascript" src="<?php echo GET_STATIC_URL; ?>/js/app/topic.js"></script>

<?php TPL::output('global/footer.tpl.htm'); ?>