var ImageArray0 = new Array("pictures/photos/B-Deviled-F08/1.jpg", "pictures/photos/B-Deviled-F08/2.jpg", "pictures/photos/B-Deviled-F08/3.jpg", "pictures/photos/B-Deviled-F08/4.jpg", "pictures/photos/B-Deviled-F08/5.jpg", "pictures/photos/B-Deviled-F08/6.jpg", "pictures/photos/B-Deviled-F08/7.jpg", "pictures/photos/B-Deviled-F08/8.jpg", "pictures/photos/B-Deviled-F08/9.jpg", "pictures/photos/B-Deviled-F08/10.jpg", "pictures/photos/B-Deviled-F08/11.jpg", "pictures/photos/B-Deviled-F08/12.jpg", "pictures/photos/B-Deviled-F08/13.jpg", "pictures/photos/B-Deviled-F08/14.jpg", "pictures/photos/B-Deviled-F08/15.jpg", "pictures/photos/B-Deviled-F08/16.jpg", "pictures/photos/B-Deviled-F08/17.jpg", "pictures/photos/B-Deviled-F08/18.jpg", "pictures/photos/B-Deviled-F08/19.jpg", "pictures/photos/B-Deviled-F08/20.jpg", "pictures/photos/B-Deviled-F08/21.jpg", "pictures/photos/B-Deviled-F08/22.jpg", "pictures/photos/B-Deviled-F08/23.jpg", "pictures/photos/B-Deviled-F08/24.jpg", "pictures/photos/B-Deviled-F08/25.jpg", "pictures/photos/B-Deviled-F08/26.jpg");
var ImageArray1 = new Array("pictures/photos/BlueRidgeThawout-B-S09/1.jpg", "pictures/photos/BlueRidgeThawout-B-S09/2.jpg", "pictures/photos/BlueRidgeThawout-B-S09/3.jpg", "pictures/photos/BlueRidgeThawout-B-S09/4.jpg", "pictures/photos/BlueRidgeThawout-B-S09/5.jpg", "pictures/photos/BlueRidgeThawout-B-S09/6.jpg", "pictures/photos/BlueRidgeThawout-B-S09/7.jpg", "pictures/photos/BlueRidgeThawout-B-S09/8.jpg", "pictures/photos/BlueRidgeThawout-B-S09/9.jpg", "pictures/photos/BlueRidgeThawout-B-S09/10.jpg", "pictures/photos/BlueRidgeThawout-B-S09/11.jpg", "pictures/photos/BlueRidgeThawout-B-S09/12.jpg");
var ImageArray2 = new Array("pictures/photos/Boone-F08/1.jpg", "pictures/photos/Boone-F08/2.jpg", "pictures/photos/Boone-F08/3.jpg", "pictures/photos/Boone-F08/4.jpg", "pictures/photos/Boone-F08/5.jpg", "pictures/photos/Boone-F08/6.jpg", "pictures/photos/Boone-F08/7.jpg", "pictures/photos/Boone-F08/8.jpg", "pictures/photos/Boone-F08/9.jpg", "pictures/photos/Boone-F08/10.jpg", "pictures/photos/Boone-F08/11.jpg", "pictures/photos/Boone-F08/12.jpg", "pictures/photos/Boone-F08/13.jpg", "pictures/photos/Boone-F08/14.jpg", "pictures/photos/Boone-F08/15.jpg", "pictures/photos/Boone-F08/16.jpg", "pictures/photos/Boone-F08/17.jpg", "pictures/photos/Boone-F08/18.jpg", "pictures/photos/Boone-F08/19.jpg", "pictures/photos/Boone-F08/20.jpg", "pictures/photos/Boone-F08/21.jpg", "pictures/photos/Boone-F08/22.jpg", "pictures/photos/Boone-F08/23.jpg", "pictures/photos/Boone-F08/24.jpg");
var ImageArray3 = new Array("pictures/photos/DOG-B-S09/1.jpg", "pictures/photos/DOG-B-S09/2.jpg", "pictures/photos/DOG-B-S09/3.jpg", "pictures/photos/DOG-B-S09/4.jpg", "pictures/photos/DOG-B-S09/5.jpg", "pictures/photos/DOG-B-S09/6.jpg", "pictures/photos/DOG-B-S09/7.jpg", "pictures/photos/DOG-B-S09/8.jpg", "pictures/photos/DOG-B-S09/9.jpg", "pictures/photos/DOG-B-S09/10.jpg", "pictures/photos/DOG-B-S09/11.jpg", "pictures/photos/DOG-B-S09/12.jpg", "pictures/photos/DOG-B-S09/13.jpg");
var ImageArray4 = new Array("pictures/photos/MardiGras-S09/1.jpg", "pictures/photos/MardiGras-S09/2.jpg", "pictures/photos/MardiGras-S09/3.jpg", "pictures/photos/MardiGras-S09/4.jpg", "pictures/photos/MardiGras-S09/5.jpg", "pictures/photos/MardiGras-S09/6.jpg", "pictures/photos/MardiGras-S09/7.jpg", "pictures/photos/MardiGras-S09/8.jpg", "pictures/photos/MardiGras-S09/9.jpg", "pictures/photos/MardiGras-S09/10.jpg", "pictures/photos/MardiGras-S09/11.jpg", "pictures/photos/MardiGras-S09/12.jpg", "pictures/photos/MardiGras-S09/13.jpg", "pictures/photos/MardiGras-S09/14.jpg", "pictures/photos/MardiGras-S09/15.jpg", "pictures/photos/MardiGras-S09/16.jpg", "pictures/photos/MardiGras-S09/17.jpg", "pictures/photos/MardiGras-S09/18.jpg");
var ImageArray5 = new Array("pictures/photos/Regionals-S09/1.jpg", "pictures/photos/Regionals-S09/2.jpg", "pictures/photos/Regionals-S09/3.jpg", "pictures/photos/Regionals-S09/4.jpg", "pictures/photos/Regionals-S09/5.jpg", "pictures/photos/Regionals-S09/6.jpg", "pictures/photos/Regionals-S09/7.jpg", "pictures/photos/Regionals-S09/8.jpg", "pictures/photos/Regionals-S09/9.jpg", "pictures/photos/Regionals-S09/10.jpg", "pictures/photos/Regionals-S09/11.jpg", "pictures/photos/Regionals-S09/12.jpg", "pictures/photos/Regionals-S09/13.jpg", "pictures/photos/Regionals-S09/14.jpg");
var ImageArray6 = new Array("pictures/photos/Sectionals-S09/1.jpg", "pictures/photos/Sectionals-S09/2.jpg", "pictures/photos/Sectionals-S09/3.jpg", "pictures/photos/Sectionals-S09/4.jpg", "pictures/photos/Sectionals-S09/5.jpg", "pictures/photos/Sectionals-S09/6.jpg", "pictures/photos/Sectionals-S09/7.jpg", "pictures/photos/Sectionals-S09/8.jpg", "pictures/photos/Sectionals-S09/9.jpg", "pictures/photos/Sectionals-S09/10.jpg", "pictures/photos/Sectionals-S09/11.jpg", "pictures/photos/Sectionals-S09/12.jpg");
var ImageArray7 = new Array("pictures/photos/ACCs-S09/1.jpg", "pictures/photos/ACCs-S09/2.jpg", "pictures/photos/ACCs-S09/3.jpg", "pictures/photos/ACCs-S09/4.jpg", "pictures/photos/ACCs-S09/5.jpg", "pictures/photos/ACCs-S09/6.jpg", "pictures/photos/ACCs-S09/7.jpg", "pictures/photos/ACCs-S09/8.jpg", "pictures/photos/ACCs-S09/9.jpg", "pictures/photos/ACCs-S09/10.jpg", "pictures/photos/ACCs-S09/11.jpg", "pictures/photos/ACCs-S09/12.jpg", "pictures/photos/ACCs-S09/13.jpg");
var ImageArray8 = new Array("pictures/photos/Wolfpack-F08/1.jpg", "pictures/photos/Wolfpack-F08/2.jpg", "pictures/photos/Wolfpack-F08/3.jpg", "pictures/photos/Wolfpack-F08/4.jpg", "pictures/photos/Wolfpack-F08/5.jpg", "pictures/photos/Wolfpack-F08/6.jpg", "pictures/photos/Wolfpack-F08/7.jpg", "pictures/photos/Wolfpack-F08/8.jpg", "pictures/photos/Wolfpack-F08/9.jpg", "pictures/photos/Wolfpack-F08/10.jpg", "pictures/photos/Wolfpack-F08/11.jpg", "pictures/photos/Wolfpack-F08/12.jpg", "pictures/photos/Wolfpack-F08/13.jpg", "pictures/photos/Wolfpack-F08/14.jpg", "pictures/photos/Wolfpack-F08/15.jpg", "pictures/photos/Wolfpack-F08/16.jpg");

