<table border="0" cellpadding="0" cellspacing="0" width="371" height="25"  align="right">
<tr bordercolor="#FFFFFF">
<td width="400" height="20" nowrap="nowrap" class="white_content" style="text-align: center;  background-color:#CCCCCC; color:#FFF; border: 1px solid #8e8e8e; "><div align="left"><span class="white_content" style="text-align: center;">
<?php
$page_num = 1;
$link_from = 0;
$show=$show;
if (!isset($table_width)) {
	$table_width = "100%";
}
$_GET[from];


$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];


  $link_prev = $_GET[from] - $show;
  $link_next = $_GET[from] + $show;

if ($link_prev >= 0) {
	$previous = "<a href=\"$html_query&from=$link_prev&from_date=$from_date&to_date=$to_date\"><b> << Previous</b></a>&nbsp;&nbsp;";
} else {
	$previous = "";
}

if ($link_next < $num_results) { 
 $next = "&nbsp;&nbsp;<a href=\"$html_query&from=$link_next&from_date=$from_date&to_date=$to_date\"><b>Next >> </b></a>"; }

// ==================================================================================

		while ($link_from < $num_results) {
			
			$link_to = $link_from + $show;
			
			if ($link_to > $num_results) {
				$link_to = $num_results;
				$max_show = $link_to - $link_from;
				$show_query = "$prev_show=$show&max_show=$max_show";
			} else {
				$show_query = "$show=$show";
			}
			
			$link_from_plus_1 = $link_from + 1;
			
			if ($link_from == $_GET[from]) {
				$page[$page_num] = "$page_num ";
				$current_page = $page_num;
			} else {
	$page[$page_num] = "<a href=\"$html_query&from=$link_from&from_date=$from_date&to_date=$to_date\"><u>$page_num</u></a> ";
			}
			
			$link_from = $link_from + $show;
			++$page_num;
		}
		
		echo $previous;
		
		for ($back_page = ($current_page - $num_links); $back_page < $current_page; ++$back_page) {
			echo $page[$back_page];
		}
		
		echo $page[$current_page];
		
		for ($fwd_page = ($current_page + 1); $fwd_page <= ($current_page + $num_links); ++$fwd_page) {
			echo $page[$fwd_page];
		}
		
		echo $next;	
		
		?>
    </span></div></td>
  </tr>
</table>
