var newwindow;
function popimage(url, title, color) {
  var pwidth, pheight;
  foto1= new Image();
  foto1.src=(url);
  iwidth=foto1.width;
  iheight=foto1.height;

  if ( !newwindow || newwindow.closed ) {
    pwidth=iwidth+40;
    pheight=iheight+80;
    newwindow=window.open('','htmlname','width=' + pwidth +',height=' +pheight + ',resizable=1,top=100,left=100');
  }

  newwindow.resizeTo(iwidth+40, iheight+80);

  newwindow.document.clear();
  newwindow.focus();
  newwindow.document.writeln('<html> <head> <title>' + title + '<\/title> <\/head> <body bgcolor= \"' + color + '\"> <center>');
  newwindow.document.writeln('<a href="javascript:window.close()"><img src=' + url + ' border="0" alt="Close This Window"></a>');
  newwindow.document.writeln('<br><FONT COLOR="gray">Click Image to Close<\/FONT><\/center> <\/body> <\/html>');
  newwindow.document.close();
  newwindow.focus();
}


// Routines to tidy up popup windows when page is left
// Call with an onUnload="tidy5()" in body tag

function tidy5() {
  if (newwindow && !newwindow.closed) { newwindow.close(); }
}


// Popup for Text Only
function poptext(url,iwidth,iheight){
  newwindow=window.open(url, 'htmlname','width=' + iwidth +',height=' + iheight + ',scrollbars,resizable=1,top=150,left=150');
//  newwindow.resizeTo(400,500);
  newwindow.document.clear();
  newwindow.focus();
  newwindow.document.close();
  newwindow.focus();
}

