// height refers to the heights of each image in numerical order (name order is: Eugene, Chicago Studio, Macalester Studio,)
var height = new Array("160", "120", "121", "127", "168", "181", "170", "178", "177", "189", "179", "170", "145", "196", "186", "116", "106", "180", "169", "129", "123", "158", "157", "122", "209", "182", "170", "209", "175", "175", "138", "139", "112", "139", "139", "139", "137", "138", "138", "139", "139", "139", "139", "172", "186", "188", "189", "173", "186", "188", "174", "159", "162", "195", "144", "116", "103", "112", "112", "100", "125", "171", "145", "163", "142", "169", "170", "137", "137", "186", "105", "95", "85", "75", "103", "174", "165", "187", "176", "158", "188", "175", "176", "97", "95", "159", "132", "201", "199", "203", "197", "184", "193");
var whichImage;

/*
***********************************************************
	randomImage()

	- function that selects & displays random gallery image
***********************************************************
*/

	function randomImage() {
		var images = new Array(93);
		var path = 'images/random/';
		var whichImage;		

		// fill array
		for(i = 0; i < images.length; i++) {
			images[i] = path + (i + 1) + 'Random.jpg';
		}

		whichImage = Math.floor(Math.random() * (images.length));		

		document.write('<table border="0" cellpadding="0" cellspacing="0">');
		document.write('<tr><td background="images/borderLeft.gif">');
		document.write('<img src="images/clearpixel.gif" width="7" height="1" border="0">');
		document.write('</td><td align="left" width="142" background="images/backgroundBody.gif">');
		document.write('<table border="0" cellpadding="2" cellspacing="0">');
		document.write('<tr><td height="211">');
//		document.write('<a href="javascript:dispRandImage(whichImage, \'Random\')">');
		document.write('<img src="' + images[whichImage] + '" width="138" height="' + height[whichImage] + '" border="0">');
//		document.write('</a>');
		document.write('</td></tr><tr><td class="eleven">');
		document.write('Random Gallery Image');
		document.write('</td></tr></table></td><td background="images/borderRight.gif">');
		document.write('<img src="images/clearpixel.gif" width="7" height="1" border="0">');
		document.write('</td></tr></table>');
	}

/*
***********************************************************
	end randomImage()
***********************************************************
*/

/*
***********************************************************
	dispImage(), dispRandImage(), indexRand()

	- function that displays large gallery images
	- function that displays large random gallery (not in use)
	- function that displays random welcome screen image
***********************************************************
*/

	function dispImage(whichImg, whichNum) {
		var width = 570;
		var height = 600;
		var leftPos = (screen.width) ? (screen.width - width) / 2 : 0;
//		var topPos = (screen.height) ? (screen.height - height) / 2 : 0;

		window.open(whichImg + whichNum + '.htm', 'Gallery', 'width=' + width + ',height=' + height + ',top=0,left=' + leftPos + ',scrollbars=yes,toolbar=no,menubar=no,location=no,resizable=no');
	}

	function dispRandImage(whichRandImg, whichRandNum) {
		var widthRand = 550;
		var heightRand = 570;
		var leftPosRand = (screen.width) ? (screen.width - widthRand) / 2 : 0;
		var topPosRand = (screen.height) ? (screen.height - heightRand) / 2 : 0;

		window.open('random.htm', (whichRandImg + 1) + whichRandNum, 'width=' + widthRand + ',height=' + heightRand + ',top=' + topPosRand + ',left=' + leftPosRand + ',scrollbars=no,toolbar=no,menubar=no,location=no,resizable=no');
	}

	function indexRand() {
		var indexThumb = new Array(4);
		var thumbHeight = new Array("226", "223", "228", "221");
		var whichRand;

		for(j = 0; j < indexThumb.length; j++) {			
			indexThumb[j] = 'images/self/thumbs/self' + (j + 4) + 'Thumb.jpg';
		}
		
		whichRand = Math.floor(Math.random() * (indexThumb.length));

		document.write('<img src="' + indexThumb[whichRand] + '" width="155" height="' + thumbHeight[whichRand] + '" border="0">');
	}
/*
************************************************************
	end dispImage(), dispRandImage(), indexRand()
************************************************************
*/

/*
***********************************************************
	snapTo()

	- function that snaps body height to random img size
	- distance refers to the total number of pixels
		needed to align body with left-side
	- distance is determined from actual page function
***********************************************************
*/
		function snapTo(distance) {
			document.write('<img src="images/clearpixel.gif" width="1" height="' + (211 - distance) + '" border="0">');
//			document.write('<img src="images/clearpixel.gif" width="1" height="' + (height[whichImage] - distance) + '" border="0">');
		}
/*
***********************************************************
	end snapTo()
***********************************************************
*/
