
	var popup = '';
	var pics = new Array();

	function MakePopup(PictureSource, Caption)
	{
		myimage=new Image();
		myimage.src=PictureSource;
		
		for (i=0; i<pics.length; i++)
		{
			if (pics[i].src == myimage.src)
			{
				myimage = pics[i];
			}
		}
					
		if (!popup=='') {popup.close();}
			
		popup=window.open('','Viewer',  'width=' + myimage.width + ',height=' + eval(myimage.height + 50) + ',toolbar=0,scrollbars=0,left=200,top=200');
		popup.document.writeln('<html><body topmargin=0 leftmargin=0><table><tr><td><img src = "' + PictureSource + '"></td></tr>');
		popup.document.writeln('<tr><td align="center" style="FONT-SIZE: 70%">' + Caption + '</td></tr></table></body></html>');
		popup.document.close();
		
		if (window.focus) {popup.focus();}
		
		myimage=null;
	}
	
	function CreatePopupImageLink(MainPictureSource, PopupPictureSource, Caption)
	{		
		var str="<a HREF=\"javascript:MakePopup('" + PopupPictureSource + "','" + Caption + "');\">";
		str=str+"<img src = " + MainPictureSource + " border = 2 style = 'border-color: #666666'>";
		str=str+"</a>";
		
		document.write(str);	
		
		// Load the popup, so when it is clicked it won't have to download (which sometimes throws off the sizing code)
		temp = new Image();
		temp.src=PopupPictureSource;
		pics[pics.length] = temp;
	}

 