title: Get Next and Previous Elements in JavaScript array
body: <p>I have a large array, with non-sequential IDs, that looks something like this:</p>
  
  <pre><code>PhotoList[89725] = new Array();
  PhotoList[89725]['ImageID'] = '89725';
  PhotoList[89725]['ImageSize'] = '123';
  PhotoList[89726] = new Array();
  PhotoList[89726]['ImageID'] = '89726';
  PhotoList[89726]['ImageSize'] = '234';
  PhotoList[89727] = new Array();
  PhotoList[89727]['ImageID'] = '89727';
  PhotoList[89727]['ImageSize'] = '345';
  Etc....
  </code></pre>
  
  <p>I'm trying to figure out, given an ID, how can I can get the next and previous ID... So that I could do something like this:</p>
  
  <pre><code>&lt;div id="current"&gt;Showing You ID: 89726 Size: 234&lt;/div&gt;
  Get Prev Get Next
  </code></pre>
  
  <p>Obviously, if we're at the end or beginning of the array we just a message...</p>