<?php if ($this->list) { ?>
<?php if ($_GET['page'] == 0 AND count($this->list) > 0) { ?>
<a class="main_latest" href="javascript:;" onclick="reload_list(0);" title="Click to view »" id="new_actions_tip" style="display:none;"><span id="new_action_num"></span> The new dynamic, click on View</a> 

<script type="text/javascript">
	if (typeof checkactionsnew_handle != 'undefined')
	{
		clearInterval(checkactionsnew_handle);
	}
	
	checkactionsnew_handle = setInterval(function () {
		check_actions_new('0', '<?php echo time(); ?>');
	}, 60000);
</script>
<?php } ?>
<?php foreach ($this->list AS $key => $val) { ?>
<!--Content Module START-->
<div class="smodule">
 <!--User avatar--> 
  <?php if ($val['anonymous'] == 0) { ?><a class="suser tny-alpHover" href="people/<?php echo $val['user_info']['url_token']; ?>"><img src="<?php echo get_avatar_url($val['user_info']['uid'], 'mid'); ?>" alt="<?php echo $val['user_info']['user_name']; ?>"  class="umsg" data-message="&uid=<?php echo $val['user_info']['uid']; ?>&card=user" /></a><?php } else { ?><a href="javascript:;" class="suser alpHover"><img src="<?php echo GET_STATIC_URL; ?>/common/avatar-mid-img.jpg" alt="Anonymous" title="Anonymous" /></a><?php } ?>
    
  <h4><a class="blank_link" href="question/<?php echo $val['question_id']; ?>#reply<?php echo $val['answer_count']; ?>"><?php echo $val['question_content']; ?></a></h4>
  <p class="s_ctrl">
  	<?php if ($val['last_action_str']) { ?><?php echo $val['last_action_str']; ?> • <?php echo date_friendly($val['add_time']); ?> • <?php } ?><span class="tny-gray"><a  href="question/<?php echo $val['question_id']; ?>#reply<?php echo $val['answer_count']; ?>"><?php echo $val['answer_count']; ?> Replies</a> • <a href="javscript:;" class="gxz_b<?php if ($val['has_focus']) { ?> cur<?php } ?>" onclick="focus_question($(this), $(this), <?php echo $val['question_id']; ?>); return false;"><?php if ($val['has_focus']) { ?>Un<?php } ?>follow</a><?php if ($_GET['filter'] == 'focus') { ?> • <?php if ($val['topics']) { ?> Added to <?php foreach($val['topics'] as $t_key => $t_val) { if ($t_key > 2) { break; } ?><a href="topic/<?php echo $t_val['url_token']; ?>" class="umsg" data-message="&uid=<?php echo $t_val['topic_id']; ?>&card=topic"><?php echo $t_val['topic_title']; ?></a> <?php } ?><?php if (sizeof($val['topics']) > 3) { ?> Wait <?php echo sizeof($val['topics']); ?> <?php } ?>Topic<?php } else { ?><a href="question/<?php echo $val['question_id']; ?>">Add topic</a><?php } ?></p><?php } else { ?> • <a href="javascript:;" onClick="question_uninterested($(this).parents('div.smodule'), <?php echo $val['question_id']; ?>)">Not interested</a><?php } ?></span>
  </p>
 	
 	<!-- Reply START-->
	<?php if ($val['associate_action'] == ACTION_LOG::ANSWER_QUESTION OR $val['associate_action'] == ACTION_LOG::ADD_AGREE) { ?>
    <div class="s-txt rel">
    	<p class="sendorsepeople tny-gray tny-cl_02 tny-hide"> 
            <span class="g_txt">Agree from:</span> 
            <?php if ($val['answer_info']['agree_users']) { ?>
				<?php $count = 0;
				foreach ($val['answer_info']['agree_users'] as $uid => $user) { ?>
					<a href="people/<?php echo $user['url_token']; ?>" data-id="<?php echo $uid;?>" class="a umsg" data-message="&uid=<?php echo $uid;?>&card=user" name="agee_people"><?php echo $user['user_name']; ?></a><?php if (count($val['answer_info']['agree_users'])!= ++$count) { ?><em>, </em><?php } ?>
				<?php } ?>
			<?php } ?>
           <!-- <a class="v_more " href="javascript:;">More »</a>-->
        </p>
	    
	   
	      	<div id="detail_<?php echo $val['history_id']; ?>" class="tny-cl_01">
	      		<?php if ($val['answer_info']['uid'] != $val['user_info']['uid']) { ?>
	      		<p class="s_autograph tny-txtHide"><a href="people/<?php echo $val['answer_info']['url_token']; ?>"><?php echo $val['answer_info']['user_name']; ?></a><?php if ($val['answer_info']['signature']) { ?> - <?php echo $val['answer_info']['signature']; ?><?php } ?></p>
	      		<?php } ?>
	      		<div class="tags_Mark tny-cl_01 lineHeight">
	      		<?php echo nl2br(utf8_substr($val['answer_info']['answer_content'], 0, 130, 'UTF-8', '...')); ?>
	      		<?php if (utf8_strlen($val['answer_info']['answer_content']) > 130) { ?>
	        	<a href="javascript:;" class="showMore" onclick="content_switcher($('#detail_<?php echo $val['history_id']; ?>'), $('#detail_more_<?php echo $val['history_id']; ?>'));">Display all »</a>
	        	<?php } ?>
	        	</div>
				<?php if ($val['answer_info']['attachs']) { ?>
					<div class="q_con_imgs tny-alpHover" style="padding-top:6px;">
					  <?php foreach($val['answer_info']['attachs'] AS $t_key => $t_val) { ?>
					  <?php if ($t_val['is_image']): ?>
					  <a href="javascript:;" onclick="content_switcher($('#detail_<?php echo $val['history_id']; ?>'), $('#detail_more_<?php echo $val['history_id']; ?>')); return false;"><img src="<?php echo $t_val[thumb]; ?>" alt="" /></a>
					  <?php else: ?>
					  <p class="questionacc"><a href="<?php echo download_url($t_val['file_name'], $t_val['attachment']); ?>" class="tny-txtHide"><em class="q_ico"></em><?php echo $t_val['file_name']; ?></a></p>
					  <?php endif; ?>
					  <?php } ?>
					</div>
				<?php } ?>
				<!-- Display attachment thumbnail END-->
				
	        </div>
	   
	    <div class="tny-cl_01 " style="display:none" id="detail_more_<?php echo $val['history_id']; ?>">
	    	<?php if ($val['answer_info']['uid'] != $val['user_info']['uid']) { ?>
	    	<p class="s_autograph tny-txtHide"><a href="people/<?php echo $val['answer_info']['url_token']; ?>"><?php echo $val['answer_info']['user_name']; ?></a><?php if ($val['answer_info']['signature']) { ?> - <?php echo $val['answer_info']['signature']; ?><?php } ?></p>
	    	<?php } ?>
	    	<div class="tags_Mark tny-cl_01 lineHeight">
		    <?php echo nl2br($val['answer_info']['answer_content']); ?>
		    
			<!-- Attachments to enlarge(Reply to question) -->
			<?php if ($val['answer_info']['attachs']) { ?>
				<div class="picTrueD">
					<div class="aScue listPicTrueBig">
					<?php foreach($val['answer_info']['attachs'] AS $t_key => $t_val) { ?>
					<?php if ($t_val['is_image']): ?>
					<a href="<?php echo $t_val['attachment']; ?>" target="lightbox" data-fancybox-group="thumb" rel="lightbox"><img src="<?php echo $t_val['attachment']; ?>" alt="" /></a>
					<?php else: ?>
					<p><a href="<?php echo download_url($t_val['file_name'], $t_val['attachment']); ?>" class="file_ico"><?php echo $t_val['file_name']; ?></a></p>
					<?php endif; ?>
					<?php } ?>
					</div>
				</div>
			<?php } ?>
			<!-- Attachments to enlarge(Reply to question) END-->
            </div>
		</div>
		    		
		<div class="questionElm">
			<a class="q_criticism" href="question/<?php echo $val['question_id']; ?>#comments_<?php echo $val['answer_info']['comment_count']; ?>" onclick="toggle_comments(<?php echo $val['answer_info']['answer_id']; ?>, 'answer',this,$.Q.reCallarrows); return false;"><?php echo $val['answer_info']['comment_count']; ?> Reviews</a>
	
			<span class="q_participate rel">
				<a href="javascript:;" class="q_pate">Share</a>
				<div class="tny-data_list abs">
					
					<em class="arrows"></em>
					
					<p class="tny-list_p">
						<a href="javascript:;" data-uid="0" class="q_wb" onClick="$.sQuestions({flgs:2,number:0,share_type:'answer',target_id:<?php echo $val['answer_info']['answer_id']; ?>});">External site</a>
					</p>
					<?php if($this->user_id){ ?>
						<p class="tny-list_p">
							<a href="javascript:;" data-uid="1" class="q_letter" onClick="$.sQuestions({flgs:2,number:1,share_type:'answer',target_id:<?php echo $val['answer_info']['answer_id']; ?>});">Message</a>
						</p>
					<?php } ?>
					<p class="tny-list_p">
						<a href="javascript:;" data-uid="2" class="q_maill" onClick="$.sQuestions({flgs:2,number:2,share_type:'answer',target_id:<?php echo $val['answer_info']['answer_id']; ?>});">Mail</a>
					</p>
				</div>
			</span>
		</div>
		<!--Comments START-->
        <div class="commentElm rel" id="answer_comments_<?php echo $val['answer_info']['answer_id']; ?>" style="display:none">
        	<em class="arrows"></em>
	        <div name="comments_list"></div>
            <!--Comment box START-->
            <?php if ($this->user_id) { ?>
            <div id="save_answer_comment_<?php echo $val['answer_info']['answer_id']; ?>">
            <form action="question/ajax/save_answer_comment/answer_id-<?php echo $val['answer_info']['answer_id']; ?>" method="post">
            <div class="tny-Mits tny-subBg">
            	<textarea class="textArea" name="message" onFocus="$.focus(this,'Post a comment...',$.Q.txtarea(this));">Post a comment...</textarea>
                <div class="subiv tny-hide"><a href="javascript:;">Cancel</a><a href="javascript:;" onclick="save_comment(this);" class="btn-gray2 ">Comment</a></div>
            </div>
            </form>
            </div>
            <?php } else { ?>
			<p style="padding:10px;">To participate in a question first <a href="account/login/">Login</a> or <a href="account/register/">Sign up</a></p>
			<?php } ?>
            <!--Comment box END-->
        </div>
        <!--Comments END-->
        
		<a class="sendorse abs" href="javascript:;" onClick="$.I.click_eve({flg:this,appNum:<?php echo $val['answer_info']['agree_count']; ?>,uid:GET_USER_ID,username:GET_USER_NAME,ready:<?php echo $val['answer_info']['agree_status']; ?>,answer_id:<?php echo $val['answer_info']['answer_id']; ?>});"><?php echo $val['answer_info']['agree_count']; ?></a>
        <!--flg:Itself, appNum:Agree number, uid: id corresponding with Username ,username: Username, ready: whether praise or opposed the issue{1: Agree as before,-1: has opposed, and 0: No operation is not over} -->
    </div>
	<?php } ?>
	<!-- Reply-END--> 	
</div>
<!--Content Module END--> 
<?php } ?>
<?php if (sizeof($this->list) > 0) { ?>
<script type="text/javascript">
(function($){
	$('.blank_link').each(function(f) {
		var flg = $(this);
		flg.parent().find('a[class^="alink"]').length == 0 ?
        $('<a/>')
		.addClass('alink tny-small')
		.attr('title','Open a new window')
		.attr('href',flg.attr('href'))
		.attr('target','_blank')
		.insertAfter(flg) :''; 
    });
})(jQuery);
</script>
<?php } ?>
<?php } ?>