// Version 1.2.7 10/18/04

// Variable used by imgThumbnail and pagThumbnail functions
var tnlHeight = 100  // Height of thumbnail

// Variables used by imgPopup and pagPopup functions
var winLeft = 10  // Popup left location
var winTop = 10   // Popup top location
var winPopup = 0  // Popup window ID

// Include onUnload="cleanUp()" is body tag of host page

function cleanUp() {
  if (winPopup) winPopup.close();
}

// Set title of tooltip in language of browser

function langSet() {

  // Get language parameter
  if (navigator.appName == 'Netscape')
    var language = navigator.language;
  else
    var language = navigator.browserLanguage;

  // Output title statement
  document.write(' title="');
  if (language.substring(0,2)=="de") { 
      document.write("Klick für Vergrößerung");
  }
  else {
      if (language.substring(0,2)=="es") { 
        document.write("Haz click para agrandar");
      }
      else {
         document.write("Click to enlarge");
      }
  }
  document.write('"');
}

// Make a thumbnail linked to popup of the image
// Thumbnail image must have "-tn" appended to name (e.g. name-tn.jpg)
// Height of thumbnail images must match value of tnlHeight
// Images must be .jpg format only

function imgThumbnail(imgName,imgWidth,imgHeight,winTitle) {

  // Compute width of thumbnail image in pixels
  var tnlWidth = tnlHeight * imgWidth / imgHeight;
  tnlWidth = parseInt(tnlWidth);
  var tnlName = imgName.replace(/.jpg/i, "-tn.jpg");

  // Create the HTML to make the link and display the thumbnail image
  document.write('<a href="javascript:window.imgPopup(');
  document.write("'"+imgName+"','"+imgWidth+"','"+imgHeight+"','"+winTitle+"'");
  document.write(');"');
  langSet();
  document.write('><img src="'+tnlName+'" width='+tnlWidth+' height='+tnlHeight+' border=0 ></a> ');
}

// Popup a window
function imgPopup(imgName,imgWidth,imgHeight,winTitle) {

  // Close popup window if open
  if (winPopup) winPopup.close();

  // Create window at location 'left' and 'top'
  var windx = parseInt(imgWidth) + 4; // Hack for Firefox
  var windy = parseInt(imgHeight) + 4;
  winPopup = window.open("","Window","width="+windx+",height="+windy+",left="+winLeft+",top="+winTop);

  // Write an HTML page in popup window with a 1-cell table with the image in it
  winPopup.document.open();
  winPopup.document.write('<html><title>'+winTitle+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#800000" text="#FFFFFF" onMouseDown="self.close()">');  
  winPopup.document.write('<table width='+imgWidth+' height='+imgHeight+' border="0" cellspacing="0" cellpadding="0" align="center"><tr><td>');
  winPopup.document.write('<img src="'+imgName+'" width='+imgWidth+' height='+imgHeight+' >');
  winPopup.document.write('</td></tr></table></body></html>');
  winPopup.document.close();

  // Set focus so popup will be on top of other windows
  winPopup.focus();
}

// Make a thumbnail linked to popup the specified page
// The width of the page is assumed to be the width of the image
// Thumbnail image must have "-tn" appended to name (e.g. name-tn.jpg)
// Height of thumbnail images must match value of tnlHeight
// Images must be .jpg format only

function pagThumbnail(pagName,pagHeight,imgName,imgWidth,imgHeight) {

  // Compute width of thumbnail image in pixels
  var tnlWidth = tnlHeight * imgWidth / imgHeight;
  tnlWidth = parseInt(tnlWidth);
  var tnlName = imgName.replace(/.jpg/i, "-tn.jpg");

  // Create the HTML to make the link and display the thumbnail image
  document.write('<a href="javascript:window.pagPopup(');
  document.write("'"+pagName+"','"+imgWidth+"','"+pagHeight+"'");
  document.write(');"');
  langSet();
  document.write('><img src="'+tnlName+'" width='+tnlWidth+' height='+tnlHeight+' border=0 ></a> ');
}

// Popup a window with a page in it

function pagPopup(pagName,pagWidth,pagHeight) {

  // Close popup window if open
  if (winPopup) winPopup.close();

  // Create window at location 'left' and 'top'
  winPopup = window.open(pagName,"Window","resizable=yes,width="+pagWidth+",height="+pagHeight+",left="+winLeft+",top="+winTop);

  // Set focus so popup will be on top of other windows
  winPopup.focus();
}