
function open_popup(name,width,height,file){
  var documentLocation = file;
  var documentName = name;
  var documentProperties = "width="+width;
  documentProperties += ",height="+height;
  documentProperties += ",status=no,toolbar=no,menubar=no";
  var mypopup = window.open(documentLocation,documentName,documentProperties);
  mypopup.focus();
}

function image_popup(name,width,height,file){
  var image = new Image();
  image.src=file;
  if (width==0) { width=image.width; }
  if (height==0) {height=image.height; }
  var documentLocation = '';
  var documentName = name;
  var documentProperties = "width="+width;
  documentProperties += ",height="+height;
  documentProperties += ",status=no,toolbar=no,menubar=no";
  var mypopup = window.open(documentLocation,documentName,documentProperties);
  
  var pageContent = '<html>\n';
  pageContent += '<title>'+name+'</title>\n';
  pageContent += '<head>\n';
  pageContent += '<style>body{margin:0px;padding:0px;}</style>\n';
  pageContent += '</head>\n';
  pageContent += '<body>\n';
  pageContent += '<img src="'+image.src+'" onClick="window.close();">\n';
  pageContent += '</body>\n';
  pageContent += '</html>\n';
  mypopup.document.write(pageContent);
  mypopup.document.close();
  mypopup.focus();
}

function close_popup(name){
  window.name=name;
  window.close();
  
}

