<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>

<?PHP
if ($_POST[limit] != $nil)
        $_SESSION['limit'] = $_POST['limit'];
if ($_SESSION[limit] == $nil)
        $_SESSION['limit'] = 10;
?>


<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td class="td4"><span class="link5"> 
<?php category_header($_GET[category],home,browse,category,$rowxxx[MR]); ?>
</span></td>
</tr>
</table><br>
<hr>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"> 
<td width="100%"> 
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<?php
//-------------------------
if ($rowxxx['SORT'] == 'Alphabetical')
        $rowxxx['SORT'] = 'ORDER BY HEADER ASC';
if ($rowxxx['SORT'] == 'Newest First')
        $rowxxx['SORT'] = 'ORDER BY ID DESC';
if ($rowxxx['SORT'] == 'Oldest First')
        $rowxxx['SORT'] = 'ORDER BY ID ASC';

$sort = $rowxxx['SORT'];

$table = "PAGES";
$string = "WHERE CATEGORY LIKE '%-$_GET[category]-%' AND STATUS = 'Active'";

$swap = "&page=$_GET[page]&category=$_GET[category]";

//-------------------------------------------------------------------------------------------

$query1 = mysql_query ("SELECT * FROM $table $string $sort");
$numrows= mysql_num_rows ($query1);

if (!isset ($_GET['show'])) {
        $display = 1;
} else {
        $display = $_GET['show'];
}

$start  = (($display * $_SESSION['limit']) - $_SESSION['limit']);

$query2 = mysql_query ("SELECT * FROM $table $string $sort LIMIT $start,$_SESSION[limit]");
while ($row = mysql_fetch_array ($query2)) {

        include "browse_display.php";


}
//-------------------------------------------------------------------------------------------
?>
</table>
</td>
</tr>
</table>
<?php if ($numrows == '0') { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td class="td4">No articles found in this category.</td>
</tr>
</table>
<?php if (empty($_GET[category])) include 'home.php'; ?>
<?PHP } else { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form action="?show=1&amp;page=browse&amp;category=<?php echo $_GET[category]; ?>&amp;mode=<?php echo $_GET[mode]; ?>" method="post" name="form" id="form">
<tr> 
<td class="font3" align="right"> 
<input type="submit" name="Submit" value="Show" />
<select name="limit">
<option selected> 
<?php echo $_SESSION['limit']; ?>
</option>
<option>1</option>
<option>5</option>
<option>10</option>
<option>20</option>
<option>30</option>
<option>50</option>
<option>100</option>
</select>
Articles per 
<?php include "pagination_bot.php"; ?>
</td>
</form>
</table>
<?PHP } ?>
