// JavaScript Document
//	Random photos
var Photo = new Array();
var Legend = new Array();
Photo[0]= "<img src='graphics/fall_picture.jpg' width=149 alt='Trail passing by Cochituate Brook Reservation' border=1>";
Photo[1]= "<img src='graphics/TJX_building_and_trail.jpg' width=149 alt='Trail passing by TJX headquarters' border=1>";
Photo[2]= "<img src='graphics/Turnpike_underpass.jpg' width=149 alt='Trail passing under MassPike' border=1>";

Photo[3]= "<img src='graphics/10-20-01_Cleanup.jpg' width=149 alt='Clean-up - 10/20/2001' border=1>";
Photo[4]= "<img src='graphics/5-12-01_Cleanup.jpg' width=149 alt='Clean-up - 5/12/2001' border=1>";
Photo[5]= "<img src='graphics/8-23-03_Cleanup.jpg' width=149 alt='Clean-up - 8/23/2003' border=1>";
Photo[6]= "<img src='graphics/Img47a.jpg' width=149 alt='The snow covered trail' border=1>";
Photo[7]= "<img src='graphics/Maraskiing.jpg' width=149 alt='Skiing along the trail in the winter' border=1>";
Photo[8] = "<img src='graphics/Near-Nissan.jpg' width=149 alt='Fall foliage along the trail' border=1>";
Photo[9] = "<img src='graphics/t-tour-2004.jpg' width=149 alt='Enjoying a tour of the CRT' border=1>";
Photo[10] = "<img src='graphics/t-trailsnow.jpg' width=149 alt='Section of trail covered with snow' border=1>";
Photo[11] = "<img src='graphics/t-beaver.jpg' width=149 alt='Beavers!! ... What beavers??' border=1>";
Photo[12] = "<img src='graphics/t-lake1.jpg' width=149 alt='Section of trail along Lake Cochituate' border=1>";
Photo[13]= "<img src='graphics/Route_9_bridge.jpg' width=149 alt='Trail passing over Route 9' border=1>";
Photo[14]= "<img src='graphics/Rail_line_and_lake.jpg' height=149 alt='Scenic section of trail in Natick' border=1>";
Photo[15] = "<img src='graphics/Natick2.jpg' width=149 alt='Scenic section of trail in Natick' border=1>";

Legend[0]= "Trail passing by Cochituate Brook Reservation";
Legend[1]= "Trail passing by TJX headquarters";
Legend[2]= "Trail passing under MassPike";
Legend[3]= "Clean-up - 10/20/2001";
Legend[4]= "Clean-up - 5/12/2001";
Legend[5]= "Clean-up - 8/23/2003";
Legend[6]= "The snow covered trail";
Legend[7]= "Skiing along the trail in the winter";
Legend[8] = "Fall foliage along the trail";
Legend[9] = "Enjoying a tour of the Cochituate Rail Trail";
Legend[10] = "Section of trail covered with snow";
Legend[11] = "Beavers!! ... What beavers??";
Legend[12] = "Section of trail along Lake Cochituate";
Legend[13]= "Trail passing over Route 9";
Legend[14]= "Scenic section of trail in Natick";
Legend[15] = "Scenic section of trail in Natick";