var MultImageArray0 = new Array("pictures/photos/FallBrawl-F09/1.jpg", "pictures/photos/FallBrawl-F09/2.jpg", "pictures/photos/FallBrawl-F09/3.jpg", "pictures/photos/FallBrawl-F09/4.jpg", "pictures/photos/FallBrawl-F09/5.jpg", "pictures/photos/FallBrawl-F09/6.jpg", "pictures/photos/FallBrawl-F09/7.jpg", "pictures/photos/FallBrawl-F09/8.jpg", "pictures/photos/FallBrawl-F09/9.jpg", "pictures/photos/FallBrawl-F09/10.jpg", "pictures/photos/FallBrawl-F09/11.jpg", "pictures/photos/FallBrawl-F09/12.jpg", "pictures/photos/FallBrawl-F09/13.jpg", "pictures/photos/FallBrawl-F09/14.jpg", "pictures/photos/FallBrawl-F09/15.jpg", "pictures/photos/FallBrawl-F09/16.jpg", "pictures/photos/FallBrawl-F09/17.jpg", "pictures/photos/FallBrawl-F09/18.jpg", "pictures/photos/FallBrawl-F09/19.jpg", "pictures/photos/FallBrawl-F09/20.jpg", "pictures/photos/FallBrawl-F09/21.jpg", "pictures/photos/FallBrawl-F09/22.jpg", "pictures/photos/FallBrawl-F09/23.jpg", "pictures/photos/FallBrawl-F09/24.jpg", "pictures/photos/FallBrawl-F09/25.jpg", "pictures/photos/FallBrawl-F09/26.jpg", "pictures/photos/FallBrawl-F09/27.jpg", "pictures/photos/FallBrawl-F09/28.jpg", "pictures/photos/FallBrawl-F09/29.jpg", "pictures/photos/FallBrawl-F09/30.jpg", "pictures/photos/FallBrawl-F09/31.jpg",  "pictures/photos/FallBrawl-F09/32.jpg", "pictures/photos/FallBrawl-F09/33.jpg", "pictures/photos/FallBrawl-F09/34.jpg", "pictures/photos/FallBrawl-F09/35.jpg", "pictures/photos/FallBrawl-F09/36.jpg", "pictures/photos/FallBrawl-F09/37.jpg", "pictures/photos/FallBrawl-F09/38.jpg", "pictures/photos/FallBrawl-F09/39.jpg", "pictures/photos/FallBrawl-F09/40.jpg", "pictures/photos/FallBrawl-F09/41.jpg", "pictures/photos/FallBrawl-F09/42.jpg", "pictures/photos/FallBrawl-F09/43.jpg", "pictures/photos/FallBrawl-F09/44.jpg", "pictures/photos/FallBrawl-F09/45.jpg", "pictures/photos/FallBrawl-F09/46.jpg", "pictures/photos/FallBrawl-F09/47.jpg", "pictures/photos/FallBrawl-F09/48.jpg", "pictures/photos/FallBrawl-F09/49.jpg", "pictures/photos/FallBrawl-F09/50.jpg", "pictures/photos/FallBrawl-F09/51.jpg", "pictures/photos/FallBrawl-F09/52.jpg", "pictures/photos/FallBrawl-F09/53.jpg", "pictures/photos/FallBrawl-F09/54.jpg", "pictures/photos/FallBrawl-F09/55.jpg", "pictures/photos/FallBrawl-F09/56.jpg", "pictures/photos/FallBrawl-F09/57.jpg", "pictures/photos/FallBrawl-F09/58.jpg", "pictures/photos/FallBrawl-F09/59.jpg", "pictures/photos/FallBrawl-F09/60.jpg", "pictures/photos/FallBrawl-F09/61.jpg", "pictures/photos/FallBrawl-F09/62.jpg", "pictures/photos/FallBrawl-F09/63.jpg", "pictures/photos/FallBrawl-F09/64.jpg", "pictures/photos/FallBrawl-F09/65.jpg", "pictures/photos/FallBrawl-F09/66.jpg", "pictures/photos/FallBrawl-F09/67.jpg", "pictures/photos/FallBrawl-F09/68.jpg", "pictures/photos/FallBrawl-F09/69.jpg", "pictures/photos/FallBrawl-F09/70.jpg", "pictures/photos/FallBrawl-F09/71.jpg", "pictures/photos/FallBrawl-F09/72.jpg", "pictures/photos/FallBrawl-F09/73.jpg", "pictures/photos/FallBrawl-F09/74.jpg", "pictures/photos/FallBrawl-F09/75.jpg", "pictures/photos/FallBrawl-F09/76.jpg", "pictures/photos/FallBrawl-F09/77.jpg", "pictures/photos/FallBrawl-F09/78.jpg", "pictures/photos/FallBrawl-F09/79.jpg", "pictures/photos/FallBrawl-F09/80.jpg", "pictures/photos/FallBrawl-F09/81.jpg", "pictures/photos/FallBrawl-F09/82.jpg", "pictures/photos/FallBrawl-F09/83.jpg", "pictures/photos/FallBrawl-F09/84.jpg", "pictures/photos/FallBrawl-F09/85.jpg", "pictures/photos/FallBrawl-F09/86.jpg", "pictures/photos/FallBrawl-F09/87.jpg", "pictures/photos/FallBrawl-F09/88.jpg", "pictures/photos/FallBrawl-F09/89.jpg", "pictures/photos/FallBrawl-F09/90.jpg", "pictures/photos/FallBrawl-F09/91.jpg");

