/* text caption; copyright note; image URL; width, height, 
   [extra width/height]
*/
function showImage(caption, copyright, image, wid, hei, dWid, dHei) {
  if (wid == null)
    wid = 200;
  if (hei == null)
    hei = 200;
  if (dWid == null)
    dWid = 20;
  if (dHei == null)
    dHei = 100;
  // only IE requires mapping characters in image name 
  var w = window.open ("", image.replace(/[^A-Za-z0-9]/g, "_"),
		       "width=" + (wid + dWid) + ",height=" + (hei + dHei)
		       + ",resizable=yes,scrollbars=yes,toolbar=no");
  var d = w.document;
  var base = document.URL;
  d.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
          '<html><head><meta http-equiv="Content-Type" ',
          'content="text/html; charset=UTF-8"> ',
          // at least one version of Firefox requires the <base> tag
          // at least one version of Konqueror fails if we append ".."
          // instead of removing the last component 
          '<base href="', base.substr (0, base.lastIndexOf("/") + 1), '">',
          '<title>Map Projections</title>',
	  '<style type="text/css">body{font-family:Verdana,Arial,sans-serif;',
	  'font-size:80%;background:white;color:black;}',
	  'span.small{font-size:90%}',
	  '</style></head>',
	  '<body><center><img src="' + image + '" alt=""');
  if (wid != null && hei != null)
    d.write(' width="' + wid 
	  + '" height="' + hei + '"');
  d.write ('></center><p>',
	   caption.replace(/'/g, '&apos;'),
          '</p><span class="small">Copyright &copy; ' + copyright +
	  ' -  All rights reserved - www.progonos.com/furuti</span>',
	  //	  '<br><a href="javascript:window.close();">Close</a>',
	  '</body></html>');
  d.close ();
}
/* normal image, normal width/height, [normal alt], large image, popup
caption/copyright note, large width/height, [extra width/height] */
function genImageTag(image, wid, hei, alt, imageL, caption, copyright, 
                     widL, heiL, dWid, dHei) {
  document.write ('<a href="javascript:showImage(\'', 
		  caption.replace (/'/g, "\\'"), '\', \'',
        copyright, '\', \'', imageL, '\'');
  if (widL != null && heiL != null) {
    document.write (',', widL, ',', heiL);  
    if (dWid != null && dHei != null)
      document.write (',', dWid, ',', dHei);  
  }
  if (alt == null)
    alt = caption;
  document.write (')" title="Larger image (in new window)">',
        '<img border=0 src="', image, '" alt="', alt, 
        '" width="', wid, '" height="', hei, '"><\/a>');
}

/* normal image, normal width/height, [normal alt], large image, popup
caption/copyright note, large width/height, [extra width/height] */
function genImageLink(text, title, imageL, caption, copyright, 
                     widL, heiL, dWid, dHei) {
  document.write ('<a href="javascript:showImage(\'', 
		  caption.replace (/'/g, "\\'"), '\', \'',
        copyright, '\', \'', imageL, '\'');
  if (widL != null && heiL != null) {
    document.write (',', widL, ',', heiL);  
    if (dWid != null && dHei != null)
      document.write (',', dWid, ',', dHei);  
  }
  document.write (')" title="', title, '">',
		  text, '<\/a>');
}
