<?php 
if (isset($_GET['least'])) {  // 905 956
  echo "<html> " . "\n";
  echo "<head> " . "\n";
  echo "<title>" . $_GET['title'] . " - RJM Programming - http://www.rjmprogramming.com.au (Copyright &copy; 2013 rjmprogramming.com.au all rights reserved.)</title> " . "\n";
  echo "<script type='text/javascript'> " . "\n";
  echo "//<![CDATA[" . "\n";
  echo "var image_index = 0;" . "\n";
  echo "var ijij = 0;" . "\n";
  $comma = "";
  $cprefix = "000";
  $ext = "jpg";
  $ourunderscore = "_";
  if (isset($_GET['underscore'])) $ourunderscore = $_GET['underscore'];
  $oursubdir = "";
  if (isset($_GET['home'])) { 
    $oursubdir = "/" . $_GET['home'];
  } else if (isset($_GET['different'])) {
    $oursubdir = "/" . $_GET['different'];
  }
  if (strlen($oursubdir) == 1) $oursubdir = "";
  if (isset($_GET['ext'])) $ext = $_GET['ext'];
  if ($_GET['least'] > 9) $cprefix = "00";
  if ($_GET['least'] > 99) $cprefix = "0";
  if ($_GET['least'] > 999) $cprefix = "";
  echo "var mypictures = new Array(" . "\n";
  for ($ijij=$_GET['least']; $ijij<=$_GET['most']; $ijij++) {
    echo $comma . '"http://www.rjmprogramming.com.au/' . $_GET['subdir'] . '/images' . $oursubdir . '/DSC' . $ourunderscore . $cprefix . (($ijij+1*0)) . '.' . $ext . '"' . "\n";
    if ($ijij == 9) $cprefix = "00";
    if ($ijij == 99) $cprefix = "0";
    if ($ijij == 999) $cprefix = "";
    $comma = ",";
  }
  if (isset($_GET['different']) && isset($_GET['home'])) {
    $oursubdir = "/" . $_GET['different'];
    $ext = "JPG";
    if (strlen($oursubdir) == 1) $oursubdir = "";
    for ($ijij=$_GET['least']; $ijij<=$_GET['most']; $ijij++) {
      echo $comma . '"http://www.rjmprogramming.com.au/' . $_GET['subdir'] . '/images' . $oursubdir . '/DSC' . $ourunderscore . $cprefix . (($ijij+1*0)) . '.' . $ext . '"' . "\n";
      if ($ijij == 9) $cprefix = "00";
      if ($ijij == 99) $cprefix = "0";
      if ($ijij == 999) $cprefix = "";
      $comma = ",";
    }
  }
  echo ");" . "\n";
  echo "var thispicture = eval(mypictures.length - 1);" . "\n";
  
  echo 'function initA() {' . "\n";
  echo 'document.getElementById("prevA").onclick = prevDo;' . "\n";
  echo 'document.getElementById("nextA").onclick = nextDo;' . "\n";
  echo '}' . "\n";
} else {
  echo "<html> " . "\n";
  echo "<head> " . "\n";
  echo "<title>Welcome, Street Art Lovers! - RJM Programming - http://www.rjmprogramming.com.au (Copyright &copy; 2013 rjmprogramming.com.au all rights reserved.)</title> " . "\n";
  echo "<script type='text/javascript'> " . "\n";
  echo "//<![CDATA[" . "\n";
  echo "var mypictures = new Array(); " . "\n";

  echo 'function initA() {' . "\n";
  echo 'document.getElementById("prevA").onclick = prevDo;' . "\n";
  echo 'document.getElementById("nextA").onclick = nextDo;' . "\n";
  echo '}' . "\n";
}
?>

function prevDo() {
  if (thispicture == 0) {
    thispicture = mypictures.length;
  }
  thispicture--;
  document.getElementById("myPic").src = mypictures[thispicture];
  return false;
}

function nextDo() {
  thispicture++;
  if (thispicture == mypictures.length) {
    thispicture = 0;
  }
  document.getElementById("myPic").src = mypictures[thispicture];
  return false;
}

function huhDo() {
  thispicture = Math.floor(Math.random()*mypictures.length + 0)
  document.getElementById("myPic").src = mypictures[thispicture];
  return false;
}

function biggerDo() {
  window.open(document.getElementById("myPic").src, '_blank');
}


//]]>
</script>
</head>
<body onload="initA();" style="background-color: pink;">
  <div align="center">
  <!--h1>Welcome, Street Art Lovers!</h1-->
  <!--h2><a href="#" id="prevA" onclick="prevA();">&lt;&lt;Previous</a>&nbsp;&nbsp;<a href="#" id="nextA" onclick="nextA();">Next&gt;&gt;</a></h2-->
  <table><tr>
  <td><a href="#" id="huhA" title="Random image" onclick="huhDo();">??</a></td>
  <td><a href="#" id="prevA" title="Previous image" onclick="prevDo();">&lt;&lt;</a></td><td>
<?php
  echo '<img onclick="biggerDo();" title="' . $_GET['hovertext'] . ' Click for bigger view on separate tab or window." src="http://www.rjmprogramming.com.au/' . $_GET['subdir'] . '/siteimage.jpg" width="500" id="myPic" alt="' . $_GET['subject'] . ' Slideshow" />' . "\n";
  echo '</td><td><a href="#" id="nextA" title="Next image" onclick="nextDo();">&gt;&gt;</a></td>' . "\n";
  echo '<td><a target=_blank href="http://www.rjmprogramming.com.au/' . $_GET['subdir'] . '/" title="One Image Page Website" id="goA">++</a></td>' . "\n";
?>
  </tr></table>
  </div>
</body>
</html>