function high_res()
{
	var NumIndexArrays = 10;
	var theArray = new Array();
	var img = new Image();/*null;*/
	var RandomIndex = Math.floor(NumIndexArrays * Math.random());
	switch(RandomIndex) 
	{
		case 0: theArray = ImageArray0; break;
		case 1: theArray = ImageArray1; break;
		case 2: theArray = ImageArray2; break;
		case 3: theArray = ImageArray3; break;
		case 4: theArray = ImageArray4; break;
		case 5: theArray = ImageArray5; break;
		case 6: theArray = ImageArray6; break;
		case 7: theArray = ImageArray7; break;
		case 8: theArray = ImageArray8; break;
		case 9: theArray = MultImageArray0; break;
		default: document.write("defaultcase"); break;
	}
	//document.write("<br\>" + theArray);
	theArrayIndex = Math.floor(theArray.length * Math.random());
	//document.write("<br\> RandomIndex: " + RandomIndex);
	//document.write("<br\> theArrayIndex: " + theArrayIndex);
	//var img = new Image();
	img.src = theArray[theArrayIndex];
	//document.write("<br\> img.src: " + img.src);
	//while (!img.complete) {}
	//document.write("<br\>" + "width: " + img.width + " height: " + img.height);
	
	var noHighRes = false;
	
	// indeces of tournaments without high resolution pictures
	if (RandomIndex == 0 || RandomIndex == 3 || RandomIndex == 4)
	{
		noHighRes = true;
	}
	
	var hr_str = "";
	var str = theArray[theArrayIndex];
	//var str = pictureName;
	//document.write("<br\>picture name: " + str);
	//document.write("<br\>str: " + str);
	//document.write("<br\>indexof \'/photos/\' " + str.indexOf("/photos/"));
	//document.write("<br\>substr: " + str.substr(0, str.indexOf("/photos/") + 8));
	if (noHighRes == true)
	{
		hr_str = str;
	}
	else
	{
		var index1 = str.indexOf("/photos/") + 8;
		var str1 = str.substr(0, index1);
		//document.write("<br\>indexof \'/photos/\' " + index1);
		//document.write("<br\>substr: " + str1);
		var index2 = str.length;
		var str2 = str.substr(index1, index2);
		//document.write("<br\>indexof \'/photos/\' " + index2);
		//document.write("<br\>substr: " + str2);
		
		var str3 = "high_res/";
		/*var*/ hr_str = str1 + str3 + str2;
	}
	//document.write("<br\>hr_string: " + hr_str);
	/*document.write("<a href=\"" + str + "\" " +
		"onclick=\"return tswImageZoomAnimate(this);\" " +
		"onmouseover=\"tswImageZoomPreloadImage(this);\"> " +						
		"<img src=\"" + str + "\" width=\"250\" height=\"250\"" + 
		" align=\"middle\" border=\"0\"/>" + "<\/a>");
	document.write("<br\><a href=\"" + hr_str + "\"/>high res<\/a>");*/
	
	document.write('<table class="photo_table"><tr><td>');
	document.write('<a href="' + str + 
		'" onclick="return tswImageZoomAnimate(this);" ' +
		'onmouseover="tswImageZoomPreloadImage(this);"> ' +						
		'<img src="' + str + '" width="250"' +// height="250"' + 
		' align="middle" border="0"/></a>');
	document.write('<br\><a href="' + hr_str + '" target="_blank">high res</a>');
	//document.write('<br\><input type=button align="middle" value="New Picture" onClick="high_res()"');//"history.go()">')
	document.write('</td></tr></table>');
	//alert("end high_res index5.js");
}

