

function buildThumbs() {

	switch (thisArray[0][2]) {

		case "layout1":
		colNum = 3;
		tableBegin = "<table border=\"0\" width=\"560\"><tr><td>";
		tableEnd = "</td></tr><tr><td colspan=\"" + colNum + "\">";
		tableEnd += "<font class=\"NormalBodyCopy\">" + thisArray[0][1] + "</font>";
		tableEnd += "</td></tr></table>";
		break;

		case "layout2":
		colNum = 3;
		tableBegin = "<table border=\"0\" width=\"560\"><tr valign=\"top\"><td width=\"180\">";
		tableBegin +=  "<font class=\"NormalBodyCopy\">" + thisArray[0][1] + "</font></td><td width=\"380\">"
		tableEnd = "</td></tr></table>";
		break;

		case "layout3":
		colNum = 2;
		tableBegin = "<table border=\"0\" width=\"560\"><tr><td>";
		tableEnd = "</td></tr><tr><td colspan=\"" + colNum + "\">";
		tableEnd += "<font class=\"NormalBodyCopy\">" + thisArray[0][1] + "</font>";
		tableEnd += "</td></tr></table>";
		break;

		case "layout4":
		colNum = 2;
		tableBegin = "<table border=\"0\" width=\"560\"><tr valign=\"top\"><td width=\"180\">";
		tableBegin +=  "<font class=\"NormalBodyCopy\">" + thisArray[0][1] + "</font></td><td width=\"380\">"
		tableEnd = "</td></tr></table>";
		break;

		default:
		break;

	}

	thumbTable = iterateThumbs(colNum);
	document.write("<img src=\"images/" + thmbArray + "_title.gif\">");
	document.write(tableBegin + thumbTable + tableEnd);

}

function iterateThumbs(colNum) {
	returnStr = "<table border=\"0\" width=\"100%\" cellpadding=\"4\">";
	count = thisArray.length; 
	for (i = 1; i < count; i++) {
		var thisTitle = thisArray[i][0];
		//if (i==1) document.write("<tr><td colspan=\"" + colNum + "\">  <font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#CEB552\"><b>Click on an image</b></font></td></tr><tr valign=\"top\">")
		if (i==1) returnStr += "<tr>";
		if ((i != 1)&&(parseInt(i - 1) % colNum == 0)) returnStr += "</tr>\n  <tr valign=\"top\">";
		var thisLink = "display.htm?thisArray=" + escape(thmbArray) + "&item=" + i
		returnStr += "<td><a href=\"" + thisLink + "\"><img src=\"images/" + thisArray[i][1] + "\" alt=\"" + thisArray[i][0] + "\" border=\"0\"></a></td>";
	}
	//make sure we properly finish writing table
	while (parseInt(i - 1) % colNum !=0) {
		i++
		returnStr += "<td>&nbsp;*</td>";
	}
	returnStr += "</tr></table>"
	return returnStr;
}

function displayImage() {
	var nxtItem = (thisItem < thisArray.length - 1)? parseInt(thisItem) + 1:1;
	var prvItem = (thisItem > 1)? thisItem - 1:thisArray.length - 1;
	document.write("<img src=\"images/" + thmbArray + "_title.gif\" width=\"220\" height=\"13\"><br>");
	document.writeln("<table width=\"560\"><tr><td><img src=\"images/spacer.gif\" width=\"425\" height=\"1\"></td><td><img src=\"images/spacer.gif\" width=\"135\" height=\"1\"></td></tr><tr valign=\"top\"><td width=\"425\" align=\"center\">");
	document.writeln("<img src=\"images/" + thisArray[thisItem][2] + "\">")
	document.writeln("</td><td width=\"135\">");
	document.writeln("<a href=\"display.htm?thisArray=" + thmbArray + "&item=" + prvItem + "\" onmouseover=\"document.backarrow.src=prevarrow_2.src\" onmouseout=\"document.backarrow.src=prevarrow_1.src\"><img src=\"images/arrow_back_1.gif\" height=\"17\" width=\"18\" name=\"backarrow\" border=\"0\" alt=\"previous image\"></a>&nbsp;<a href=\"display.htm?thisArray=" + thmbArray + "&item=" + nxtItem + "\" onmouseover=\"document.nextarrow.src=nextarrow_2.src\" onmouseout=\"document.nextarrow.src=nextarrow_1.src\"><img src=\"images/arrow_next_1.gif\" height=\"17\" width=\"18\" name=\"nextarrow\" border=\"0\" alt=\"next image\"></a>");
	document.writeln("<br><font class=\"NormalBodyCopy\"><b>" + thisArray[thisItem][0] + "</b>");
	document.writeln("<br><br>" + thisArray[thisItem][3]);
	document.writeln("<br>" + thisArray[thisItem][4]);
	document.writeln("<br>" + thisArray[thisItem][5]);
	document.writeln("</font></td></tr></table>");
}


//This generic function will return the value of a QueryString
function getQueryString(Val) {
	thisURLparamStr = document.location.search;
	//chop "?" off thisURLparamStr
	if (thisURLparamStr.charAt(0) == "?") thisURLparamStr = thisURLparamStr.substring(1, thisURLparamStr.length);
	returnStr = "";
	if (thisURLparamStr != "") {
		//Build array out of thisURLparamStr using "&" as delimiter
		divide1=(thisURLparamStr.split("&"))
		for (i=0; i < divide1.length; i++) {
			divide2 = divide1[i].split("=")
			if (unescape(divide2[0]) == Val) {
				returnStr = unescape(divide2[1]);
			}
		}
	}
	return returnStr;
}