var pic_num = new Array(0,0,0);

function select_pictures()
{
	var tmp_str;

	// this function will select three DISTINCT random numbers between 1 and the number of
	// images in the directory (as defined above) and use those numbers to assign the images
	// to the three picture frames in the HTML document

	// assign the first number
	pic_num[0] = (Math.floor(Math.random() * number_of_images) + 1);

	// assign the next number, making sure that it's not the same as the first
	do
	{
		pic_num[1] = (Math.floor(Math.random() * number_of_images) + 1);
	}
	while (pic_num[0] == pic_num[1]);

	// assign the next number, making sure that it's not the same as the first
	do
	{
		pic_num[2] = (Math.floor(Math.random() * number_of_images) + 1);
	}
	while (pic_num[0] == pic_num[2] || pic_num[1] == pic_num[2]);

	// finally, assign the selected pictures to the image fields in the HTML code
	// note: the alt property is loaded with the name of the larger picture.  This
	// is used to retrieve the larger picture when the smaller picture is clicked

	// picture number 1
	tmp_str = "Images/Image";
	if(pic_num[0] < 10)
	{
		tmp_str = tmp_str + "0";
	}
	document.CurrentForm.pic1.src = tmp_str + pic_num[0] +"sm.jpg";
	document.CurrentForm.pic1.alt = tmp_str + pic_num[0] +".jpg";

	// picture number 2
	tmp_str = "Images/Image";
	if(pic_num[1] < 10)
	{
		tmp_str = tmp_str + "0";
	}
	document.CurrentForm.pic2.src = tmp_str + pic_num[1] +"sm.jpg";
	document.CurrentForm.pic2.alt = tmp_str + pic_num[1] +".jpg";

	// picture number 3
	tmp_str = "Images/Image";
	if(pic_num[2] < 10)
	{
		tmp_str = tmp_str + "0";
	}
	document.CurrentForm.pic3.src = tmp_str + pic_num[2] +"sm.jpg";
	document.CurrentForm.pic3.alt = tmp_str + pic_num[2] +".jpg";
}


function open_large_picture(picture_clicked)
{

	// this function is called whenever any of the pictures on the page are clicked
	// it will open a new browser window and load it with the large version of the
	// picture that was selected

	switch (picture_clicked)
	{
		case 1:
			window.open(document.CurrentForm.pic1.alt);
			break;
		case 2:
			window.open(document.CurrentForm.pic2.alt);
			break;
		case 3:
			window.open(document.CurrentForm.pic3.alt);
			break;
	}
}


