#!/usr/bin/perl

use DBI;
use CGI;
require "ges/conf.pl";

use Data::Dumper;


$q = new CGI;

print $q->header;

$id = $q->param('id');


#print "<head>
#					<META HTTP-EQUIV=refresh CONTENT=\"5\"> 
#					<meta http-equiv=\"Page-Enter\" content=\"revealTrans(Duration=1.0,Transition=23)\">
#			 </head>";



print "
<html>
<link rel=\"stylesheet\" type=\"text/css\" href=\"../estilo.css\" />		
<body style=\"background-color:transparent\" topmargin=0px rightmargin=0px leftmargin=0px class=esp>
";


$st = "SELECT * FROM destaque ORDER BY RAND()";
my $dbc = $dbh->prepare($st);
$dbc->execute or print "Erro DB: $DBI::errstr\n$!";
$data = $dbc->fetchrow_hashref();


print "
<table border=0 width=80% >
<tr><td valign=center >
";


	print "<table width=100% height=100% border=0 >
	       <tr><td align=center valign=bottom height=110> ";
	       
	if( $data->{foto} ne "" )
	{
		print "<a href=\"verproduto.cgi?id=$data->{id}\" target=main><img src=\"../images/destaques/thb_$data->{foto}\" border=1 style=\"border-color:\#383838\"></a>";
	}
	else
	{
		#print "<img src=\"../images/no_foto.jpg\">";
		print "";
	}

#Setar o LC_CTYPE para pt_PT.ISO8859-1 se o CHARSET=latin1 na bd
#print `locale`;

use POSIX qw(locale_h);
setlocale(LC_CTYPE, "pt_PT.ISO8859-1"); 
use locale;

	$nome = uc($data->{nome});       
	       
	print "</td></tr>
				 <tr><td align=center><p><font color=white><b><font color=\#ca0000><br>$nome</font></b></font></p></td></tr>
	       </table>
	       ";	


print " 
</td></tr>
</table>
</html>";