title: Calling function on opener window
body: <p>The child lost its parent!!</p>
  
  <p>I have a parent window, when somebody clicks on an image a JS popup opens and displays the photo and its information.</p>
  
  <p>To close the popup/child window, and to flash an element on my parent/opener window, I have been using this function:</p>
  
  <pre><code>function closeWindow() {
      var currentID = document.getElementById('currentID').value;
      window.opener.flashElement(currentID);
      window.close(); 
  }
  </code></pre>
  
  <p>My problem is this doesn't work if my users navigate away from the page that the popup originally opened. For example, in the popup window, there are next and previous buttons to scroll through the individual photos in that set of results, which reloads the page with a new querystring value.</p>
  
  <p>If my user scrolls (reloads page) less than 7 times it's okay but if they scroll more than that, the <code>window.opener</code> function does not work, and because of that, the <code>window.close</code> function doesn't either!</p>
  
  <p>I could probably rebuild the page so the data comes via an AJAX call, rather than reloading the page, but that's a lot of work I could do without.</p>
  
  <p>Any ideas?</p>