/* changes the banner image on the NWNL home page */


var d = new Date();

/* x selects one of 12 images for static viewing. */
var s = d.getSeconds();
var x = Math.floor(s/5); // for 12 static images

/* n selects image arrays (1&2, 2&3, 3&4, 4&5 or 5&1) for the crossfade slide show. */
var h = d.getHours();
var dd = d.getDate();
var nn = (h + dd); // 5; // 
var n = 8 * (nn %5);

var f = '"images1\/3-11\/';
var f2 = '"images1\/4-11\/';
var wh = ' WIDTH="600" HEIGHT="261"';

var images1 = [
f + 'Jones_070630_WA_5460.jpg"' + wh + ' ALT="" TITLE="Washington: Columbia River Basin, Trout Lake and Mount Adams"',
f + 'NJ-CAL-310.jpg"' + wh + ' ALT="" TITLE="New Jersey: Raritan River Basin, fly fishing, October"',
f + 'Jones_091003_TZ_1589.jpg"' + wh + ' ALT="" TITLE="Tanzania: Mara River Basin, women and children collecting water"',
f2 + 'waterborne-2.jpg"' + wh + ' ALT="" TITLE=""',
f + 'Jones_070913_ET_8302_M.jpg"' + wh + ' ALT="" TITLE="Ethiopia: Omo River Basin, shepherd with goats above the Omo River"',
f + 'K-P-L-1104.jpg" WIDTH="600" HEIGHT="258" ALT="" TITLE="Kenya: Nile River Basin, fisherman paddling boat" STYLE="padding:2px 0px 1px; "',
f + 'Jones_080531_WY_5017.jpg" WIDTH="600" HEIGHT="247" ALT="" TITLE="Wyoming: Mississippi River Basin, small snow-pack fed mountain creek" STYLE="padding:7px 0px; "',
f2 + 'daily-water-usage.jpg"' + wh + ' ALT="" TITLE=""'];

var captions1 = ['Columbia River Basin','Raritan River Basin','Mara River Basin','','Omo River Basin','Nile River Basin','Mississippi River Basin',''];

var delay1 = [2000,2000,2000,3000,2000,2000,2000,3000];

var images2 = [
f + 'Jones_070621_WA_4072.jpg" WIDTH="588" HEIGHT="261" ALT="" TITLE="Washington: Columbia River Basin, irrigation of cherry trees" STYLE="padding:0px 6px; "',
f + 'Jones_091002_TZ_1461.jpg" WIDTH="600" HEIGHT="247" ALT="" TITLE="Tanzania: Mara River Basin, fisherman catching lung fish" STYLE="padding:7px 0px; "',
f + 'Jones_080202_ET_7057.jpg"' + wh + ' ALT="" TITLE="Ethiopia: Lower Omo River Basin, Omo Delta at low water stage"',
f2 + 'water-true-wealth.jpg"' + wh + ' ALT="" TITLE=""',
f + 'Jones_090906_NJ_1632.jpg" WIDTH="600" HEIGHT="253" ALT="" TITLE="New Jersey: Upper Raritan River Basin, dragon fly" STYLE="padding:4px 0px; "',
f + 'Jones_070926_ET_2664.jpg"' + wh + ' ALT="" TITLE="Ethiopia: Blue Nile River Basin, girl carrying buckets of water"',
f + 'MO-PER-109.jpg" WIDTH="600" HEIGHT="255" ALT="" TITLE="Missouri: Mississippi River Basin, young boy playing in flooded creek" STYLE="padding:3px 0px; "',
f2 + '40percent-of-American-lakes.jpg"' + wh + ' ALT="" TITLE=""'];

var captions2 = ['Columbia River Basin','Mara River Basin','Omo River Basin','','Raritan River Basin','Nile River Basin','Mississippi River Basin',''];

var delay2 = [2000,2000,2000,3000,2000,2000,2000,3000];

