#!/usr/bin/perl
$number = int(rand(10000));


   open (INPUT,"../burstcode.htm");
   while(eof(INPUT) == 0) {
      @ad = <INPUT>;
   }
   close(INPUT);


#$ad = "<A HREF=\"http://www.burstnet.com/ads/ad6389a-map.cgi/$number\" target=\"new\"><IMG SRC=\"http://www.burstnet.com/cgi-bin/ads/ad6389a.cgi/$number\" BORDER=\"0\" WIDTH=\"468\" HEIGHT=\"60\"></A>";

$news = "<table BORDER=0 COLS=1 WIDTH=\"100%\" BGCOLOR=\"#FFFFFF\" ><tr><td>
<table BORDER=0 COLS=2 WIDTH=\"100%\" BGCOLOR=\"#FFFFFF\" >
<tr>
   <td width=30><b><font color=\"#FF0000\"><u>News</u>:</font></b></td>
   <td bgcolor=\"#FFFF00\"><b>Coming soon - enhancements to this FunGuide section.</b></td>
</tr>
<tr>
   <td width=30> </td>
   <td>Including, information about park's roller coasters, waterslides, carousels, ferris wheels, directions to parks, park shows and special events, contact parks by email, park discounts, add your comments on parks, and more !</td>
</tr>
<tr>
   <td width=30> </td>
   <td><font size=2><form action=\"http://www.funguide.com/cgi/email.cgi\"  method=\"post\">
         <input type=\"hidden\" value=\"Amusement Park Email List\" name=\"FORM\">
         Email: <input name=\"email\" size=30> <input type=\"submit\" Value=\"Email me when ready\"></font>
   </td>
</td>
</tr>
</table>
</td></tr></table>\n";

$docnumber=$ENV{'QUERY_STRING'};
$next = 0;
$pos = 0;

open(INPUT,"all/$docnumber.html") || return_error();
while (eof(INPUT)==0) {
   @lines = <INPUT>; 
}
close (INPUT);

$total_lines = @lines;
$count =0;

print "Content-type: text/html\n\n";
do{
   print $lines[$count];

   # insert ad after body tag
   if($count==7) { 
         print "<Table width=100% height=100 BGCOLOR=\"#FFF1CE\">\n  <tr><td>\n";
         print "    <center>@ad</center>\n";
#         print "    <center>$ad</center>\n";
         print "  </td></tr>\n</table>\n";
         print $news;
   }          
} while (++$count < $total_lines);
exit;

sub return_error() {
   print "Content-type: text/html\n\n";
   print "<html><head><title>Error</title></head><body>";
   print "<b><font color=\"#FF0000\">There is no data for your request.</font> <br> If you feel that this is in error, please <a href=\"mailto:temporary\@funguide.com?subject=Error retrieving information for (park.pl?$docnumber)\">Contact us</a>.</b>";
   print "</body></html>";

   exit;
}

