var popup = null;

function win(name, wid, ht) {
 wid += 20;
 ht += 20;
 if ((popup == null) || popup.closed) {
  props = "scrollbars=yes";
  props += ",resizable=yes";
  props += ",width=" + wid;
  props += ",height=" + ht;
  popup = window.open("", name, props);
 } else
  popup.resizeTo(wid, ht);
 popup.focus();
}

function pic(url, wid, ht) {
 if (wid > 800)
  winwid = 800;
 else
  winwid = wid;
 if (ht > 700)
  winht = 700;
 else
  winht = ht;
 winwid += 20;
 winht += 20;
 if ((popup == null) || popup.closed) {
  props = "scrollbars=yes";
  props += ",resizable=yes";
  props += ",width=" + winwid;
  props += ",height=" + winht;
  popup = window.open("", "pic", props);
 } else
  popup.resizeTo(winwid, winht);
 popup.document.open("text/html", "replace");
 popup.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n');
 popup.document.write(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n');
 popup.document.write('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n');
 popup.document.write('<head><title>' + url + '</title></head>\n');
 popup.document.write('<body><p>\n');
 popup.document.write('<a href="#" onclick="window.close(); return false;">\n');
 popup.document.write('   <img src="' + url + '"\n');
 popup.document.write('        alt="" style="width: ' + wid + 'px; height: ' + ht + 'px;" /></a>\n');
 popup.document.write('</p></body>\n');
 popup.document.write('</html>\n');
 popup.document.close();
 popup.focus();

 return false;
}

function close_win() {
 if (popup != null) {
  if (popup.open) popup.close();
  popup = null;
 }
}

