<td  nowrap>&nbsp;
<?if($num_rows != 0){?>
	<a href="#" onClick="ChangePage('1')"><img src="../<?echo $DIR_IMAGE.$PIC_FIRST;?>" border="0" alt="<?echo $PAGE_LISTA_FIRST;?>"></a>
	<?
	if ($to_page == 1)
		print "<a href=\"#\" onClick=\"ChangePage('".$to_page."')\"><img src=\"../".$DIR_IMAGE.$PIC_BACK."\" border=\"0\" alt=\"".$PAGE_LISTA_BACK."\"></a>&nbsp;";
    elseif ($to_page > 1)
		print "<a href=\"#\" onClick=\"ChangePage('".($to_page-1)."')\"><img src=\"../".$DIR_IMAGE.$PIC_BACK."\" border=\"0\" alt=\"".$PAGE_LISTA_BACK."\"></a>&nbsp;";
	?>
	<?if($to_page <= 5){
		$start_page=1;
		if($max_page >= 9) $stop_page=9;
		else $stop_page=$max_page;
	 }
	 else{
		if($to_page > 5){
			if (($to_page+4)>=$max_page){
				$stop_page = $max_page; 
				$start_page = $stop_page - 8 ; 
				if ($start_page<=0) $start_page =1;
			}
			else{
				$stop_page = $to_page + 4; 
				$start_page = $to_page - 4 ;
				if ($start_page<=0) $start_page =1;
		    }
		}
	 }
	 for($i=$start_page;$i<=$stop_page;$i++){
		 if ($to_page==$i){
			print "<a href=\"#\" style=\"text-decoration:underline\" onClick=\"ChangePage('".$i."')\"><b>".$i."</b></a>&nbsp;";
		 }
		 else{
			print "<a href=\"#\" onClick=\"ChangePage('".$i."')\">".$i."</a>&nbsp;";
		 }
	 }?>
	 <?
		if ($to_page == $max_page)
			print "<a href=\"#\" onClick=\"ChangePage('".$to_page."')\"><img src=\"../".$DIR_IMAGE.$PIC_NEXT."\" border=\"0\" alt=\"".$PAGE_LISTA_NEXT."\"></a>";
		elseif ($to_page < $max_page)
			print "<a href=\"#\" onClick=\"ChangePage('".($to_page+1)."')\"><img src=\"../".$DIR_IMAGE.$PIC_NEXT."\" border=\"0\" alt=\"".$PAGE_LISTA_NEXT."\"></a>";
	 ?>
	 <a href="#" onClick="ChangePage('<? echo $max_page;?>')"><img src="../<?echo $DIR_IMAGE.$PIC_END;?>" border="0" alt="<?echo $PAGE_LISTA_END;?>"></a>
<?}?>
</td>

<td  align="right"  nowrap><b><span title="<?echo $PAGE_LIST_TOTAL." ".$num_rows." ".$PAGE_LIST_COUNT.", ".$PAGE_LIST_TOTAL." ".$max_page." ".$PAGE_LIST_PAGE.", ".$PAGE_LIST_INPAGE." ".$to_page." ".$PAGE_LIST_PAGE;?>">
<?echo $PAGE_LIST_TOTAL_SHOW." ".$num_rows." ".$PAGE_LIST_COUNT_SHOW.", ".$PAGE_LIST_TOTAL_PAGE_SHOW." ".$max_page." ".$PAGE_LIST_PAGE_SHOW.", ".$PAGE_LIST_INPAGE_SHOW." ".$to_page." ".$PAGE_LIST_PAGE_SHOW;?>
</span>&nbsp;</td>