function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function setVisibleAnimate(index){
	//assumes the visible class is 'propertyVisible' and the invisible class is 'propertyInvisible'
	//assumes the divs to turn on and off are called 'propertyN' where N is an integer.
	//alert("running setVisible");
	var object = document.getElementById('property' + index);
	for (var j = 1; j < 15; j+=1) {
		if (j != index) {
			object = document.getElementById('property' + j);
			object.className = 'propertyInvisible';
			//alert("doing " + j + " for index of " + index);
		}
	}
	object = document.getElementById('property' + index);
	object.className = 'propertyVisible';
	
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
	
		p1 = newImage("assets/uploads/TheCache-web.jpg");
		p2 = newImage("assets/uploads/TheCacheB-web.jpg");
		p3 = newImage("assets/uploads/TheCardigan-web.jpg");
		p4 = newImage("assets/uploads/TheCarson-web.jpg");
		p5 = newImage("assets/uploads/TheLamar-web.jpg");
		p6 = newImage("assets/uploads/TheMadison-web.jpg");
		p7 = newImage("assets/uploads/TheNorthFork-web.jpg");
		p8 = newImage("assets/uploads/TheOswego-web.jpg");
		p9 = newImage("assets/uploads/ThePipestone-web.jpg");
		p10 = newImage("assets/uploads/TheSages-web.jpg");
		p11 = newImage("assets/uploads/TheSeton-web.jpg");
		p12 = newImage("assets/uploads/TheVentura-web.jpg");
		p13 = newImage("assets/uploads/TheWillow-web.jpg");
		p14 = newImage("assets/uploads/TheSenecaB-web.jpg");
		preloadFlag = true;
		
		var interval = 3000;
		var t = new Array(140);
		for (var j = 0; j < 140; j+=1) {
			for (var i = 1; i < 15 ; i+=1){
				t[i+j] = setTimeout("setVisibleAnimate('" + i + "')",interval*(i + 1)+j*interval*14);
			}
		}
		//set the first one visible again, after the entire animation sequence completes at 140*15*3000 milliseconds
		setTimeout("setVisible(t[0])",6300000);

	}
}
function setVisible(index){
	var object = document.getElementById('property' + index);
	object.className = 'propertyVisible';
}