// JavaScript Document

// array of banner images (MAKE SURE YOU PLACE IMAGES IN "i/ads" FOLDER)
var heroes = new Array();
heroes[0] = "believe.jpg";
heroes[1] = "FinSvcs-invest-retire.jpg";
heroes[2] = "MortgageBanner1.jpg";
heroes[3] = "avoidfees.jpg";


//array of banner links (THESE MUST CORRESPOND TO ABOVE ORDER)
var links = new Array();
links[0] = "#";
links[1] = "financialfirst.html";
links[2] = "loansconstructmort.html";
links[3] = "personalchecking.html";

// randomly select an image
var whichHero=Math.floor(Math.random()*heroes.length);
var url = "i/ads/" + heroes[whichHero];

//place selected image
document.write("<div id=\"hero\"></div>");

function nextHero() {
	whichHero++;
	if(whichHero == heroes.length){ whichHero = 0 };
	var bannerURL = "i/ads/" + heroes[whichHero];
	var newHTML = "<a href=\"" + links[whichHero] + "\"><img src=\"" + bannerURL + "\" width=\"544\" height=\"300\" border=\"0\"  hspace=\"0\" vspace=\"0\"/></a>";
	document.getElementById('hero').innerHTML = newHTML;
}
nextHero();

//THIS NUMBER CONTROLS THE DURATION AN AD IS ON SCREEN
setInterval(nextHero,9500);