function display_photos(curPage)
{
	//alert("display_photos");
	//document.write(curPage);
	var theArray = new Array();
	var img = new Image();
	//var RandomIndex = Math.floor(NumIndexArrays * Math.random());
	switch(curPage) 
	{
		case 0: theArray = ImageArray0; break;	// B-Deviled F08
		case 1: theArray = ImageArray1; break;	// Blue Ridge Thawout S09
		case 2: theArray = ImageArray2; break;	// Boone F08
		case 3: theArray = ImageArray3; break;	// DOG-B S09
		case 4: theArray = ImageArray4; break;	// Mardi Gras S09
		case 5: theArray = ImageArray5; break;	// Regionals S09
		case 6: theArray = ImageArray6; break;	// Sectionals S09
		case 7: theArray = ImageArray7; break;	// ACCS S09
		case 8: theArray = ImageArray8; break;	// Wolfpack F08
		default: document.write("defaultcase"); break;
	}
	//document.write("<br\>" + theArray);
	//theArrayIndex = Math.floor(theArray.length * Math.random());
	//document.write("<br\> RandomIndex: " + RandomIndex);
	//document.write("<br\> theArrayIndex: " + theArrayIndex);
	//var img = new Image();
	//img.src = theArray[theArrayIndex];
	//document.write("<br\> img.src: " + img.src);
	//while (!img.complete) {}
	//document.write("<br\>" + "width: " + img.width + " height: " + img.height);
	
	var noHighRes = false;
	
	// indeces of tournaments without high resolution pictures
	if (curPage == 0 || curPage == 3 || curPage == 4)
	{
		noHighRes = true;
	}
	var columnCount = 1;
	document.write('<table class="photo_table"><tr>');
	for (var theArrayIndex = 0; theArrayIndex < theArray.length; theArrayIndex++)
	{
		var hr_str = "";
		var str = theArray[theArrayIndex];
		//var str = pictureName;
		//document.write("<br\>picture name: " + str);
		//document.write("<br\>str: " + str);
		//document.write("<br\>indexof \'/photos/\' " + str.indexOf("/photos/"));
		//document.write("<br\>substr: " + str.substr(0, str.indexOf("/photos/") + 8));
		if (noHighRes == true)
		{
			hr_str = str;
		}
		else
		{			
			var index1 = str.indexOf("/photos/") + 8;
			var str1 = str.substr(0, index1);
			//document.write("<br\>indexof \'/photos/\' " + index1);
			//document.write("<br\>substr: " + str1);
			var index2 = str.length;
			var str2 = str.substr(index1, index2);
			//document.write("<br\>indexof \'/photos/\' " + index2);
			//document.write("<br\>substr: " + str2);
			
			var str3 = "high_res/";
			/*var*/ hr_str = str1 + str3 + str2;
		}
		//document.write("<br\>hr_string: " + hr_str);
		/*document.write("<a href=\"" + str + "\" " +
			"onclick=\"return tswImageZoomAnimate(this);\" " +
			"onmouseover=\"tswImageZoomPreloadImage(this);\"> " +						
			"<img src=\"" + str + "\" width=\"175\" height=\"175\"" + 
			" align=\"middle\" border=\"0\"/>" + "<\/a>");*/
		
		document.write('<td class="photo">');
		document.write('<a href="' + str + 
			'" onclick="return tswImageZoomAnimate(this);" ' +
			'onmouseover="tswImageZoomPreloadImage(this);"> ' +						
			'<img src="' + str + '" width="175"' +// height="175"' + 
			' align="middle" border="0"/></a>');
		document.write('<br\><a href="' + hr_str + '" target="_blank">high res' + (theArrayIndex+1) + '</a></td>');	
		if (columnCount == 3)
		{
			document.write('</tr>');
			if (theArrayIndex != theArray.length - 1)
			{
				document.write('<tr>');	
			}
			else
			{
				document.write('</table>');	
			}
			columnCount = 1;	
		}
		else
		{
			columnCount = columnCount + 1;
			if (theArrayIndex == theArray.length - 1)
			{
				document.write('</tr></table>');	
			}
		}
		//document.write("<br\><a href=\"" + hr_str + "\"/>high res" + theArrayIndex + "<\/a>");
		//alert("end high_res index5.js");
	}
}

