var Photos = {
	list: new Array(),
	altList: new Array(),
	id: "",
	obj: new Object(),
	currentIndex: 0,
	showingPhotos: true,
	showNext: function(reverse) {
		showPhotos();
		if (reverse) {
			this.currentIndex--;
			if (this.currentIndex<0) this.currentIndex = this.list.length-1;
		}
		else {
			this.currentIndex++;
			if (this.currentIndex>(this.list.length-1)) this.currentIndex = 0;
		}
		this.obj.src = this.list[this.currentIndex] + "/image_preview";
                this.obj.alt = this.altList[this.currentIndex]
	},
	
	showPrevious: function() {this.showNext(true);},
	
	initiate: function(imageList, id) {
		this.id = id;
		this.obj = document.getElementById(id);
		this.list = imageList;
                this.altList = altList;
		for (i in imageList) preloadImages(imageList[i] + "/image_preview");
	}
}

function showPhotos() {
	if (!Photos.showingPhotos) {
		document.getElementById('photos').className = "photos-tab";
		document.getElementById('photo-viewer').style.display = "block";
		
		document.getElementById('virtual-tour').className = "photos-tab disabled";
		document.getElementById('virtual-tour-viewer').style.display = "none"; 
		Photos.showingPhotos = true;
	}
}

function showVirtualTour() {
	if (Photos.showingPhotos) {
		document.getElementById('photos').className = "photos-tab disabled";
		document.getElementById('photo-viewer').style.display = "none";
		
		document.getElementById('virtual-tour').className = "photos-tab";
		document.getElementById('virtual-tour-viewer').style.display = "block";
		Photos.showingPhotos = false;
	}
}