<script>
function submitform(start,limit)
{
	document.searchfrm.act.value=document.location.href;
	document.getElementById("start").value=start;
	document.getElementById("limit").value=limit;
		
	//document.searchfrm.action = u;
	
	document.searchfrm.submit();
}
function gotolink(u,download_id)
{
	document.searchfrm.act.value=document.location.href;
	document.getElementById("download_id").value=download_id;
	document.searchfrm.action = u;
	
	document.searchfrm.submit();
}
</script>
<form name="searchfrm" id="searchfrm" action="<?php echo $page_name?>" method="post" target="_parent">
<input type="hidden" name="start" id="start" value="<?=$_REQUEST["start"]?>" />
<input type="hidden" name="limit" id="limit" value="<?=$_REQUEST["limit"]?>" />
<input type="hidden" name="act" id="act" value="" />
<input type="hidden" name="download_id" id="download_id" value="" />
 <div style="padding-top:100px;">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" class="breadcrumb"><a href="index.php" class="bnav">Home</a> &raquo; Downloads</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td><h3>Downloads</h3></td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="table table-bordered table-striped">
                  <tr>
                    <td width="8%" height="28" align="center"><strong>Sr. No.</strong></td>
                    <td width="67%"><strong>Title</strong></td>
                    <td width="12%" align="center"><strong>Files</strong></td>
                  </tr>
				  <?php
				  $i=1;
				  foreach($downlist as $down){
				  if($down->down_count!=0){
				  ?>
                  <tr>
                    <td align="center" valign="top"><?php echo $i+$_REQUEST["start"];?>.</td>
                    <td valign="top"><a href="#" onclick="gotolink('downlist','<?php echo $down->id;?>')"><?php echo $down->catname?>. </a></td>
                    <td align="center" valign="middle">(<?php echo $down->down_count?>)</td>
                  </tr>
				  <?php 
				  }
				  $i++;
				  }?>
                  
                  <tr><td colspan="5">
	  <table width="100%">
			 <tr>
			  		<td align="center" valign="top">
                    	<a href="#" onclick="submitform('0','<?php echo $_REQUEST['limit']?>')" >First</a>
                    </td>
                    <td  align="center" valign="top">
						<?php //print_r($_POST);
                        if($_REQUEST["back"] >=0){
                        ?>
                        <a href="#" onclick="submitform('<?php echo $_REQUEST["back"]?>','<?php echo $_REQUEST['limit'] ?>')">Prev</a>
                        <?php
                        }
                        ?>
                    </td>
                    <td align="center" valign="top"><strong>Pages </strong>
                    <?php								  
						$l=1;
						$lastPage = ceil($_REQUEST["nume"]/($_REQUEST["limit"]));
						for($i=0;$i < $_REQUEST["nume"];$i=$i+$_REQUEST["limit"]){
						if($i <> $_REQUEST["eu"]){
							if($l == $lastPage){
								$lastPageLink = "'".$i."','".$_REQUEST['limit']."'";
							}
						?>
						<a href="#" onclick="submitform('<?php echo $i?>','<?php echo $_REQUEST['limit']?>')"><?php echo $l; ?></a>
					<?php
						}
						else { 
								if($l == $lastPage){
									$lastPageLink = "#";
								}
						?>
							<span class="paging_pages_cur"><a href="#" class="selected" alt="<?php echo SEO_ENCHOR_ALT; ?>" title="<?php echo SEO_ENCHOR_TITLE; ?>"><?php echo $l; ?></a></span>
							<?php
								}       
							$l=$l+1;
							} 
					  ?>                  </td>
                    <td align="center" valign="top">
						<?php  
						if($_REQUEST["th"] < $_REQUEST["nume"]) { 	
                        ?>
                      		<a href="#" onclick="submitform('<?php echo $_REQUEST["next"]?>','<?php echo $_REQUEST['limit']?>')">Next</a>
                        <?php
						}
						?>
                    </td>
                    <td align="center" valign="top"><a class="onav" href="#" onclick="submitform('<?php echo $lastPageLink; ?>')">Last</a></td>
                </tr>
			 </table>
			 </td></tr>
                </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td align="center">&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td align="center">&nbsp;</td>
              </tr>
              </table>
</form>