<?php require_once('Connections/JCH_Sql.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_RSClient = 20;
$pageNum_RSClient = 0;
if (isset($_GET['pageNum_RSClient'])) {
  $pageNum_RSClient = $_GET['pageNum_RSClient'];
}
$startRow_RSClient = $pageNum_RSClient * $maxRows_RSClient;

mysql_select_db($database_JCH_Sql, $JCH_Sql);
$query_RSClient = "SELECT * FROM Clients WHERE Status = 'Available' ORDER BY Name ASC";
$query_limit_RSClient = sprintf("%s LIMIT %d, %d", $query_RSClient, $startRow_RSClient, $maxRows_RSClient);
$RSClient = mysql_query($query_limit_RSClient, $JCH_Sql) or die(mysql_error());
$row_RSClient = mysql_fetch_assoc($RSClient);

if (isset($_GET['totalRows_RSClient'])) {
  $totalRows_RSClient = $_GET['totalRows_RSClient'];
} else {
  $all_RSClient = mysql_query($query_RSClient);
  $totalRows_RSClient = mysql_num_rows($all_RSClient);
}
$totalPages_RSClient = ceil($totalRows_RSClient/$maxRows_RSClient)-1;

$queryString_RSClient = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_RSClient") == false && 
        stristr($param, "totalRows_RSClient") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_RSClient = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_RSClient = sprintf("&totalRows_RSClient=%d%s", $totalRows_RSClient, $queryString_RSClient);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>J C H O N L I N E | Our Clients</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
<script type="text/javascript" language="JavaScript1.2" src="stm31.js"></script>
<link href="Images/style.css" rel="stylesheet" type="text/css">

</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table width="750" height="" border="0" align="center" cellpadding="0" cellspacing="0"><!--DWLayoutTable-->

<tr>
	<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center"><p class="SmallTitle2">Our current clients </p>
            <table width="70%" border="0" align="center">
              <tr>
                <td class="Header1">Name</td>
                <td class="Header1">City</td>
                <td class="Header1">Country</td>
              </tr>
              <?php do { ?>
              <tr>
                <td valign="top" class="default"><a href="<?php echo $row_RSClient['Web_URL']; ?>" target="_blank"><?php echo $row_RSClient['Name']; ?></a></td>
                <td valign="top" class="default"><?php echo $row_RSClient['City']; ?></td>
                <td height="20" valign="top" class="default"><?php echo $row_RSClient['Country']; ?></td>
              </tr>
              <?php } while ($row_RSClient = mysql_fetch_assoc($RSClient)); ?>
            </table>
          <p align="center" class="default"> Records <?php echo ($startRow_RSClient + 1) ?> to <?php echo min($startRow_RSClient + $maxRows_RSClient, $totalRows_RSClient) ?> of <?php echo $totalRows_RSClient ?>
            <table border="0" width="50%" align="center">
              <tr>
                <td width="23%" align="center"><?php if ($pageNum_RSClient > 0) { // Show if not first page ?>
                    <a href="<?php printf("%s?pageNum_RSClient=%d%s", $currentPage, 0, $queryString_RSClient); ?>" class="default">|&lt; First</a>
                    <?php } // Show if not first page ?>
                </td>
                <td width="31%" align="center"><?php if ($pageNum_RSClient > 0) { // Show if not first page ?>
                    <a href="<?php printf("%s?pageNum_RSClient=%d%s", $currentPage, max(0, $pageNum_RSClient - 1), $queryString_RSClient); ?>" class="default">Previous&lt;&lt;</a>
                    <?php } // Show if not first page ?>
                </td>
                <td width="23%" align="center"><?php if ($pageNum_RSClient < $totalPages_RSClient) { // Show if not last page ?>
                    <a href="<?php printf("%s?pageNum_RSClient=%d%s", $currentPage, min($totalPages_RSClient, $pageNum_RSClient + 1), $queryString_RSClient); ?>" class="default">&gt;&gt; Next</a>
                    <?php } // Show if not last page ?>
                </td>
                <td width="23%" align="center" class="default"><?php if ($pageNum_RSClient < $totalPages_RSClient) { // Show if not last page ?>
                    <a href="<?php printf("%s?pageNum_RSClient=%d%s", $currentPage, $totalPages_RSClient, $queryString_RSClient); ?>" class="default">Last</a> &gt;|
                  <?php } // Show if not last page ?>
                </td>
              </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>