// Preload the tour images

if (document.images)
{
	pic1= new Image(498,276); 
	pic1.src="/images/loading.gif"; 
}

/*
 * Create the XMLHttpRequest object
 */

var xmlhttp=false;
try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
}

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	xmlhttp = new XMLHttpRequest();
}

/*
 * Uses AJAX to replace the image and HTML in the tour
 */

function changeImage(imageNumber) {
	
	// Make sure JavaScript is enabled
	if (!document.getElementById) return false; 
	
	var businesstour = document.getElementById("businesstour");
	
	// Give an "Updating ..." message, in case the PHP takes awhile
	document.getElementById("businesstour").innerHTML = "<div id=\"businesstourimage\"> <img src=\"/images/loading.gif\" width=\"498\" height=\"276\" alt=\"Loading\" /> </div>";
	
	// Call the PHP to get the next image HTML
	xmlhttp.open("GET","/switchImage.php?imageNumber="+imageNumber,true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			// Replace the HTML
			businesstour.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);	
}