#!/usr/bin/perl -w

$fil = "data/chattere.txt";
$path = "images/chattere";
open(DH,$fil);

@chattere = <DH>;

close(DH);

print "Content-type: text/html\n\n";

print "<table class=\"foernu\">\n";
print " <tr><th style=\"border-bottom: solid 1px black\">Førbillede</th><th style=\"border-bottom: solid 1px black\">&nbsp;</th><th  style=\"border-bottom: solid 1px black\">Efterbillede</th></tr>\n";
foreach(@chattere) {
	chomp($_);
	if ($_ !~ /^#/) {
		my ($t1,$im1,$t2,$im2,$nick) = split("::",$_);
		if ($t1 eq "") { $t1 = "kommer.jpg"; }
		if ($t2 eq "") { $t2 = "kommer.jpg"; }
		if ($im1 eq "") { $im1 = "kommer.jpg"; }
		if ($im2 eq "") { $im2 = "kommer.jpg"; }
		print " <tr>\n";
		print "  <td>\n";
		print "   <a href=\"$path/$im1\" target=\"_blank\"><img src=\"$path/$t1\" alt=\"$nick før\"></a>\n";
		print "  </td>\n";
		print "  <td>$nick</td>\n";
		print "  <td>\n";
		print "   <a href=\"$path/$im2\" target=\"_blank\"><img src=\"$path/$t2\" alt=\"$nick efter\"></a>\n";
		print "  </td>\n";
		print " </tr>\n";
	}
}
print "</table>\n";
