#!/usr/bin/perl

@files = glob "*.txt";
foreach $file (@files)
{
	open SRC, "<$file";
	$num = <SRC>;
	chomp $num;
	$title = <SRC>;
	chomp $title;
	close SRC;

	$list {"$file"} = "$title" unless $num;
	$list {"$file"} = "$num. $title" if $num;
}

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

print "<html>\n";
print "<head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\">\n";
print "<title>Odklepávanie popola na Budhu</title>\n";
print "<link rel='stylesheet' href='zen.css'>\n";
print "</head>\n";
print "<body bgcolor=white>\n";
print "<table align=center border=0 cellpadding=8 cellspacing=0 width=500 bgcolor='\#FF6600'>\n";
print "\t<tr nowrap>\n";
print "\t\t<td width=50>&nbsp;</td>\n";
print "\t\t<td width=400>\n";
print "\t\t\t<h3>Odklepávanie popola na Budhu</h3>\n";
print "\t\t</td>\n";
print "\t\t<td width=50>&nbsp;</td>\n";
print "\t</tr>\n";
print "\t<tr nowrap>\n";
print "\t\t<td colspan='3'><img src='separator1.gif' width='500' height='17'></td>\n";
print "\t</tr>\n";
print "\t<tr nowrap>\n";
print "\t\t<td width=50>&nbsp;</td>\n";
print "\t\t<td width=400>\n";

foreach $file (sort keys %list)
{
	$title = $list {"$file"};
	@dirs = split '/', $file;
	$file = pop @dirs;
	print "<a href=\"doc.cgi?$file\">$title</a><br>\n";
}

print "\t\t</td>\n";
print "\t\t<td width=50>&nbsp;</td>\n";
print "\t</tr>\n";
print "\t<tr nowrap>\n";
print "\t\t<td colspan='3'><img src='separator2.gif' width='500' height='17'></td>\n";
print "\t</tr>\n";
print "\t<tr nowrap>\n";
print "\t\t<td width=50>&nbsp;</td>\n";
print "\t\t<td width=400 align='right'><a href='/index.html'>message</a></td>\n";
print "\t\t<td width=50>&nbsp;</td>\n";
print "\t</tr>\n";
print "</table>\n";
print "</body>\n";
print "</html>\n";

