
/* global image path */
var imgPath = "images";

/* swaps image for a new one */
function swapImage(selectList, descArray, imgType, img, textDiv)
{
	var selectIdx;			// selected index
	var imgSrc;				// location of image
	var imgName;			// name of image
	var imgId;				// name of image

	// get image name/id from select list
	selectIdx = selectList.selectedIndex;
	imgName = selectList.options[selectIdx].text;
	imgId = selectList.options[selectIdx].value;

	// if there is no name, use clearpixel
	if (imgName.length == 0)
		imgSrc = imgPath + "/clearpixel.gif";
	else
		imgSrc = imgPath + "/" + imgType + "/" + imgName;

	// set picture to new name
	eval("document." + img + ".src = '" + imgSrc + "';");
	eval("document." + img + ".alt = \"" + descArray[imgId] + "\";");

	// also update innerhtml of div with text
	var div = document.getElementById(textDiv);
	div.innerHTML = descArray[imgId];
}