function display_photos_mult(curPage, multPage)
{
	//alert("display_photos");
	//document.write(curPage);
	var pageName = "";
	var theArray = new Array();
	var img = new Image();
	switch(curPage) 
	{
		case 0: theArray = MultImageArray0; pageName = "Photos_FallBrawl0_F09.html"; break;	// Fall Brawl
		default: document.write("defaultcase"); break;
	}
	
/*	var noHighRes = false;
	
	// indeces of tournaments without high resolution pictures
	if (curPage == 0 || curPage == 3 || curPage == 4)
	{
		noHighRes = true;
	}*/
	
	var columnCount = 1;
	
	var numPages = Math.floor(theArray.length/25);
	//document.write('<br/>numPages before: ' + numPages);
	if ((theArray.length - (numPages*25)) != 0)
	{
		numPages = numPages + 1;
	}
	//document.write('<br/>numPages after: ' + numPages + '<br/>');
	document.write('<br/>Photo Pages: ');
	
	for (var i = 0; i < numPages; i++)
	{
		//document.write(pageName.replace("0_", (i+1) + "_"));
		document.write(' <a href="' + pageName.replace("0_", (i+1) + "_") + 
						'" onclick="display_photos_mult(' + 
						curPage + ', ' + (i+1) + ')">' + (i+1) + '</a>');
	}
	var multPageEndIndex = (multPage*25);
	//document.write('multPageEndIndex: ' + multPageEndIndex + '<br/>');

	document.write('<table class="photo_table"><tr>');

	for (var theArrayIndex = ((multPage-1)*25); (theArrayIndex < multPageEndIndex) && (theArrayIndex < theArray.length); theArrayIndex++)
	{
		var hr_str = "";
		var str = theArray[theArrayIndex];

		var index1 = str.indexOf("/photos/") + 8;
		var str1 = str.substr(0, index1);
		var index2 = str.length;
		var str2 = str.substr(index1, index2);
		var str3 = "high_res/";
		/*var*/ hr_str = str1 + str3 + str2;
		//document.write('theArrayIndex: ' + theArrayIndex + '<br/>');
		document.write('<td class="photo">');
		document.write('<a href="' + str + 
			'" onclick="return tswImageZoomAnimate(this);" ' +
			'onmouseover="tswImageZoomPreloadImage(this);"> ' +						
			'<img src="' + str + '" width="175"' +
			' align="middle" border="0"/></a>');
		document.write('<br\><a href="' + hr_str + '" target="_blank"/>high res' + (theArrayIndex+1) + '</a></td>');	
		if (columnCount == 3)
		{
			document.write('</tr>');
			if ((theArrayIndex != multPageEndIndex - 1) && (theArrayIndex != theArray.length - 1))
			{
				document.write('<tr>');	
			}
			else
			{
				document.write('</table>');	
			}
			columnCount = 1;	
		}
		else
		{
			columnCount = columnCount + 1;
			if ((theArrayIndex == multPageEndIndex - 1) || (theArrayIndex == theArray.length - 1))
			{
				document.write('</tr></table>');	
			}
		}
		//document.write("<br\><a href=\"" + hr_str + "\"/>high res" + theArrayIndex + "<\/a>");
		//alert("end high_res index5.js");
	}
}