// Chooses a random background image for the top (history) picture, and the bottom header image.

var topHeaderSrcs = new Array(
	'css/images/police/topheader.jpg'
	);
var bottomHeaderSrcs = new Array(
	'css/images/police/botheader.jpg',
	'css/images/police/01.jpg',
	'css/images/police/12.jpg',
	'css/images/police/15.jpg',
	'css/images/police/16.jpg',
	'css/images/police/21.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';
	}

	if (headerflash != null) {
		logo.style.display="none";
		slogan.style.display="none";
	} else {
		header.style.backgroundImage = 'url("' + topheaderbg + '")'; 
	}
	bottomheader.style.backgroundImage = 'url("' + bottomheaderbg + '")';
		
}