﻿var img_desc = new Array('' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' );
var cur_pic = 0;
var current_pic = 0;
var newWindow;

function makeNewWindow(){
	if (!newWindow || newWindow.closed){
		newWindow = window.open("","sub","status,height=500,width=650");
		setTimeout("writeToWindow()",50);
	} else if (newWindow.focus){
		newWindow.focus();
	}
}

function writeToWindow() {
	var newContent = "<html><head><title>View Photo</title></head>";
	newContent += "<body><img src='" + document['picture'].src + "'></body></html>";
	newWindow.document.write(newContent);
	newWindow.document.close();
}

function doButtons(image_index) 
{
	document.picsel_form.pic_select.selectedIndex = cur_pic;
	eval("document['picture'].src = image" + image_index + ".src");

	//var e = document.getElementById('textdesc');
	//e.innerHTML = img_desc[cur_pic];
}

function choicechanged()
{
	var menu = document.picsel_form.pic_select;
	cur_pic = menu.selectedIndex;
	doButtons(cur_pic); 
}

function changepic()
{
	var menu = document.picsel_form.pic_select;
	cur_pic = menu.selectedIndex;
	doButtons(cur_pic); 
}

function movenext()
{
	// if we aren't at the last picture (numpics - 1) keep going forward
	// otherwise wrap around
	if (cur_pic != iPhoto)
		cur_pic = cur_pic + 1;
	else
		cur_pic = 0;
	doButtons(cur_pic);
}

function moveprev()
{
	// if we are moving backwards and are at the first pic, wrap
	// to the last one (numpics - 1)
	if (cur_pic != 0)
		cur_pic = cur_pic - 1;
	else
		cur_pic = iPhoto;
	doButtons(cur_pic);
}
	
function noGo()
{
	return;
}