
var photo= new Array();			// Array created by function photoArray in pictures.js
var pictures = new Array();		// Array fir selected pictures to display. Contains relative record number in photo()
var pixIndx	= 0;				// index for pictures array

var iMonth = 0;				// letter month to display
var iYear = "";					// letter year to display
var iType= "";					// activity type to display
var showAll = true;				
var photoNum = 0;				// current displayed photo index
var photoDetail = "";			// work area to build string for photo using the following vars
var photoIncr = 1;				// photo dirction increment. Used ingetPhoto

var txt1 ='<html><body style="width:960px;position:absolute;"><center><img src=\"../Pictures/' 
var txt2 = '\"></center><p>';
var txt3 = '\" width= \"';
var txt4 = '\" height=\"';
var txt5 = '</body></html>';
var txt6 = '<form><center><p><input type=\"button\" name=\"Button1\" value=\"Close the window.\" onclick=\"self.close()\"></p></center></form>';
	

// vars derived from the picture.js record
var photoID = "";
var photoMonth = "";
var photoYear = "";
var photoDesc = "";
var photoHeight = "";
var photoWidth = "";
var photoAct = "";

var currentLetter ="";			// name of currently displayed letter
var currentPhoto="";			// id of last photo shown

var monArray = new Array (
"January","February","March","April","May","June","July","August","September","October","Novemner","December")

// Photo object constructor. Called from pictures.js
function newPhoto( pID, pMonth, pYear, pDesc, pWidth, pHeight, pAct)		
{ 
	this.ID = pID;
	this.Month = pMonth;
	this.Year = pYear;
	this.Desc = pDesc;
	this.Width = pWidth;
	this.Height=pHeight;
	this.Activity= pAct;
	this.show = photoShow;
}

// get photo info from array. Called from doInit
function findPhoto (ix)							
{
	photoID =photo[ix].ID;
	photoMonth = photo[ix].Month;
	photoYear = photo[ix].Year;
	photoDesc =photo[ix].Desc;
	photoWidth =photo[ix].Width;
	photoHeight=photo[ix].Height;
	photoAct=photo[ix].Activity;
}

function doFindAct () 					// find only photos for selected activity
{
var ix = 0;
// initialize picture array
	pictures = new Array();			// clear array, add all elements of phot array
	pixIndx =0;						// initialize ptr to first in array

for (ix = 0; ix <= photo.length-1; ix++)	// test all records
	{
		findPhoto(ix);					// get test record
 		if (photoAct == iType)	
			pictures[pixIndx++] = ix;
	}
	PixIndx =0;	
//	getPhoto();
	photoShow ();

}

function doLocate (act, parm) 					// find only photos for selected parameter
{
	if (act=="year")
	{
		iYear = parm;
		doFindYr();
	}
	else
	{
		iType = parm;			// test activity
		doFindAct();
	};
}
// *******************

// show() - photo object method
function photoShow () 							
{
	photoDetail = txt1 + photoID + ".jpg";
	photoDetail = photoDetail+ txt3 + photoWidth + 'px';
	photoDetail = photoDetail + txt4 + photoHeight + 'px' + txt2 + "<center>" ;
	if (photoMonth != " " ){	photoDetail = photoDetail + photoMonth};
//	if (photoYear != " " ){	photoDetail = photoDetail + photoYear + " "};
	photoDetail = photoDetail + photoDesc +"</center>" ;
	//	photoDetail = photoDetail +  "<p><hr>" ;
	photoDetail = photoDetail + txt6 + txt5;
	
//	document.open();
	newWindow = window.open ("","newWindow");
	newWindow.document.write(photoDetail ); 		// show photo
	newWindow.document.close();
}

function doFindPhoto (pID){
	pixIndx =0;						// initialize ptr to first in array
	for (ix = 0; ix <= photo.length-1; ix++)	// test all records
		{
		findPhoto(ix);					// get test record
 		if (photoID == pID) 
 			{
	 			pixIndx =ix;
	 			break;
 			}
		}
	findPhoto(ix);
	photoShow ();
}


function doInit()					// initailize on entry
{
	photoNum =0;
	iYear = 2000;
	photoArray();
//	doAll();						// initialize
}
