//xmlhttp.js
// This file contains the JavaScript functions used by Monomagic.
//
//File created 3/6/2008.
//
//Function to create an XMLHTTP Object
function getxmlhttp(){
//The following code comes from Lee Babin's 'Beginning AJAX with PHP p21
//create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp = false;
//check if we're using IE.
try {
//If the Javascript version is greater than 5.
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	//alert ("You are using Microsoft Internet Explorer");
	} catch (e) {
	//if not, then use the older actve X object.
	try {
		// If we are using Internet Explorer
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		//alert ("You are using Microsoft Internet Explorer");
	} catch (E) {
		//else we must be using an non-IE browser.
		xmlhttp = false;
	}
}

//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	xmlhttp = new XMLHttpRequest();
	//alert ("You are NOT using Internet Explorer");
	}
return xmlhttp;
} //End of function.

function makerequest(serverpage, objID) {
	// Get an XMLHTTP Object for use.	
	var theimg;
	xmlhttp = getxmlhttp ();
	xmlhttp.open("GET", serverpage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById(objID).innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
} //End of function

function Preload(Prev,Current,Next) {
/*
	This function preloads the current, previous and next images on a gallery page to speed up the site.
	Added 6/12/2007 by MP.
*/
  if (document.images) {
  		var PrevImage = new Image();
  		PrevImage.src = Prev;
  		var CurrImage = new Image();
  		CurrImage.src = Current;
  		var NextImage = new Image();
  		NextImage.src = Next;
  	}
}