#!/bin/perl
# pics.pl

use strict;

use CGI qw(:standard);
use myHTML;

#print header();

my $act   = param('act');
my $value = param('value');
my $pic   = param('pic');

p "<html>";
p "<head>";
p "<title>Voting</title>";
p "</head>";
p2 "<body>",
   #"<a href='' onclick='window.close()'>",
   "<table><tr><td align='center'>";

add_value($act,$value,$pic) if ($value != 0);
my %topten = get_top_ten();
my $votings=votings();
p2 "Vielen Dank für deine Beteiligung<br><br>" if ($value != 0);

p2 "Aktueller Punktestand<br><br>",
   "<table>",
   " <tr bgcolor='#aaaaaa'>",
   "  <td align='center'>",
   "   Platz",
   "  </td>",
   "  <td width='250' align='center'>",
   "   Name",
   "  </td>",
   "  <td align='center'>",
   "   Punkte",
   "  </td>",
   "</tr>";
   
my $color;
for (my $i=1;$i<=10;$i++) {
   $color='#009900';
   $color='#00ff00' if ($i % 2);
   p2 "<tr bgcolor=$color>",
      " <td align='center'>",
      "  $i",
      " </td>",
      " <td align='center'>";
      my $let;
      my $girl=$topten{$i}[1];
			($let) = $girl =~ /([a-z]{1})/i;
   p2 "  <a target='pics' href='pics.pl?act=$girl&ind=0&let=$let'>",
      "   $girl",
      "  </a>",
      " </td>",
      " <td align='center'>";
   printf "  %2.2f\n",$topten{$i}[0];
   p2 " </td>",
      "</tr>";
}
p2 "</table>",
   "<br>$votings abgegebene Stimmen",
   "</td></tr></table>",
   #"</a>",
   "</body>",
   "</html>";
   