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

<div class="contents">
	<div style=" margin:14px 12px;">
		<?php if ($this->question_info['category_info']['title']) { ?>
		<div class=" triangle-left"></div>
		<a href="mobile/explore/category-<?php echo $this->question_info['category_info']['id']; ?>">
		<div class="sort"><?php echo $this->question_info['category_info']['title']; ?></div>
		</a>
		<?php } ?>
		<?php foreach($this->question_topics as $key => $val) { ?>
		<a href="mobile/topic/<?php echo $val['url_token']; ?>" class="tag" style="margin-top:3px;"><?php echo $val['topic_title']; ?></span></a>
		<?php } ?>
		<div class="c"></div>
	</div>
	<div class="que">
		<div class="">
			<?php if ($this->question_info['anonymous'] == 0) { ?>
			<a href="mobile/people/<?php echo $this->question_info['user_info']['url_token']; ?>"><img class="photo" src="<?php echo get_avatar_url($this->question_info['published_uid'], 'mid'); ?>" / width="25" height="25"></a>
			<?php } ?>
			<font style="font-weight:bold;"><?php echo $this->question_info['question_content']; ?></font>
		</div>
		<div class="con"><?php echo $this->question_info['question_detail']; ?>
			<div >
				<?php if ($this->user_id != $this->question_info['published_uid'] AND $this->user_id) { ?>
				<div class="sub<?php if ($this->question_focus) { ?> cur<?php } ?>" onclick="focus_question($(this), $(this), <?php echo $this->question_info['question_id']; ?>);">
					<?php if ($this->question_focus) { ?>Un<?php } ?>follow</div>
				<?php } ?>
				<div class="time"><?php echo date_friendly($this->question_info['add_time']); ?>&nbsp;&nbsp;<span class="review" onclick="mobile_comments(<?php echo $this->question_info['question_id']; ?>, 'question', $(this)); return false;"><?php echo $this->question_info['comment_count']; ?>Reviews</span> 
				</div>
				
				<div class="reply" id="question_comments_<?php echo $this->question_info['question_id']; ?>" style="display:none">
				
				<form action="question/ajax/save_question_comment/question_id-<?php echo $this->question_info['question_id']; ?>" onsubmit="return false;" method="post">
				<div name="comments_list"></div>
       	         <?php if ($this->user_id) { ?>
					<div class="myreply">
							<div style="margin-right:22px;">
								<input class="mainre" type="text" name="message" style="font-size:14px;"  placeholder="Enter Comments" />
							</div>
							<div class="resub" style="  margin-bottom:12px;" onclick="mobile_ajax_post($(this).parents('div.reply').find('form'), _comments_form_processer); $(this).parents('div.reply').find('form [name=message]').val('');">Confirm</div>
							
						</div>
				<?php } ?>
				</form>
				</div>
				
			</div>
		</div>
	</div>
	<div class="re">
		<div class="head">
			<?php if ($this->user_id AND $_GET['column'] != 'log') { ?>
			<div style="float:right;">
				<a href="mobile/question/id-<?php echo $this->question_id; ?>__sort_key-agree_count"<?php if ((!$_GET['uid'] && !$_GET['sort_key']) || $_GET['sort_key'] == 'agree_count') { ?> class="cur"<?php } ?>>By votes</a>
				•
				<a href="mobile/question/id-<?php echo $this->question_id; ?>__sort_key-add_time"<?php if ($_GET['sort_key'] == 'add_time') { ?> class="cur"<?php } ?>>By time</a>
			</div>
			<?php } ?>
			<?php echo $this->answer_count; ?> Replies </div>
		<?php if ($this->answers) { foreach ($this->answers AS $key => $val) { ?>
		<div class="answer<?php if ($this->question_info['best_answer'] == $val['answer_id']) { ?> ba<?php } ?>">
			<?php if ($this->question_info['best_answer'] == $val['answer_id']) { ?>
			<div class="best_p">Best Answer</div>
			<?php } ?>
			<!--<div class="vote">
				<?php if ($this->user_id AND $this->user_id != $val['uid']) { ?>
				<a name="<?php echo $val['answer_id']; ?>" status="<?php echo $val['agree_status']; ?>"></a>
				<a data-id="<?php echo $val['answer_id']; ?>" onclick="$.I.addCast(this, GET_USER_NAME, '<?php echo $val['answer_id']; ?>')" href="javascript:;" class="s_zt rel<?php if ($val['agree_status'] == '1') { ?> s_cur_z<?php } ?>">
				<div class="good" >
					<div class="up">&nbsp;</div>
				</div>
				</a>
				<div class="num" ><span name="agree_num" class="agree_num"><?php echo $val['agree_count']; ?></span>
				</div>
				<a  onclick="$.I.oppCast(this,GET_USER_NAME,'<?php echo $val['answer_id']; ?>')" href="javascript:;" class="s_fd rel<?php if ($val['agree_status'] == '-1') { ?> s_cur_f<?php } ?>">
				<div class="good" >
					<div class="down">&nbsp;</div>
				</div>
				</a>
				<?php } else { ?>
				<a name="<?php echo $val['answer_id']; ?>" status="<?php echo $val['agree_status']; ?>"></a>
				<a class="default_num defa_agree prohibit_up" href="javascript:;">
				<div class="nologin" >
					<div class="up">&nbsp;</div>
				</div>
				</a>
				<div class="num" ><span name="agree_num" class="agree_num"><?php echo $val['agree_count']; ?></span>
				</div>
				<a class="default_num defa_oppose prohibit_down " href="javascript:;">
				<div class="nologin" >
					<div class="down">&nbsp;</div>
				</div>
				</a>
				<?php } ?>
			</div>-->
			<div class=" txt">
				<div  style=" " >
					<?php if ($val['anonymous']) { ?>
					<span class="name">Anonymous</span>
					<?php } else { ?>
					<a href="mobile/people/<?php echo $val['url_token']; ?>"><span class="name"><?php echo $val['user_name']; ?></span></a>
					<span class="time">
					<?php if ($val['signature']) { ?>
					, <?php echo $val['signature']; ?>
					<?php } ?>
					</span>
					<?php } ?>
				</div>
				<div class="mt" ><?php echo FORMAT::parse_attachs($val['answer_content']); ?></div>
				<div class="time"   ><?php echo date_friendly($val['add_time']); ?>
					<?php if ($this->user_id){ ?>
					• <span class="review" onclick="mobile_comments(<?php echo $val['answer_id']; ?>, 'answer', $(this)); return false;"><?php echo $val['comment_count']; ?> Reviews</span>
					<?php if ($this->user_id != $val['uid']) { ?>
					 • <span<?php if (!$val['user_rated_thanks']) { ?> onclick="answer_user_rate(<?php echo $val['answer_id'];?>, 'thanks', this);"<?php } ?>>
					<?php if ($val['user_rated_thanks']) { ?>Have<?php } ?>Thank</span>
					 • <span onclick="answer_user_rate(<?php echo $val['answer_id'];?>, 'uninterested', this);">
					<?php if ($val['user_rated_uninterested']) { ?>Unfold<?php } ?>No help</span><?php } ?>
				</div>
				
				<div class="reply" id="answer_comments_<?php echo $val['answer_id']; ?>" style="display:none">
				
				<form action="question/ajax/save_answer_comment/answer_id-<?php echo $val['answer_id']; ?>" onsubmit="return false;" method="post">
				<div name="comments_list"></div>
       	         <?php if ($this->user_id) { ?>
					<div class="myreply">
							<div style="margin-right:22px;">
								<input class="mainre" type="text" name="message" style="font-size:14px;"  placeholder="Enter Comments" />
							</div>
							<div class="resub" style="margin-bottom:12px;" onclick="mobile_ajax_post($(this).parents('div.reply').find('form'), _comments_form_processer); $(this).parents('div.reply').find('form [name=message]').val('');">Confirm</div>
						
						</div>
				<?php } ?>
				<?php } ?>
				</form>
				</div>
				
				
			</div>
			<div style="clear:both;"></div>
		</div>
        
		<?php } ?>
        <?php echo $this->pagination; ?>
		<?php } ?>
		<div class="myanswer">
			<?php if (!$this->user_id) { ?>
			<p align="center">To see all questions and participation, please
				<a href="mobile/login/">Login</a>
				</a>
			</p>
			<?php } else if ($this->user_answered) { ?>
			<p align="center">One question can only be replied once</p>
			<?php } else if ((get_setting('answer_self_question') == "N") && ($this->user_id == $this->question_info['published_uid'])) { ?>
			<p align="center">Can not reply to questions posted by themselves</p>
			<?php } else { ?>
			<form action="question/ajax/save_answer/" onsubmit="return false;" method="post" id="answer_form">
				<input type="hidden" name="post_hash" value="<?php echo new_post_hash(); ?>" />
				<input type="hidden" name="question_id" value="<?php echo $this->question_id; ?>" />
				<input type="hidden" name="is_mobile" value="true" />
				<div style="padding:12px; margin-right: 12px;">
					<textarea class="txt" style="font-size:14px;" id="answer_content" onKeyPress="default_Search.txtEvent('#question_submit2',event);" class="answer_content" type="text" name="answer_content" />
					</textarea>
				</div>
				<?php if ($this->human_valid) { ?>
				<div class="code">
					<div class="default_aotoNum l"><img id="captcha" onclick="this.src = GET_BASE_URL + '/account/captcha/rnd-' + Math.floor(Math.random() * 10000);" title="Click change to another one" src="" /></div>
					<script type="text/javascript">$(document).ready(function () { $('#captcha').click(); });</script>
					<input  type="text" class="default_autoCode" name="seccode_verify">
					&nbsp;
					<div style="clear:both;"></div>
				</div>
				<?php } ?>
				<div class="wrong" id="tip_error_message" style="display:none; float:none;"></div>
				<?php if (get_setting('anonymous_enable') == 'Y') { ?>
				<label class="anonymous" >
				<input type="checkbox" name="anonymous" value="1" />
				Delete question</label>
				<?php } ?>
				<div class="sub" onclick="mobile_ajax_post($('#answer_form'), _mobile_tips_form_processer); return false;" id="question_submit2">Confirm</div>
				<div style="clear:both;"></div>
			</form>
			<?php } ?>
		</div>
	</div>
</div>
</div>
<script type="text/javascript">
<?php if ($this->redirect_message) { ?>
$(document).ready(function () {
	<?php foreach ($this->redirect_message AS $key => $message) { ?>
		mobile_header_message('<?php echo $message; ?>');
	<?php } ?>
});
<?php } ?>
</script>
<?php TPL::output('mobile/footer.tpl.htm'); ?>
