// JavaScript Document for Elections & Registration

//=============================================================================================
/* Header Loading Function */
var hdrImages = new Array(); //creates an Arrary to store header images
hdrImages[0] = '/elections/images/electHdr/electHdr1.jpg'; //stores header image into array
hdrImages[1] = '/elections/images/electHdr/electHdr2.jpg';
hdrImages[2] = '/elections/images/electHdr/electHdr3.jpg';
hdrImages[3] = '/elections/images/electHdr/electHdr4.jpg';

var len = hdrImages.length; //number of images in the hdrImages array
var b = new Array();
for(i=0; i<len; i++){
	b[i] = new Image();
	b[i] = hdrImages[i];
}

var chooseImage = Math.round(Math.random()*(len-1)); //Random number for array

function hdrLoad(d){
	document.getElementById(d).style.backgroundImage="url(" + hdrImages[chooseImage] + ")";
	//The above code tells the browser to display the randomly selected header image as a background
	//image of the passed DIV. This is done using a DIV ID. The function and div is called in the
	//.htm file (in the onload statement of the body tag)
}
