/////////  Copyright (c) 2001 J. Mark Hord, pajtim@hotmail.com
//  A simple image viewer that allows expansion of thumbnail images
// and provides for a caption and preferred size for each.
//
//  Use as follows:
//  <SCRIPT language="JavaScript" src="ThisFilePath"></SCRIPT>
//  <SCRIPT language="JavaScript"> // first, create a list of images:
//    theImages = new ImageList(400, 400);  // with width and height of thumbnail area
//    theImages.add("quantrill.gif", 123, 168); // Add to the list with filepath, width, height[, caption]
//    theImages.add("deovindice.gif", 378, 85, "We will never forget");
//    buildViewer(theImages); // build the image viewer with the image list
//  </SCRIPT>
//////////

browser = navigator.appName;
var ie = "Microsoft Internet Explorer";
var nscp = "Netscape";

function ImageItem(i, w, h) {
	this.file = i;
}

function addImage(image, caption) {
	var theImg = new ImageItem(image);
	if( caption != null )
		theImg.capt = caption;
	else
		theImg.capt = "    ";
	this.theList[ this.theList.length ] = theImg;
}

function ImageList(h, w) {
	this.theList = new Array();
	this.add = addImage;
	if( h != null )
		this.h = h;
	else
		this.h = 50;
	if( w != null )
		this.w = w;
	else
		this.w = 50;
}

function Shrink(sz) {
  if( sz > 100 )
		return sz / 4;
	else
		return sz;	
}

function Biggun(i, c) {
	document.MnView.src = i;
	//document.MnView.width = "" + w;
	//document.MnView.height = "" + h;
	document.MnView.alt = c;
	document.MnView.title = c;
	if(browser == ie) {
		document.all['MnCaption'].innerText = c;
	} 
}

function buildViewer(imgs) {
document.write('<p>Click the links to view the picture.</p><br>');

//// the main image
document.write(
	'<table border="1" width="100%"><tr><td><DIV style={height:600;width:500;overflow:auto}>');
document.write('<IMG NAME=MnView SRC="' + imgs.theList[0].file 
	//+ '" width=' + imgs.theList[0].wide + ' height=' + imgs.theList[0].high
	+ '" alt="' + imgs.theList[0].capt + '" title="' + imgs.theList[0].capt
	+ '">');
if(browser == ie) {
	document.write('<P ID=MnCaption NAME=MnCaption>' + imgs.theList[0].capt + '</P>');
	}
document.write('</DIV></td>');

//// the thumbnails
document.write('<td><DIV style={height:400'  
	+ ';width:400' + ';overflow:auto}>');
for(ii=0; ii<imgs.theList.length; ii++) {
	//var tmpFile = imgs.theList[ii];
	document.write('<a href="javascript:Biggun(\'' + imgs.theList[ii].file 
		+ '\', \'' + imgs.theList[ii].capt + '\''
		+ ')">' + imgs.theList[ii].capt + '<a><br>');
		}
document.write('</DIV></td></tr></table>');
}



