$image) if(strpos($image,"_200") === false) $images[]=$image;
$n=count($images);
//if first time to page, $_GET['p'] set to one
if(!isset($_GET['p'])) $_GET['p']=1;
//if not on first page, set previous back one
$previous=1;
if($_GET['p']!=$previous) $previous=$_GET['p']-1;
else $previous=count($images);
//if not on last page, set next forward one
$next=count($images);
if($_GET['p']!=$next) $next=$_GET['p']+1;
else $next=1;
//set hight to 600px, unless width > then set width to
$stats=getimagesize($images[$_GET['p']-1]);
$height="600";
if( $stats[0]>500 ) $height = 600*550/$stats[0];
?>