#!/usr/bin/perl

$DIR = $ENV{'SCRIPT_FILENAME'};
$DIR =~ s/preview.cgi//;
$in=qx!cd $DIR; ls -A1 *.jpg *.gif *.png!;
#foreach $key (keys %ENV) { $s .= "$key: " . $ENV{$key} . "<br>"; }

@l=split(/\n/,$in);
$out="";
foreach $l1 (@l) {
  @l2 = split(/\./,$l1);
  $img = $l2[0];
  for ($i=1; $i<@l2-1; $i++) { $img = $img . ".$l2[$i]"}
  $img = "icon/" . $img . ".icon.jpg";
  $out .= "<a href=\"$l1\"><img src=\"$img\"></a>\n";
}

print <<EOF ;
Content-type: text/html

<html>
<head>
<title>Asteroid Clusters in Major Mean Motion Resonances with Jupiter</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
</head>
<body>

<a href="http://sirrah.troja.mff.cuni.cz/~mira/mp/"><img src="http://sirrah.troja.mff.cuni.cz/~mira/mp/images/yarko_site.gif" align="right" border="0"></a>
<h1>Asteroid Clusters in Major Mean Motion Resonances with Jupiter</h1>

<p><hr>

<table>
<tr>
<td valign="top">
Figures from the 2008 DDA talk (Boulder, CO, Apr 28-May 1st, 2008).
</td>
<td>
<ul>
<li><a href="./">directory list</a>
<li>PDF version [&nbsp;<a href="dda2008_broz.pdf"><tt>dda2008_broz.pdf</tt></a>,
2&nbsp;MB&nbsp;]
</ul>
</td>
</tr>
</table>
<p>
$out

<p><hr></hr>
<address>
Miroslav Broz,
<a href="mailto:miroslav.broz\@email.cz">miroslav.broz\@email.cz</a>,
May 1st 2008
</address>
<hr></hr>

</body>
</html>

EOF

exit;

