#!/usr/local/bin/perl
use CGI ':cgi-lib';
print CGI->header;


print<<__EOQ__;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>remember amber</title>

<style>
body{
	font-family:arial,helvetica,sans-serif;
}
img {
	border:1px solid black;
	width:300px;
	height:300px;
}
td {
	width:300px;
	vertical-align:top;
	padding:8px;
}

</style>
</head>
<body>
<center>
<h1>remember amber</h1>
<h2>kirk israel</h2>
<table>
__EOQ__


open(READ,"data.tab");

$count = 0;
$buf = "";

while(defined($line=<READ>)){
	chomp $line;
if($line =~ /\t/){
	($img,$text) = split(/\t/,$line);
	$buf .= <<__EOQ__;
	<td><img src="$img"><br>
	$text</td>
__EOQ__
	$count++;
	if($count >= 2){
		printRow($buf);
		$buf = "";
		$count = 0;
	}
}
}

	if($count > 0){
		printRow($buf);

	}

sub printRow{
	my($buf) = @_;
	print "<tr>$buf</tr>";
}	


print<<__EOQ__;
</table>
</center>
</body>
</html>
__EOQ__
