// JavaScript Document

// filenames (w/o extension)
var photofiles = ["02orca", "05monkey", "07sundarban", "08poplar", "09namibia", "10greenpeace", "11trujillo", "12earthcorps", "13mexico",
				  "19mercury","20guira","21plankton","22racism","26laoroya","27smile","28planting","29kona","30otter","33ntbg","34snow","35blackridge"];

var photocaptions = ["SeaWolf Coastal Protection delivers public education programs about non-point pollution and its impacts on the 'endangered' Pacific orca whales. San Juan Islands, WA.",
					 "A Mono Titi Monkey uses the KSTR Monkey Bridge.",
					 "In the Sundarban, the world's largest mangrove delta, bordering India and Bangladesh in the Bay of Bengal region, a young working girl is engrossed in her collection of shrimp seedlings. An eight hour labor fetches nearly 50 US cents.",
					 "A massive tulip poplar and an impressive hemlock are identified through the Southern Appalachian Forest Coalition's campaign to document and protect old-growth forests in the region.",
					 "Save the Rhino Trust game guards and Round River Conservation Studies students and researchers studying black rhinos in Namibia.",
					 "In February 2006, ForestEthics, it allies, and the world celebrated a historic victory, the protection of British Columbia's Great Bear Rainforest.",
					 "One of 900 Environmental Art Miles Mural Project canvas murals painted by Crystal Trujillo, Denver, Colorado 2006 Earth Day.",
					 "EarthCorps (www.earthcorps.org) corpsmembers learning hands on skills on how to protect and restore public waterways.",
					 "A New Forests Project beneficiary receives a tree as part of a community reforestation project.  Hidalgo, Mexico",
					 "Children pose with largemouth bass after event calling for reductions in mercury pollution from coal-fired power plants. Knoxville, Tennessee.",
					"Guira Cuckoo (Guira guira) taken in January 2006 in Itatiba, São Paulo Brazil. The Guira cuckoo, a voracious insectivore, forages mostly on the ground and nests in family groups of as many as 18 adults.",
					"Investigations onboard the Maine Lakes Conservancy Institute's floating classroom include hands-on learning, such as hauling for zooplankton (seen here).",
					"",
					"In La Oroya, Peru, more that 99% of children suffer lead poisoning caused by extreme contamination from a local smelter.",
					"A farmer with proud in his causarina plantation achieved by Soil &amp; Water conservation programme in Kattarankulam village,TamilNadu,India",
					"A young volunteer helps with the Constellation Tree Planting Program at Leister Park in Hampstead, Maryland."];

var photocredits = ["Michael Kundu",
					"Used by permission of Doug Morgan",
					"Sampath Kumar",
					"Joshua Kelly",
					"Doug Milek",
					"GreenPeace",
					"Art Miles Mural Project",
					"EarthCorps",
					"Alfonso Suárez Islas",
					"Southern Alliance for Clean Energy",
					"Maria Bedacht",
					"Maine Lakes Conservancy Institute",
					"Literacy for Environmental Justice",
					"AIDA – the Interamerican Association for Environmental Defense",
					"N.Arunachalam",
					"Vernon Wright, Alliance for the Chesapeake Bay"];

function egaWritePhoto(rootpath, align) {
	var photoCookie =  getIntCookie("pix", 1);	
	
	// generate filename
	photoCookie = photoCookie % photocaptions.length;
	var photoFile = photofiles[photoCookie];
	var photoCaption = photocaptions[photoCookie];
	var photoCredit  = photocredits[photoCookie];
	var html = '<table class="photobg" border="0" cellspacing="0" cellpadding="6" align="' + align + '" width="50%" ><tr><td align="center">';
	
	// add image tag
	html += '<img name="pagephoto" src="' + rootpath + 'images/photo/ngo/' + photoFile + '.jpg" border="0" alt="' + photoCaption + '">';
	
	// add caption and credit
	html += '</td></tr><tr><td>';
	html += '<span class="photocaption">' + photoCaption + '</span><br><span class="photocredit">(' + photoCredit + ')</span>';
	html += '</td></tr></table>';
	document.writeln(html);
	
	// increment cookie
	setCookieValue("pix", photoCookie + 1);
}
