<link href="catalog/template/beststoreitems/css/forums.css" type="text/css" rel="stylesheet">
<link href="catalog/template/beststoreitems/css/page.css" type="text/css" rel="stylesheet">
<div class="my_topics">
	<div class="heading">My Topics<s class="topicsIco"></s></div>
    <div class="my_topocs_box">
    	<table class="comment_table">
            <thead>
                <tr>
                    <th colspan="2" class="col_title">Topics</th>
                    <th class="col_views">Views</th>
                    <th class="col_replies">Replies</th>
                    <th class="col_lastpost col_lastpost2">Last Post</th>
                </tr>
            </thead>
            <tbody>                   
                      
                <?php if(is_array($topic_data)){?>
                <?php foreach($topic_data as $k=>$td){?>
                  <tr <?php if($k%2!=0) echo 'style="background-color: #EFEFF9;"';?>>
                    <td class="col_pic"><a href=""><img width="19" height="22" border="0" src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/common_pic.gif"></a></td>
                    <td class="col_title">
                        <img border="0" alt="sticky" style="vertical-align:text-top" title="sticky" src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/common_pic.png">
                        <a target="_blank" href="index.php?controller=forums&action=topic_threadid&ftid=<?php echo $td['forums_topics_id']?>"><?php echo $td['subject']?></a><br>
                        <span class="date"><b><?php echo $td['cate_name']?> </b> started by: <?php echo $td['author']?>&nbsp;on <?php echo $td['date_added']?></span>
                    </td>
                    <td class="col_views"><?php echo $td['views']?></td>
                    <td class="col_replies"><?php echo $td['reply_times']?></td>
                    <td class="col_lastpost col_lastpost_left">
                        <p><?php echo $td['last_date']?></p>
                        <p class="by_p">by <?php echo $td['last_relier']?></p>
                    </td>
                </tr>       
                <?php }?>
                <?php }?>     
            
                <tr>
                	<td colspan="5" style="padding:0;">
                    	<div class="hei20"></div>
                        <div class="page_wrapper topics_page">
                             <form action="<?php echo $action; ?>" method="post" name="pageform" enctype="multipart/form-data">
						        <input type="hidden" name="page" value="1" />		
							    <script type="text/javascript">		
									 function SelectPage(page)		
									 {
									    document.pageform.page.value = page;
							
									 	document.pageform.submit();
							
										return false;
							
							         };
								</script>
				                 <table width="100%">
				    
							            <tr><td align="left"><?php echo $text_results; ?></td>
							    
							            <td align="right">
							    
							          <table cellspacing="0" cellpadding="0" class="page">
							    
							            <tr>
							    
							            <?php if ($page>1) { ?>
							    
							            <td id="page_box_previous"><a href="#" onclick="return SelectPage(<?php echo ($page-1); ?>);"><?php echo 'Previous'?></a></td>
							    
							            <?php };
							    
							            foreach ($pages as $pageentry) {   
							    
							                    if ( $pageentry['value'] > ($page + max(9-$page,4)) ) {?>
							    
							                               <td id="page_box_next"><a href="#" onclick="return SelectPage(<?php echo ($page+1); ?>);"><?php echo 'Next'?></a></td>
							    
							                    <?php 
							    
							                         break;
							    
							                     } ;
							    
							                    
							    
							                    if ( $pageentry['value'] < ($page - 4) ) {continue; }
							    
							                    ?>
							    
							                                              
							    
							                    <?php if ($pageentry['value'] == $page) { ?>
							    
							                    <td width="20" height="16" align="center" valign="middle"><b class="current_i"><font size="1"><?php $x = explode(" ",$pageentry['text']);echo $x[0]; ?></font></b></td>
							    
							                    <?php } else { ?>
							    
							                    <td id="page_box" >
							    
							                    <a href="#" onclick="return SelectPage(<?php echo $pageentry['value']; ?>);"><?php $x = explode(" ",$pageentry['text']);echo $x[0]; ?></a></td>
							    
							                    <?php } ?>   
							    
							            <?php } ?>
							            <td>Go to Page         
							                <select onchange="return SelectPage(this.value)" style="width:50px;">
							                    <?php foreach ($pages as $pageentry){?>
							                        <option value="<?php echo $pageentry['value']?>" <?php if ($pageentry['value'] == $page){echo 'selected';}?>><?php echo $pageentry['value']?></option>
							                    <?php };?>
							                </select>
							            </td>
							          </tr></table>
							    
							    </td></tr></table>
							    </form>    
                         </div>
                    </td>
                </tr>
              </tbody>
            </table>
    </div>
</div>