	// AWD orig 1/12/00, revised 1/29/03
var imageIndex;   
var imageLength;
var flagOne = 0;
var whichArray;
var imageData;

function randomimage() {
	whichArray = document.displaynames.category.options[document.displaynames.category.selectedIndex].value;
	if (document.images) {
		var randnumb = Math.random();
		imageIndex = Math.round(2 * randnumb);
			//alert("imageIndex: " + imageIndex);
			//alert("array length: " + imageLength + "   randImage: " + imageIndex);
			//alert("image: " + "tour/" + imageName[imageIndex] +".jpg");
		//var imageSource = "equip/" + imageNameC[imageIndex]
		//document.nowshowing.src = imageSource;
		//document.displaytitles.title.value = imageTitleC[imageIndex];
		//document.displaycomments.comments.value = imageCommentsC[imageIndex];
		
		//var imageSource = "tours/"+imageName[imageIndex]+".jpg"
		//document.nowshowing.src = imageSource;
		redirect(document.displaynames.category.options.selectedIndex);
		displayImages();
		displayTitle();
	}
}

	// Display a specific image from the drop-down box.
function selectImages(form) {
	if (document.images) {
        imageIndex = form.selection.options[form.selection.selectedIndex].value;
			//alert("index length: " + imageData.length)
		//var indexLength = imageData.length;
		//imageIndex = imageData.substring(0, indexLength);
		//whichArray = imageData.charAt(0);
			//alert("imageIndex: " + imageIndex + "      which array: " + imageData.charAt(0));
		displayImages();
		
		//displayImages();
		//var imageSource = "tours/"+imageName[imageIndex]+".jpg"
        //document.nowshowing.src = imageSource;
	}
}

function displayImages()  {
	whichArray = document.displaynames.category.options[document.displaynames.category.selectedIndex].value;
		//alert("whichArray:" + whichArray + "    imageIndex: " + imageIndex);

	var imageSource
	if(whichArray == "C") {imageSource = "equip/" + imageNameC[imageIndex]};
	if(whichArray == "H") {imageSource = "equip/" + imageNameH[imageIndex]};
	if(whichArray == "P") {imageSource = "equip/" + imageNameP[imageIndex]};
	if(whichArray == "B") {imageSource = "equip/" + imageNameB[imageIndex]};
			//alert("imageSource: " + imageSource);
	document.nowshowing.src = imageSource;
	flagOne = 1
}


	// This displays the title & description of the product
function displayTitle()  {
	if (document.images) {
		if (flagOne == 1) {
			if(whichArray == "C")  {
				document.displaytitles.title.value = imageTitleC[imageIndex];
				document.displaycomments.comments.value = imageCommentsC[imageIndex];
				imageLength = imageNameC.length - 1;
			}
			if(whichArray == "H")  {
				document.displaytitles.title.value = imageTitleH[imageIndex];
				document.displaycomments.comments.value = imageCommentsH[imageIndex];
				imageLength = imageNameH.length - 1;
			}
			if(whichArray == "P")  {
				document.displaytitles.title.value = imageTitleP[imageIndex];
				document.displaycomments.comments.value = imageCommentsP[imageIndex];
				imageLength = imageNameP.length - 1;
			}
			if(whichArray == "B")  {
				document.displaytitles.title.value = imageTitleB[imageIndex];
				document.displaycomments.comments.value = imageCommentsB[imageIndex];
				imageLength = imageNameB.length - 1;
			}
		}
	}
}

	// This little dandy writes out the supplies information if there is any
function showSupplies()  {
	var pageStart = "<html><head><title>Equipment Supplies</title><link rel='stylesheet' href='scripts/shaker.css' type='text/css'></head>";
	pageStart += "<body><div align='center'><table border='0' cellpadding='0' cellspacing='0' width='400'>";
	pageStart += "<tr><td bgcolor='#ddffdd' class='bigSans' align='center'><b>Suggested Supplies</b></td></tr>";
	pageStart += "<tr><td class='bodySans'><br><b>As a compliment to the equipment you rent</b>, may we suggest your considering the purchase of the following work related supplies.<br><br></td></tr>";
	pageStart += "<tr><td class='bodySans'>"
	var pageEnd = "</td></tr></table></div></body></html>";
	var suppliesList = imageSupplies[imageIndex];
		//alert(suppliesList);
	openPopUpWindow("supplies_list.htm");
	popupWin.document.write(pageStart + suppliesList + pageEnd);
	popupWin.document.write.close;
}

	// These two functions increment and/decrement the images.
function turnLeft()  {
	closePopUpWindow();
	imageIndex--;
	if (imageIndex < 0)  { imageIndex = imageLength };
	displayImages();
}

function turnRight()  {
	closePopUpWindow();
	//alert(imageIndex);
	imageIndex++;
	if (imageIndex > imageLength)  { imageIndex = 0 };
	displayImages();
}

function go()  {
	if (document.images) {
        imageIndex = document.displaynames.selection.options[document.displaynames.selection.selectedIndex].value;
		displayImages();
	}
}