#!/usr/bin/perl

use Size;
use Cwd;
require "/usr/local/httpd/cgi-bin/cgi-lib.pl";

&ReadParse;

$DIR="/usr/local/httpd/htmldocs/virtual/marshfield/photos";

$VDIR="/photos";

$img = $in{"image"};
$image="$DIR/$img";

$filenum = 0;
&html_top();
open(FILE, "$DIR/panos.txt");

while (<FILE>){
	chop;
    if($_) {
	($label, $contents) = split /:/;
	if($label eq "image") {
#		$image{"$contents"}=$contents;
		$i = $contents;
		$filelist[++$filenum] = $contents;
	}
	else {
		if($label eq "title") { $title{$i} = $contents }
		if($label eq "comments") { $comments{$i} = $contents }
		if($label eq "related") { $related{$i} = $contents }
		if($label eq "height") { $height{$i} = $contents }
	}
    }
}
close(FILE);


print qq(
<div align="center">
<p align="center"><span class="title">$title{$img}</span></p>
<table><tr><td align="center">
<table border="5"><tr><td><applet code="pmvr.class" width=400 height=$height{$img}>
        <param name="codebase" value="../photos">
        <param name="image" value="../photos/$img">
        <param name="view" value="360">
        <param name="auto" value="1">
        Java support is required for panoramic images. 
</applet></td></tr></table>
<table width="400"><tr><td align="center">
$comments{$img}</td></tr>
<tr><td></td></tr>
<tr><td align="center" class="e80">Can't see the image?
<a href="/cgi-bin/pano2.pl?image=$img" onClick="return alert('You will now be taken to an alternative java applet.  Please be patient while the image loads...')">click here</a></td></tr>
</table>

</td></tr></table>
<hr width="300" noshade size="1">
<table cellpadding="3" cellspacing="0" border="0" bgcolor="#dddddd">
<tr><td colspan="3" align="center">Other 360-degree panoramas</td></tr>
);

for($x = 1; $x <= $filenum; ++$x) {
	print "<tr><td class=\"e80\" nowrap><a href=\"/cgi-bin/pano1.pl?image=$filelist[$x]\">$title{$filelist[$x]}</a></td>\n";
	print "<td><img src=\"/images/blankdot.gif\" width=\"50\" height=\"1\"></td>\n";
	if(++$x <= $filenum) {
	  print "<td class=\"e80\" nowrap><a href=\"/cgi-bin/pano1.pl?image=$filelist[$x]\">$title{$filelist[$x]}</a></td></tr>\n";
	}
	else {
	  print "<td>&nbsp;</td></tr>\n";
	}
}

print qq(
</table>
<hr width="300" noshade size="1">
<table><tr><td>Return to:&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><a href="http://www.marshfield.net/panoramas.html">Marshfield panoramas</a><br>
<a href="http://www.marshfield.net/photos.html">Marshfield photos</a><br>
<a href="http://www.marshfield.net">Marshfield home page</a></td></tr></table>
</div>
);

&html_bottom();

sub html_bottom {
print qq(
</td></tr>
<tr><td class="botleft"><img src="../images/blankdot.gif" alt="" width="1" height="40" border="0"></td>
<td class="botright">
<hr width="70%" size="1">
This page designed and copyright &#169; 1996-2007 by <a href="http://www.page-crafters.com">Page Crafters</a>. All rights reserved.
</td>
</tr>
</table>
</div>
</body>
</html>
);
	exit;
}

sub html_top {

open FILE, "../nav.html";
while (<FILE>) {
	$content.=$_;
}
close FILE;

print "Content-type: text/html\n\n";
print qq (
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title>Marshfield, Massachusetts</title>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<link rel="stylesheet" type="text/css" href="../styles.css">
	<script type="text/javascript" src="../p7pm/p7popmenu.js"></script>
	<style type="text/css" media="screen">
	<!--
	\@import url("../p7pm/p7pmv10.css");
	-->
	</style>
</head>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-4887720-1";
urchinTracker();
</script>
<body onload="P7_initPM(0,6,0,-20,10)">
&nbsp;<br>
<div align="center">
<table cellpadding="0" cellspacing="0" border="0" width="800" class="main">
<tr><td colspan="2"><img src="../images/t_pano360.jpg" alt="Community Pages" width="800" height="136" border="0"></td></tr>
<tr>
<td width="192" class="nav" valign="top"><table cellpadding="0" cellspacing="0" border="0" class="nav">
<tr><td width="20"><img src="../images/blankdot.gif" alt="spacer" width="20" height="1" border="0"></td>
<td width="154" valign="top">
<ul id="p7PMnav">
$content

</ul>

</td>
<td width="18"><img src="../images/blankdot.gif" alt="spacer" width="18" height="1" border="0"></td></tr>
</table>

<img src="../images/nav-bottom.jpg" alt="navigation bottom image" width="192" height="19" border="0">
</td>
<td width="608" class="content">

);
}
