// Chooses a random background image for the top (history) picture, and the bottom header image.

var topHeaderSrcs = new Array(
	'css/images/random/topheader/1.jpg',
	'css/images/random/topheader/2.jpg',
	'css/images/random/topheader/3.jpg',
	'css/images/random/topheader/4.jpg',
	'css/images/random/topheader/5.jpg',
	'css/images/random/topheader/6.jpg',
	'css/images/random/topheader/7.jpg',
	'css/images/random/topheader/8.jpg'
	);
var bottomHeaderSrcs = new Array(
	'css/images/parks/08.jpg',
	'css/images/parks/09.jpg',
	'css/images/parks/10.jpg',
	'css/images/parks/11.jpg',
	'css/images/parks/19.jpg',
	'css/images/parks/20.jpg',
	'css/images/parks/23.jpg',
	'css/images/parks/90.jpg',
	'css/images/parks/92.jpg',
	'css/images/parks/93.jpg',
	'css/images/parks/94.jpg',
	'css/images/parks/95.jpg',
	'css/images/parks/96.jpg',
	'css/images/parks/104.jpg',
	'css/images/parks/105.jpg',
	'css/images/parks/106.jpg',
	'css/images/parks/110.jpg',
	'css/images/parks/111.jpg',
	'css/images/parks/112.jpg',
	'css/images/parks/122.jpg',
	'css/images/parks/124.jpg'
	);

var topheaderbg=topHeaderSrcs[(Math.round(Math.random()*(topHeaderSrcs.length-1)))];
var bottomheaderbg=bottomHeaderSrcs[(Math.round(Math.random()*(bottomHeaderSrcs.length-1)))];
if (chosenTopImage != null) {
	topheaderbg = 'css/images/' + chosenTopImage + '.jpg';
}
if(chosenBottomImage != null) {
	bottomheaderbg = 'css/images/' + chosenBottomImage + '.jpg';
}

// This is called as a body onload event.
function pickimage(chosenTopImage, chosenBottomImage) 
{ 
	var headerflash = document.getElementById("headerflash")
	var logo = document.getElementById("logo")
	var slogan = document.getElementById("slogan")
	var header = document.getElementById("header")
	var bottomheader = document.getElementById("bottomheader")

	if (chosenTopImage != null) {
		slogan.style.display="none";
		topheaderbg = 'css/images/' + chosenTopImage + '.jpg';
	}
	
	if(chosenBottomImage != null) {
		bottomheaderbg = 'css/images/' + chosenBottomImage + '.jpg';
	}

	//alert(topheaderbg);
	//alert(bottomheaderbg);

	if (headerflash != null) {
		logo.style.display="none";
		slogan.style.display="none";
	} else {
		header.style.backgroundImage = 'url("' + topheaderbg + '")'; 
	}
	bottomheader.style.backgroundImage = 'url("' + bottomheaderbg + '")';
		
}