var images3 = [
f + 'Jones_080817_BC_8628.jpg"' + wh + ' ALT="" TITLE="British Columbia: Kootenay Rockies, Columbia River Basin"',
f + 'Jones_071118_NJ_1586.jpg" WIDTH="600" HEIGHT="247" ALT="" TITLE="New Jersey: Raritan River Basin, early snowfall in hardwood forest" STYLE="padding:7px 0px; "',
f + 'Jones_080527_MT_1175.jpg"' + wh + ' ALT="" TITLE="Montanta: Mississippi River Basin, flock of American white pelicans"',
f2 + 'waterborne-2.jpg"' + wh + ' ALT="" TITLE=""',
f + 'Jones_080131_ET_6115_M.jpg"' + wh + ' ALT="" TITLE="Ethiopia: Lower Omo River Basin, Omo Delta, women collecting water from the river"',
f + 'Jones_100409_UG_8063.jpg"' + wh + ' ALT="" TITLE="Uganda: White Nile River Basin, Kidepo Valley National Park"',
f + 'Jones_091005_TZ_3181.jpg"' + wh + ' ALT="" TITLE="Tanzania: Mara River Basin, Lake Victoria sunset"',
f2 + 'everything-flows.jpg"' + wh + ' ALT="" TITLE=""'];

var captions3 = ['Columbia River Basin','Raritan River Basin','Mississippi River Basin','','Omo River Basin','Nile River Basin','Mara River Basin',''];

var delay3 = [2000,2000,2000,3000,2000,2000,2000,3000];

var images4 = [
f + 'Jones_070622_WA_1327.jpg"' + wh + ' ALT="" TITLE="US: Washington: Columbia River Basin, aerial view of Chief Joseph Dam"',
f + 'Jones_080602_WY_3132.jpg" WIDTH="600" HEIGHT="258" ALT="" TITLE="Wyoming: Mississippi River Basin, Yellowstone National Park, Lamar River" STYLE="padding:2px 0px 1px; "',
f + 'Jones_080204_ET_8165.jpg"' + wh + ' ALT="" TITLE="Ethiopia: Lower Omo River Basin, Lebuk farm village"',
f2 + 'daily-water-usage.jpg"' + wh + ' ALT="" TITLE=""',
f + 'K-ZB-306.jpg"' + wh + ' ALT="" TITLE="Kenya: Mara River Basin, herd of zebras drinking in river"',
f + 'Jones_100402_UG_5711.jpg" WIDTH="600" HEIGHT="246" ALT="" TITLE="Uganda: White Nile River Basin, great white egret in Queen Elizabeth National Park" STYLE="padding:8px 0px 7px; "',
f + 'Jones_080418_NJ_4324.jpg"' + wh + ' ALT="" TITLE="New Jersey: Raritan River Basin, Budd Lake at sunset"',
f2 + '1point2-trillion.jpg"' + wh + ' ALT="" TITLE=""'];

var captions4 = ['Columbia River Basin','Mississippi River Basin','Omo River Basin','','Mara River Basin','Nile River Basin','Raritan River Basin',''];

var delay4 = [2000,2000,2000,3000,2000,2000,2000,3000];

var images5 = [
f + 'Jones_070702_OR_5043.jpg"' + wh + ' ALT="" TITLE="Oregon: Columbia River Basin, Bonneville Dam on the Columbia River"',
f + 'ET-Delta-114D.jpg"' + wh + ' ALT="" TITLE="Kenya: Omo River Basin, pink-backed pelicans in Omo River Delta"',
f + 'Jones_100413_UG_8651.jpg"' + wh + ' ALT="" TITLE="Uganda: White Nile River Basin, Bujagali Falls"',
f2 + 'today-1-billion.jpg"' + wh + ' ALT="" TITLE=""',
f + 'Jones_090927_K_9722.jpg" WIDTH="600" HEIGHT="249" ALT="" TITLE="Kenya: Mara River Basin" STYLE="padding:6px 0px; "',
f + 'MO-STJ-103.jpg" WIDTH="600" HEIGHT="248" ALT="" TITLE="Missouri: Mississippi River Basin, park bench at Meramec Springs Park" STYLE="padding:7px 0px 6px; "',
f + 'NJ-MTV-1806.jpg"' + wh + ' ALT="" TITLE="New Jersey: Raritan River Basin, Rockaway Creek with ice in December."',
f2 + 'everything-flows.jpg"' + wh + ' ALT="" TITLE=""'];

var delay5 = [2000,2000,2000,3000,2000,2000,2000,3000];

var captions5 = ['Columbia River Basin','Omo River Basin','Nile River Basin','','Mara River Basin','Mississippi River Basin','Raritan River Basin',''];


