
// Create arrays for images. This info will be used by
// multiple functions, so it is important that this js file
// be included before any other js file so these arrays are initialized.
//
// Create the array for the thumbnails
image = new Array()
image[0] = '1'
image[1] = '2'
image[2] = '3'
image[3] = '4'
image[4] = '5'
image[5] = '6'
image[6] = '7'
image[7] = '8'
image[8] = '9'
image[9] = '10'
image[10] = '11'
image[11] = '12'
image[12] = '13'
image[13] = '14'
image[14] = '15'
image[15] = '16'

// Create an array for the descriptions.
// Currently this isn't being used because Cheo
// hasn't given me descripitons
desc = new Array()
desc[0] = 'thumb1'
desc[1] = 'thumb2'
desc[2] = 'thumb3'
desc[3] = 'thumb4'
desc[4] = 'thumb5'
desc[5] = 'thumb6'
desc[6] = 'thumb7'
desc[7] = 'thumb8'
desc[8] = 'thumb9'
desc[9] = 'thumb10'
desc[10] = 'thumb11'
desc[11] = 'thumb12'
desc[12] = 'thumb13'
desc[13] = 'thumb14'
desc[14] = 'thumb15'
desc[15] = 'thumb16'

function preloadImg() {
	tmpImage = new Image();
	for (var i=0; i<image.length; i++) {
		tmpImage.src = 'images/gallery/' + image[i] + '.gif';
	}
}

function swapImage(picNum) {
	document.mainImage.src = 'images/gallery/' + image[picNum] + '.gif';
	picText = '' + picNum + '.gif';
	hResPath = 'images/highres/' + image[picNum] + '.jpg';
	document.getElementById('galleryDesc').innerHTML = desc[picNum];
	document.getElementById('highResImg').href = hResPath;
}
function setGalleryImage() {
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			if (key == "pic" && val < image.length) {
				document.mainImage.src = 'images/gallery/' + image[val] + '.gif';
				hResPath = 'images/highres/' + image[val] + '.jpg';
				document.getElementById('galleryDesc').innerHTML = desc[val];
				document.getElementById('highResImg').href = hResPath;
			}
		}
	}
}