var newWindow = null;
function displayImage (URL,text) {
   caption = text
   if (newWindow == null || newWindow.closed){
      newWindow = window.open("", "newWin", "toolbar=no,scrollbars=no,width=600,height=650");
      var newWinText = '<html>\n<head>\n<title>Photo Displayer</title></head>\n';
      newWinText += '<body style="background-color: #ffc">\n';
      newWinText += '<div align="right"><a href="javascript:window.close()">Close this window</a><br><br></div>\n';
      newWinText += '<table align="center" cellpadding="0" cellspacing="0">\n';
      newWinText += '<tr><td height="560" width="500" align="center">\n';
      newWinText += '<img src="' + URL + '" name="slideshow" alt="image" style="border: 1px solid #000;"><br>\n';
      newWinText += '<p id="frameCaption">' + caption + '</p>\n';
      newWinText += '</td></tr></table>\n</body>\n</html>\n';
      //alert(newWinText);
      newWindow.document.write (newWinText);
      newWindow.document.close();
      if (window.focus) {newWindow.focus()}
   } else {
      if (window.focus) {newWindow.focus()}
      newWindow.document.slideshow.src = URL;
      if (document.getElementById && newWindow.document.slideshow.complete){
          newWindow.document.getElementById("frameCaption").innerHTML = caption;
      }
   }
   return;
}