var images = new Array();
var photos = new Array();
var index = 0;

images[0] = "new-listings-on.gif";
images[1] = "advanced-search-on.gif";
images[2] = "open-houses-on.gif";
images[3] = "commercial-property-on.gif";
images[4] = "community-on.gif";
images[5] = "agent-bios-on.gif";
images[6] = "new-listings-over.gif";
images[7] = "advanced-search-over.gif";
images[8] = "open-houses-over.gif";
images[9] = "commercial-property-over.gif";
images[10] = "community-over.gif";
images[11] = "agent-bios-over.gif";

for (i = 0; i < images.length; i++) {
	image = new Image();
	image.src = "images/" + images[i];
}

function imageOn(id) {
	document.getElementById(id).src = "images/" + id + "-on.gif";
}

function imageOff(id) {
	document.getElementById(id).src = "images/" + id + "-off.gif";
}

function imageOver(id) {
	document.getElementById("topnavbar").src = "images/" + id + "-over.gif";
}

function loadPhotos(photoList) {
	photos = photoList.split(',');
	for (i = 0; i < photos.length; i++) {
		photo = new Image();
		photo.src = "properties_large/" + photos[i];
	}
}

function displayNextPhoto() {
	if (index >= photos.length - 1) {
		index = photos.length - 1;
	} else {
		index++;
	}
	document.getElementById("featured-photo").src = "properties_large/" + photos[index];
	displayIndex(index);
}

function displayPreviousPhoto() {
	if (index <= 0) {
		index = 0;
	} else {
		index--;
	}
	document.getElementById("featured-photo").src = "properties_large/" + photos[index];
	displayIndex(index);
}

function displayIndex(index) {
	document.getElementById("display").innerHTML = "Photo " + eval(index + 1) + " of " + photos.length;
}