<!--
  var gallery = null;
  var button = -1;
  var ah = -1;
  var aw = -1;
  var browser = -1;
  var coordX = -1;
  var coordY = -1;
  var width = 0;
  var height = 0;

  if (window.screen) {
    ah = screen.availHeight - 30;
    aw = screen.availWidth - 10;
  }

  if (document.all) { browser = 0 }                // ie
  else if (document.layers) { browser = 1 }        // navigator
  else if (document.getElementById) { browser = 2} // netscape

  function myMouseUp(evt) {
    button = evt.which;
  }

  if (browser == 2) {
    document.captureEvents(Event.MOUSEUP);
    document.onmouseup=myMouseUp;
  }

  function calcCoords() {
    if ((ah > 0) && (aw > 0)) {
      coordX = (aw - width) / 2;
      coordY = (ah - height) / 2;
    } else {
      coordX = -1;
      coordY = -1;
    }
  }

  function resetWindow() {
    if (browser == 0) {
      width += 12;
      height += 30;
    } else if (browser == 2) {
      width += 8;
      height += 30;
    }
    gallery.resizeTo(width, height);
    if (coordX > 0) {
      gallery.moveTo(coordX, coordY);
    }
  }

  function extractFilename(loc) {
    pos = loc.lastIndexOf('/');
    return loc.substr(pos+1, loc.length);
  }

  function openImage(loc, xsize, ysize) {
    if ((browser == 2) && (button != 1)) return true;
    width = xsize + 10;
    height = ysize + 10;
    fileStr = extractFilename(loc);
    isOpen = (gallery && gallery.open && !gallery.closed);
    if (isOpen && ((browser == 0) || (browser == 2))) {
      calcCoords();
      resetWindow();
    } else {
      calcCoords();
      gallery = open("","gallery","width="+width+",height="+height+",left="+coordX+",screenX="+coordX+",top="+coordY+",screenY="+coordY+",locationbar=no,menubar=no,resizable=yes");
      resetWindow();
    }
    gallery.document.open();
    gallery.document.writeln('<html><head><title>'+fileStr+' (click on window to close)</title>');
    gallery.document.writeln('<script language="Javascript">');
    gallery.document.writeln('<!-- ');
    gallery.document.writeln('var buttonLeft = false;');
    gallery.document.writeln('function doClose() { if (buttonLeft) {window.close();} }');
    gallery.document.writeln('function myOnMouseUp( evt ) { buttonLeft = false; if (document.all) { buttonLeft = (window.event.button == 1); } else { buttonLeft = (evt.which == 1); } }');
    gallery.document.writeln('if (document.captureEvents) { document.captureEvents(Event.MOUSEUP); } document.onmouseup = myOnMouseUp;');
    gallery.document.writeln('//--> </script>');
    gallery.document.writeln('</head><body onClick="doClose();">');
    if ((browser == 0) || (browser == 2)) {
      gallery.document.writeln('<div style="position:absolute; left=5; top=5; width='+xsize+'; height='+ysize+'; text-align=center; "><table width="'+xsize+'" border="0"><tr><td align="center"><br><br>Please wait for image to load.</td></tr></table></div>');
    }
    gallery.document.writeln('<div style="position:absolute;left:5;top:5">');
    gallery.document.writeln('<img src="'+loc+'" width="'+xsize+'" height="'+ysize+'" border="0" alt="'+fileStr+'">');
    gallery.document.writeln('</div></body></html>');
    gallery.document.close();
    gallery.focus();
    return false;
  }
//-->