<?
class navigator{   

	function navigator($offset, $limit, $total, $idCat=1){
		$seta_ff="images/proxima.gif";
		$seta_back="images/anterior.gif";
		
		$link="?idCat=$idCat&offset=";
		
    	$max=$offset + $limit;

      	if ($offset >= $limit)
        	$this->botaoNavImg( $link. ($offset - $limit), $seta_back, "recuar");

   		$temp=$offset-(2*$limit);
		if ( $temp>=0)
			$this->botaoNav( $link. $temp, intval($temp/$limit)+1); 	
		
		$temp=$offset-$limit;
		if ( $temp>=0)
			$this->botaoNav( $link. $temp, intval($temp/$limit)+1);
		
			
		echo "<font>" . intval(($offset/$limit)+1) . "</font>";
		
		$temp=$offset+$limit;
		if ( $temp<$total)
			$this->botaoNav( $link. $temp, intval($temp/$limit)+1);
		
		$temp=$offset+2*$limit;
		if ( $temp<$total)
			$this->botaoNav( $link. $temp, intval($temp/$limit)+1);
		

		if ($max<$total)
        	$this->botaoNavImg( $link. $max, $seta_ff, "avan&ccedil;ar");


	}

	function botaoNavImg($link, $imagem, $alt="seta"){
        ?><a href="<?=$link?>"><img src="<?=$imagem?>" alt="<?=$alt?>" border="0" align="absmiddle" /></a><?
	}
	
	function botaoNav($link, $char){
        ?><a href="<?=$link?>" class="link"> <?=$char?> </a><?
	}
	
}
?>