var images = [];
images = images.concat(images1,images2,images3,images4,images5,images1);

var captions = [];
captions = captions.concat(captions1,captions2,captions3,captions4,captions5,captions1);


var html1 = '<div class="cf_element" id="'; // + cf1
var html2a = '<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="600"><TR><TD COLSPAN="2"><IMG SRC=';
var html2 = '"><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="600"><TR><TD COLSPAN="2"><IMG SRC='; // image file path, dimensions, ALT
var html3 = '><BR><IMG SRC="/spacer.gif" WIDTH="1" HEIGHT="4" ALT=""><\/TD><\/TR><TR><TD ALIGN="left" VALIGN="top"><P CLASS="caption">'; // Nyangatom villagers on the Lower Omo River, Ethiopia
var html4a = '<\/P><\/TD><TD ALIGN="right" VALIGN="top"><P CLASS="caption">Photos &copy; Alison M. Jones<\/P><\/TD><\/TR><\/TABLE>';
var html4 = '<\/P><\/TD><TD ALIGN="right" VALIGN="top"><P CLASS="caption">Photos &copy; Alison M. Jones<\/P><\/TD><\/TR><\/TABLE><\/div>';


if (cf_okay) { // crossfade slide show


	var array2 = ['cf1','cf2','cf3','cf4','cf5','cf6','cf7','cf8','cf9','cf10','cf11','cf12','cf13','cf14','cf15','cf16'];

	var delay = [];
	delay = delay.concat(delay1,delay2,delay3,delay4,delay5,delay1);
	var array5 = delay.slice(n,n+16);


	document.writeln('<TABLE BORDER="0" STYLE="margin:0px; padding:0px; " CELLSPACING="0" CELLPADDING="0" WIDTH="600"><TR><TD COLSPAN="2" VALIGN="top" HEIGHT="292">');
	
	document.write(html1 + 'cf1' + html2 +  images[n]  + html3 +  captions[n]  + html4);
	document.write(html1 + 'cf2' + html2 + images[1+n] + html3 + captions[1+n] + html4);
	document.write(html1 + 'cf3' + html2 + images[2+n] + html3 + captions[2+n] + html4);
	document.write(html1 + 'cf4' + html2 + images[3+n] + html3 + captions[3+n] + html4);
	document.write(html1 + 'cf5' + html2 + images[4+n] + html3 + captions[4+n] + html4);
	document.write(html1 + 'cf6' + html2 + images[5+n] + html3 + captions[5+n] + html4);
	document.write(html1 + 'cf7' + html2 + images[6+n] + html3 + captions[6+n] + html4);
	document.write(html1 + 'cf8' + html2 + images[7+n] + html3 + captions[7+n] + html4);
	document.write(html1 + 'cf9' + html2 + images[8+n] + html3 + captions[8+n] + html4);
	document.write(html1 + 'cf10' + html2 + images[9+n] + html3 + captions[9+n] + html4);
	document.write(html1 + 'cf11' + html2 + images[10+n] + html3 + captions[10+n] + html4);
	document.write(html1 + 'cf12' + html2 + images[11+n] + html3 + captions[11+n] + html4);
	document.write(html1 + 'cf13' + html2 + images[12+n] + html3 + captions[12+n] + html4);
	document.write(html1 + 'cf14' + html2 + images[13+n] + html3 + captions[13+n] + html4);
	document.write(html1 + 'cf15' + html2 + images[14+n] + html3 + captions[14+n] + html4);
	document.write(html1 + 'cf16' + html2 + images[15+n] + html3 + captions[15+n] + html4);

	document.writeln('<\/TD><\/TR><\/TABLE>');
	
	var cf = new Crossfader( array2, 1500, array5 ); // (array, cross-fade time, wait time)



} else { // static images

	var sImage = [images1[0],images1[1],images1[2],images1[4],images1[5],images1[6],images2[0],images2[1],images2[2],images2[4],images2[5],images2[6]];
	var sCaption = [captions1[0],captions1[1],captions1[2],captions1[4],captions1[5],captions1[6],captions2[0],captions2[1],captions2[2],captions2[4],captions2[5],captions2[6]];

	document.write(html2a + sImage[x] + html3 + sCaption[x] + html4a);
}

