function loadNextImage() {
	//get Element with sequential src
	var myImage = document.getElementById('specialistImage');
	var myHeadline = document.getElementById('specialistHeadline');
	var myText = document.getElementById('specialistText');
	var myLink = document.getElementById('specialistLink');

	//declare home banner path and images array
	var thePath = "/library/";
	var theImages = new Array();
	var theHeadlines = new Array();
	var theText = new Array();
	var theSite = document.location.hostname;
	var theLinks = new Array();
	theImages[0] = "jeanlapp_promo.jpg"; 
		theHeadlines[0] = "Is your dream home<br />in Anchorage?"; 
		theText[0] = "<a href=\"/jean_lapp\.html\">Jean Lapp</a> makes dreams come true.";
		theLinks[0] = "/jean_lapp.html";
	theImages[1] = "maryannpierre_promo.jpg"; 
		theHeadlines[1] = "Is your dream home<br />in Eagle River?"; 
		theText[1] = "<a href=\"/mary_ann_pierre\.html\">Mary Ann Pierre</a> makes dreams<br /> come true.";
		theLinks[1] = "/mary_ann_pierre.html";
	theImages[2] = "mikescott_promo.jpg"; 
		theHeadlines[2] = "Is your dream home<br />in Anchorage?"; 
		theText[2] = "<a href=\"/mike_scott\.html\">Mike Scott</a> makes dreams come true.";
		theLinks[2] = "/mike_scott.html";
	theImages[3] = "jozetteboyd_promo.jpg"; 
		theHeadlines[3] = "Is your dream home<br />in Fairbanks?"; 
		theText[3] = "<a href=\"/jozette_boyd\.html\">Jozette Boyd</a> makes dreams come true.";
		theLinks[3] = "/jozette_boyd.html";
	theImages[4] = "marilynpipkin_promo.jpg"; 
		theHeadlines[4] = "Is your dream home<br />in Kenai or Soldotna?"; 
		theText[4] = "<a href=\"/marilyn_pipkin\.html\">Marilyn Pipkin</a> makes dreams come true.";
		theLinks[4] = "/marilyn_pipkin.html";
	theImages[5] = "karrieyoungblood_promo.jpg"; 
		theHeadlines[5] = "Is your dream home<br />in Homer?"; 
		theText[5] = "<a href=\"/karrie_youngblood\.html\">Karrie Youngblood</a> makes dreams<br /> come true.";
		theLinks[5] = "/karrie_youngblood.html";
	theImages[6] = "katier_promo.jpg"; 
		theHeadlines[6] = "Is your dream home<br />in Wasilla?"; 
		theText[6] = "<a href=\"/katie_r\.html\">Katie Richardson</a> makes dreams<br /> come true.";
		theLinks[6] = "/katie_r.html";
	theImages[7] = "monicabarton_promo.jpg"; 
		theHeadlines[7] = "Is your dream home<br />in Wasilla?"; 
		theText[7] = "<a href=\"/monica_barton\.html\">Monica Barton</a> makes dreams<br /> come true.";
		theLinks[7] = "/monica_barton.html";
	theImages[8] = "tinachowaniec_promo.jpg"; 
		theHeadlines[8] = "Is your dream home<br />in Wasilla?"; 
		theText[8] = "<a href=\"/tina_chowaniec\.html\">Tina Chowaniec</a> makes dreams<br /> come true.";
		theLinks[8] = "/tina_chowaniec.html";		
	theImages[9] = "shirlenewells_promo.jpg"; 
		theHeadlines[9] = "Is your dream home in Bethel, Cordova, Glennallen, Haines, Healy, Juneau, Kodiak, Seward, Sitka or Valdez?"; 
		theText[9] = "<a href=\"/shirlene_wells\.html\">Shirlene Wells</a> makes dreams come true.";
		theLinks[9] = "/shirlene_wells.html";
	theImages[10] = "vivienlafevers_promo.jpg"; 
		theHeadlines[10] = "Is your dream home<br />in Wasilla?"; 
		theText[10] = "<a href=\"/vivien_lafevers\.html\">Vivien LaFevers</a> makes dreams<br /> come true.";
		theLinks[10] = "/vivien_lafevers.html";		
	// IMPORTANT Keep the array numbers above this line consistent with rotating_home.js. This will keep the syncing of these two scripts much simpler!

	//get current cookie value
	var currentIndex = parseInt(getCookie());
	var imgPath = thePath + theImages[currentIndex];
	var linkPath = 'http://' + theSite + theLinks[currentIndex];
	
	//apply src to Element
	myImage.src = imgPath;
	myHeadline.innerHTML = theHeadlines[currentIndex];
	myText.innerHTML = theText[currentIndex];
	myLink.href = linkPath;
	
	//set next cookie index
	currentIndex += 1;
	if(currentIndex > (theImages.length - 1)) {
		currentIndex = 0;
	}
	setCookie(currentIndex);
}

function setCookie(someint) {
	var now = new Date();
	var addDays = now.getDate() + 7
	now.setDate(addDays); // cookie expires in 7 days
	var theString = 'imgID=' + escape(someint) + ';expires=' + now.toUTCString();
	document.cookie = theString;
}

function getCookie() {
	var output = "0";
	if(document.cookie.length > 0) {
		var temp = unescape(document.cookie);
		temp = temp.split(';');
		for(var i = 0; i < temp.length; i++) {
			if(temp[i].indexOf('imgID') != -1) {
				temp = temp[i].split('=');
				output = temp.pop();
				break;
			}
		}
	}
	return output;
}

addLoadEvent(loadNextImage);
