<html>
<head>
<title>Sonic Youth</title>
<body background="../gdbk1.gif"bgcolor="#00FF00" text="#000000" link="#000000" alink="#000000" vlink="#000000">

<?PHP
//initialize variables
$data_file = "list.photos";
$num_rows = 1;
$photos_per_row = 1;
$photos = file($data_file);
$total_photos = sizeof($photos);
$photos_per_page = $num_rows * $photos_per_row;
//check to see if the start variable exists in the URL.  
//If not, then the user is on the first page - set start to 0
if(!isSet($start)){
	$start = 0;
}
//init i to where it needs to start in the photos array
$i = $start;
$prev_start = $start - $photos_per_page;
$next_start = $start + $photos_per_page;
$clump = $photos[$i -1];
$clumpy = $photos[$i +1];

for ($row=0; $row < $num_rows; $row++){
  for ($col=0; $col < $photos_per_row; $col++){
     if($i < $total_photos){
        $image_size = getimagesize(trim($photos[$i]));
        print("<center><img border=1 src=\"".$photos[$i]."\"".$image_size[3]."></center>\n");
      } else {
        print("<br>\n");
      }


      $i++;
    }
}
?>
<div>
<?PHP
$readfile = file("captions.txt");
for ($k=0; $k<=count($readfile)-1; $k++) {
    $fields = split("\t",$readfile[$k]);

    // if the name field equals the name field entered in a search form
    // print that record and exit the loop

    if ($fields[0] == $photo) {

       print("<font face=\"arial, helvetica\" size=\"2\"><center>$fields[1]</center></font><br>");
$caption = $fields[1];
}
}
?>
<center><font=-1>Photo and &copy; by <a href="../dixon.html">Dixon</a>.</font></center><br>
</div>


<div align="center">
<?PHP
//print out navigation links
if(($start == 0) && ($next_start < $total_photos)){

//you're at the beginning of the photo gallery

?>
  <font face="arial, helvetica" size="2">
  <b><a href="crap_shoot.php?photo=<? print($clumpy);?>&start=<?PHP print($next_start);?>">next photo</a> 
  <font color="#FF0000">&#187;</font></b>
  </font>
<?PHP
} 
elseif (($start > 0) && ($next_start < $total_photos)){ 

//you're in the middle of the photo gallery

?>
  <font face="arial, helvetica" size="2">
  <b><font color="#FF0000">&#171;
  </font> <a href="crap_shoot.php?photo=<? print($clump);?>&start=<?PHP print($prev_start);?>">prev photo</a></b></font>
  <b>|</b>
  <font face="arial, helvetica" size="2">
  <b><a href="crap_shoot.php?photo=<? print($clumpy);?>&start=<?PHP print($next_start); ?>">next photo</a> <font color="#FF0000">&#187;</font></b></font>
<?PHP
} 
elseif(($start == 0) && ($next_start > $total_photos)){ 

//you're in a photo gallery with only one page of photos

?>
   
<?PHP
} 
else { 

//you're at the end of the photo galley

?>
  <font face="arial, helvetica" size="2">
  <b><font color="#FF0000">&#171;</font>
  <a href="crap_shoot.php?photo=<? print($clump);?>&start=<?PHP print($prev_start); ?>">prev photo</a></b></font>
<?PHP
}
?>
<br>
<br>
  <b><font face="arial, helvetica" size="2">
<center><a href="index.php?start=<? print($start);?>">Sonic Youth index</a></center></font></b>
</div>
<a href="../index.html">idle time</a>
</body>
</html>
