// a simple photo rotation script
// by charles toeppe


var photoNumber = 0;
var timeObject;

function photoRotator() {
	// for each photo you have, add a line for that photos link
	// make sure to put it in order of the photos number
	var photoInfo = Array(
		"http://www.marygraceliparoto.remax-michigan.com/remaxmi/modules/internet/search/includes/mapsearch/listingpopup.asp?mlsid=3010&mlsnumber=210039698&l=y",
		"http://www.marygraceliparoto.remax-michigan.com/remaxmi/modules/internet/search/includes/mapsearch/listingpopup.asp?mlsid=3010&mlsnumber=29094661&l=y",
		"http://www.marygraceliparoto.remax-michigan.com/remaxmi/modules/internet/search/includes/mapsearch/listingpopup.asp?mlsid=3010&mlsnumber=29149532&l=y",
		"http://www.marygraceliparoto.remax-michigan.com/remaxmi/modules/internet/search/includes/mapsearch/listingpopup.asp?mlsid=3010&mlsnumber=29109848&l=y",
		"http://www.marygraceliparoto.remax-michigan.com/remaxmi/modules/internet/search/includes/mapsearch/listingpopup.asp?mlsid=3005&mlsnumber=2909243&l=y",
		"http://www.marygraceliparoto.remax-michigan.com/remaxmi/modules/internet/search/includes/mapsearch/listingpopup.asp?mlsid=3010&mlsnumber=29108821&l=y",
	"");
	
	// change the link
	var linkObject =  document.getElementById("photoRotatorLink");
	linkObject.setAttribute("href", photoInfo[photoNumber]);
	
	// change the photo
	var photoObject =  document.getElementById("photoRotatorPhoto");
	photoObject.setAttribute("src", "./photos/"+photoNumber+".jpg");

   photoNumber++; // increment the photoNumber
   
	// if the photoNumber is at the end, than start over
	if(photoNumber == (photoInfo.length - 1)) {
   	photoNumber = 0;
	}

	timeObject = setTimeout("photoRotator()",5000); // call this function in 5 seconds
}