% if ($cod_anuncio){
<& anuncio.html, section=>$section, cod_anuncio=>$cod_anuncio, cp_nrec=>$cp_nrec, cp_count=>$cp_count, prev=>$prev, next=>$next, user=>$user, cp_adj=>$cp_adj  &>
% }else{
<& anuncio_inexistente.html &>
% }
<%init>

my $cod_anuncio = $m->dhandler_arg;
$cod_anuncio =~ s/\/default.html$//g;

my $cp_nrec = $m->top_args->{'cp_nrec'};
my $cp_adj = $m->top_args->{'cp_adj'};
my $cp_count = $m->top_args->{'cp_count'};
my $section = $m->top_args->{'section'};
my $useprefs = 1 if ($section eq 'prefs');
#$section = 'arquivo' unless defined($section);

my ($prev, $next);

if ($cp_count > 1){
	
	my $first = ($cp_nrec > 0) ? $cp_nrec-1:0;
	my $last = (($cp_nrec+1) < $cp_count) ? $cp_nrec+1:0;
	
	($section, my $cp_date, $cp_count, my $set) = $m->comp("/_shared/procs/concursos/cp_getsomeset.m",section=>$section, cp_nrec=>$first, maxhits=>10, subset=>1, useprefs=>$useprefs, user=>$user, cp_adj=>$cp_adj ); # context from top args
	$prev = $$set[0][1] if ($cp_nrec > 0);
	if ($last){
		$next = ($cp_nrec > 0) ? $$set[2][1]:$$set[1][1];
	}
}

</%init>
<%args>
$user=>undef
</%args>
%#======================================================================================
<%method section_tabs>
%#--------------------------------------------------------------------------------------
<%init>
my $section = $m->top_args->{section};
my $stab;
if ($section eq 'arquivo'){
	$stab = 2;
}elsif ($section eq 'prefs'){
	$stab = 3;
}else{
	$stab = 1;
}
</%init>
<& PARENT:section_tabs, stab=>$stab &>
</%method>
%#======================================================================================
<%method msg_area>
%#--------------------------------------------------------------------------------------
% my $section = $m->top_args->{section};
% if ($section eq 'prefs'){
<& /concursos/templates/prefs_msg.html &>
% }
</%method>