function display(x)	{
	var random1=Math.floor(Math.random()*Photo.length);
	var random2=Math.floor(Math.random()*Photo.length);
	var random3=Math.floor(Math.random()*Photo.length);
	var random4=Math.floor(Math.random()*Photo.length);
	var random5=Math.floor(Math.random()*Photo.length);
	var random6=Math.floor(Math.random()*Photo.length);
	if (x==1)	{	// for Framingham photos
		while (random1 > 11)
			random1=Math.floor(Math.random()*Photo.length);
		while ((random2 > 11) || (random1==random2))
				random2=Math.floor(Math.random()*Photo.length);
		document.write("<table width='150'><tr><td align='center'>" + Photo[random1] + "<br><span class='style7'>" + Legend[random1] + "</td></tr><tr><td align='center'>" + Photo[random2] + "<br><span class='style7'>" + Legend[random2] + "</td></tr><tr><td align='center'><a href='Images/Framingham-Section-Large.gif'><img src='Images/framingham_section_thumbnail3.gif' border='0' width='150' /></a></td></tr><tr><td align='center' class='style7'>Click on this map for a larger view.</td></tr></table>");    
	}
	else if (x==2)	{	// for Natick photos
		while (random1 < 12)
			random1=Math.floor(Math.random()*Photo.length);
		while ((random2 < 12) || (random1==random2))
				random2=Math.floor(Math.random()*Photo.length);
		document.write("<table width='150'><tr><td align='center'>" + Photo[random1] + "<br><span class='style7'>" + Legend[random1] + "</td></tr><tr><td align='center'>" + Photo[random2] + "<br><span class='style7'>" + Legend[random2] + "</td></tr><tr><td align='center'><a href='Images/Framingham-Section-Large.gif'><img src='Images/framingham_section_thumbnail3.gif' border='0' width='150' /></a></td></tr><tr><td align='center' class='style7'>Click on this map for a larger view.</td></tr></table>");    
	}
	else if (x==3)	{	// for 3 photos
		while (random2 == random1)
			random2=Math.floor(Math.random()*Photo.length);
		while ((random3 == random2) || (random3 == random1))
			random3=Math.floor(Math.random()*Photo.length);
		document.write("<table width='150'><tr><td align='center'>" + Photo[random1] + "<br><span class='style7'>" + Legend[random1] + "</td></tr><tr><td align='center'>" + Photo[random2] + "<br><span class='style7'>" + Legend[random2] + "</td></tr><tr><td align='center'>" + Photo[random3] + "<span class='style7'>" + Legend[random3] + "</td></tr></table>");    
	}
	else if (x==4)	{	// for 4 photos
		while (random2 == random1)
			random2=Math.floor(Math.random()*Photo.length);
		while ((random3 == random2) || (random3 == random1))
			random3=Math.floor(Math.random()*Photo.length);
		while ((random4 == random3) || (random4 == random2) || (random4 == random1))
			random4=Math.floor(Math.random()*Photo.length);
		document.write("<table width='150'><tr><td align='center'>" + Photo[random1] + "<br><span class='style7'>" + Legend[random1] + "</td></tr><tr><td align='center'>" + Photo[random2] + "<br><span class='style7'>" + Legend[random2] + "</td></tr><tr><td align='center'>" + Photo[random3] + "<br><span class='style7'>" + Legend[random3] + "</td></tr><tr><td align='center'>" + Photo[random4] + "<br><span class='style7'>" + Legend[random4] + "</td></tr></table>");
	}
	else if (x==5)	{	// for 2 photos
		while (random2 == random1)
			random2=Math.floor(Math.random()*Photo.length);
		document.write("<table width='150'><tr><td align='center'>" + Photo[random1] + "<br><span class='style7'>" + Legend[random1] + "</td></tr><tr><td align='center'>" + Photo[random2] + "<br><span class='style7'>" + Legend[random2] + "</td></tr></table>");    
	}
	else if (x==6)	{	// for 5 photos
		while (random2 == random1)
			random2=Math.floor(Math.random()*Photo.length);
		while ((random3 == random2) || (random3 == random1))
			random3=Math.floor(Math.random()*Photo.length);
		while ((random4 == random3) || (random4 == random2) || (random4 == random1))
			random4=Math.floor(Math.random()*Photo.length);
		while ((random5 == random4) || (random5 == random3) || (random5 == random2) || (random5 == random1))
			random5=Math.floor(Math.random()*Photo.length);
		document.write("<table width='150'><tr><td align='center'>" + Photo[random1] + "<br><span class='style7'>" + Legend[random1] + "</td></tr><tr><td align='center'>" + Photo[random2] + "<br><span class='style7'>" + Legend[random2] + "</td></tr><tr><td align='center'>" + Photo[random3] + "<br><span class='style7'>" + Legend[random3] + "</td></tr><tr><td align='center'>" + Photo[random4] + "<br><span class='style7'>" + Legend[random4] + "</td></tr><tr><td align='center'>" + Photo[random5] + "<br><span class='style7'>" + Legend[random5] + "</td></tr></table>");
	}
	else if (x==7)	{	// for 6 photos
		while (random2 == random1)
			random2=Math.floor(Math.random()*Photo.length);
		while ((random3 == random2) || (random3 == random1))
			random3=Math.floor(Math.random()*Photo.length);
		while ((random4 == random3) || (random4 == random2) || (random4 == random1))
			random4=Math.floor(Math.random()*Photo.length);
		while ((random5 == random4) || (random5 == random3) || (random5 == random2) || (random5 == random1))
			random5=Math.floor(Math.random()*Photo.length);
		while ((random6 == random5) || (random6 == random4) || (random6 == random3) || (random6 == random2) || (random6 == random1))
			random6=Math.floor(Math.random()*Photo.length);
		document.write("<table width='150'><tr><td align='center'>" + Photo[random1] + "<br><span class='style7'>" + Legend[random1] + "</td></tr><tr><td align='center'>" + Photo[random2] + "<br><span class='style7'>" + Legend[random2] + "</td></tr><tr><td align='center'>" + Photo[random3] + "<br><span class='style7'>" + Legend[random3] + "</td></tr><tr><td align='center'>" + Photo[random4] + "<br><span class='style7'>" + Legend[random4] + "</td></tr><tr><td align='center'>" + Photo[random5] + "<br><span class='style7'>" + Legend[random5] + "</td></tr><tr><td align='center'>" + Photo[random6] + "<br><span class='style7'>" + Legend[random6] + "</td></tr></table>");
	}
	else {	// for 1 photo
		document.write("<table><tr><td align='center'>" + Photo[random1] + "<br><span class='style7'>" + Legend[random1] + "</td></tr></table>");
	}
}

