<?
class navigator{   

	function navigator($offset, $limit, $total, $idCat=""){
		global $catPai, $cat;
		$seta_ff="images/proxima.gif";
		$seta_back="images/anterior.gif";
		
		$p="";
//		if ($_REQUEST['procurar']) $p.="procurar=" . $_REQUEST['procurar'] . "&";
		$link=($cat)?"/$catPai/$cat/":"";
		
    	$fimPagina=$offset + $limit;

		$temp=0;
		if ($offset>$temp)
        	$this->botaoNav( $link. $temp, "<<"); 

      	if ($offset >= $limit)
        	$this->botaoNav( $link. ($offset - $limit), "<");

   		$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);
		
		if ($total>$limit)
			echo "<span>" . intval(($offset/$limit)+1) ."</span> | ";
		
		$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 ($fimPagina<$total)
        	$this->botaoNav( $link. $fimPagina, ">");
			
		if ($fimPagina<$total)
        	$this->botaoNav( $link .intval(($total/$limit))*$limit, ">>", true);



	}

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