//define the objImage and its properties.
function objImage() {
this.url;
this.hyperlink;
}

//Create an Array for holding new objects
var theImage = new Array()


//Create my Image Object and assign its properties.
theImage[0] = new objImage()
theImage[0].url = 'images/fm728.jpg';
theImage[0].hyperlink = 'http://www.thefmbank.com';


theImage[1] = new objImage()
theImage[1].url = 'images/tompkins728.jpg';
theImage[1].hyperlink = 'http://www.tompkinsstatebank.com'


theImage[2] = new objImage()
theImage[2].url = 'images/remax728.jpg';
theImage[2].hyperlink = 'http://www.tomknapp.com';


theImage[3] = new objImage()
theImage[3].url = 'images/stmarys728.jpg';
theImage[3].hyperlink = 'http://www.osfstmary.org';


theImage[4] = new objImage()
theImage[4].url = 'images/CSC728.jpg';
theImage[4].hyperlink = 'http://www.sandburg.edu'

theImage[5] = new objImage()
theImage[5].url = 'images/cratty728.jpg';

theImage[6] = new objImage()
theImage[6].url = 'images/galesburgcommunity728.jpg';
theImage[6].hyperlink = 'http://www.endowgburg.org'

theImage[7] = new objImage()
theImage[7].url = 'images/firstpresbyterian728.jpg';
theImage[7].hyperlink = 'http://www.fpcgalesburg.com'

theImage[8] = new objImage()
theImage[8].url = 'images/century21728.jpg';
theImage[8].hyperlink = 'http://www.century21galesburg.com'

theImage[9] = new objImage()
theImage[9].url = 'images/bcz728.jpg';
theImage[9].hyperlink = 'http://www.bczengineering.com'

theImage[10] = new objImage()
theImage[10].url = 'images/glassspecialty728.jpg';

theImage[11] = new objImage()
theImage[11].url = 'images/tristates728.jpg';
theImage[11].hyperlink = 'http://www.tristateswater.com'

theImage[12] = new objImage()
theImage[12].url = 'images/owen728.jpg';
theImage[12].hyperlink = 'http://www.owendds.com'





//================================
//end definitions
//================================

//assign a variable to the length of theImage Array (total images added)
var p = theImage.length;

//Calculate a random number between 0 and the total amount of theImage
var whichImage = Math.round(Math.random()*(p-1));

//Write the HTML onto the page

document.write('<a href="'+theImage[whichImage].hyperlink+'">');
document.write('<img src="'+theImage[whichImage].url+'"');
document.write('</a>');




