function createRequestObject() {
	try {
		return window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e) {
		return false;
	}
}



var http = createRequestObject();



function exhibition(ex_id) {
	var url = 'scripting.php?ex_id='+ex_id;
	http.open('GET', url);
	http.onreadystatechange = handle_ex;
	http.send(null);
}



function handle_ex() {
	try {
		if(http.readyState == 4 && http.status == 200) {
			var response = http.responseText;
			
			var update = new Array();
			var breaker = '|||';
			
			if(response.indexOf(breaker) != -1) {
				update = response.split(breaker);
				
				var image = update[0];
				var caption = update[1];
				
				var X = document.getElementById("X");
				
				X.innerHTML = "<p class=\"t13\">" + image + "<br/>\n" + caption + "</p>";
			}
		} else {
			//not working
		}
	} catch (e) {
		alert(e);
	}
}



function art(art_id) {
	var url = 'scripting.php?art_id='+art_id;
	http.open('GET', url);
	http.onreadystatechange = handle_art;
	http.send(null);
}



function handle_art() {
	try {
		if(http.readyState == 4 && http.status == 200) {
			var response = http.responseText;
			
			var update = new Array();
			var breaker = '|||';
			
			if(response.indexOf(breaker) != -1) {
				update = response.split(breaker);
				
				var artist = update[0];
				var filename = update[1];
				var title = update[2];
				var year = update[3];
				var medium = update[4];
				var dimensions = update[5];
				var sig = update[6];
				var imagewidth = update[7];
				var imageheight = update[8];
				
				var X = document.getElementById("artist_left");
				
				X.innerHTML = "<br /><img src=\"art_images/" + filename + "\" border=\"0\" width=\"" + imagewidth + "\" height=\"" + imageheight + "\" alt=\"\" /><br />\n<p class=\"t13\">" + artist.toUpperCase() + "</p>\n<p class=\"t13\"><i>" + title + "</i>\n<br />" + year + "\n<br />" + medium + "\n<br />" + dimensions + "\n<br />" + sig + "</p>\n" + "<p class=\"t12\"><a href=\"mailto:ks@ameringer-yohe.com\">Please contact the gallery for prices.</a></p><br />";
			}			
		} else {
			//not working
		}
	} catch (e) {
		alert(e);
	}
}



function install(install_id) {
	var url = 'scripting.php?install_id='+install_id;
	http.open('GET', url);
	http.onreadystatechange = handle_install;
	http.send(null);
}



function handle_install() {
	try {
		if(http.readyState == 4 && http.status == 200) {
			var response = http.responseText;
			
			var x = document.getElementById("curr_install");
			
			x.innerHTML = "<p align=\"center\"><img src=\"install_images/" + response + "\"/></p>";
		} else {
			//not working
		}
	} catch (e) {
		alert(e);
	}
}