#!/usr/bin/perl
use strict;
use lib "../lib";
use lib "../bin";
use Variables;
use SearchStuff;

### display papers and maps


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

my %newsnames = SearchStuff::GetNewsNames;
my $MAPSDIR = "maps_steve_log";

opendir(DIR,"$DIRROOT/html/$MAPSDIR");

my $file;
while(defined($file = readdir(DIR))) {
  next if ($file eq ".");
  next if ($file eq "..");
  next if ($file eq ".gif");

  my $newslink=$file;

  my $baseurl = $file;
  my @parts1 = split(/.gif/,$file);
  $baseurl = $parts1[0];
  $baseurl =~ s/\_/\./g;


  my $paper_name = $newsnames{$baseurl."/"};
  if ($paper_name eq "") { $paper_name = $newsnames{$baseurl}; }


  # if we still have a blank paper name, mine all results for it
  if ($paper_name eq "") {
    foreach(keys %newsnames) {
      my $key = $_;
      my @parts = split(/\//,$key);
      if ($parts[0] eq $baseurl) {
        $paper_name = $newsnames{$key};
      }
    }
  }


print "<img src=$URLROOT/$MAPSDIR/$file border=0>";
print"<a href=http://$baseurl>$baseurl - $paper_name</a><br>\n";;


}

