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

<div class="sort">
	<div class="newsort">
		<span class="pic"></span><?php if ($this->category_info) { ?><?php echo $this->category_info['title']; ?><?php } else if ($this->feature_info) { ?><?php echo $this->feature_info['title']; ?><?php } else { ?>All Issues<?php } ?>

<?php if($this->content_category){ ?>
        <div class="sort_c"><div class="btn">&nbsp;&nbsp;Classification</div>
         <div class="picsort">
    	<ul><a href="mobile/explore/"><div  class="sort_all">All questions</div></a>
    	    <?php foreach ($this->content_category as $key => $val) { ?>
    	    	<a href="mobile/explore/category-<?php echo $val['id']; ?>"><li<?php if ($_GET['category'] AND ($val['id'] == $this->category_info['id'] OR $this->category_info['parent_id'] == $val['id'])) { ?> class="cur"<?php } ?>><img src="<?php echo $val['icon']; ?>" title="<?php echo $val['title']; ?>" alt="" width="25" height="25" /> <?php echo $val['title']; ?></li></a>
    	    <?php } ?>
        </ul>
        <div style="clear:both;"></div>
    </div>
                     
        </div>
<?php } ?>

	</div>
    
    <?php if ($this->content_category) { ?>
   
    <?php } ?>
    
    <div class="sort_class"  >
    	<div style=" text-align:center;">    		
    		<a href="mobile/explore/sort_type-new__<?php if ($_GET['category']) { ?>__category-<?php echo $_GET['category']; ?><?php } ?>" <?php if (!$_GET['sort_type'] OR $_GET['sort_type'] == 'new') { ?> class="cur"<?php } ?>>Latest</a> • 
    		<a href="mobile/explore/sort_type-hot____day-7<?php if ($_GET['category']) { ?>__category-<?php echo $_GET['category']; ?><?php } ?>" id="sort_control_hot" <?php if ($_GET['sort_type'] == 'hot') { ?> class="cur"<?php } ?>>Hot</a> • <a href="mobile/explore/sort_type-unresponsive__<?php if ($_GET['category']) { ?>__category-<?php echo $_GET['category']; ?><?php } ?>" <?php if ($_GET['sort_type'] == 'unresponsive') { ?> class="cur"<?php } ?>>Unanswered</a>
            
    	</div>
    	
    </div>
 
    
    <div class="con"  style="border-top:#E6E6E6 1px solid; ">
    	<ul id="question_list">
	    	<?php echo $this->question_list_bit; ?>
	    </ul>
    	
	    <div class="more" id="mobile_more">More</div>
    </div>
</div>

<script type="text/javascript">
var cur_day = 30;
var cur_sort_type = 'new';
var cur_category_id = '';
var cur_load_page = 1;

function reloadSortList(el, sort_type, category_id, day)
{
	if (category_id)
	{
		cur_category_id = category_id;
	}
	
	if (sort_type)
	{
		cur_page = 0;
		cur_load_page = 0;
		cur_sort_type = sort_type;
		
		$('#sort_control a').removeClass();
		
		if (sort_type == 'hot')
		{
			$('#sort_control_hot').addClass('cur');
		}
	}
	
	cur_day = 0;
	
	if (day)
	{
		cur_day = day;
	}
	
	if (el)
	{
		$(el).addClass('cur');
	}
	
	mobile_more_load(GET_BASE_URL + '/question/ajax/discuss/template-mobile__sort_type-' + cur_sort_type + '__category-' + cur_category_id + '__day-' + cur_day, $('#mobile_more'), $('#question_list'), 1);
}

$(document).ready(function()
{
	if ($('#question_list').html() == '')
	{
		$('#question_list').html('<p style="padding: 15px 0" align="center">No Content</p>');
		$('#mobile_more').addClass('disabled');
		$('#mobile_more').html('No more');
	}
	
	mobile_more_load(GET_BASE_URL + '/question/ajax/discuss/template-mobile__sort_type-' + cur_sort_type + '__category-' + cur_category_id + '__day-' + cur_day, $('#mobile_more'), $('#question_list'), 1);
});
</script>

<?php if ($_GET['sort_type']) { ?>
<script type="text/javascript">cur_sort_type = '<?php echo $_GET['sort_type']; ?>';</script>
<?php } ?>
<?php if ($_GET['day']) { ?>
<script type="text/javascript">cur_day = <?php echo intval($_GET['day']); ?>;</script>
<?php } ?>
<?php if ($_GET['category']) { ?>
<script type="text/javascript">cur_category_id = <?php echo intval($_GET['category']); ?>;</script>
<?php } ?>

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