/*Usage
* var request = getHTTPObject();
* if(request){
* AJAX CODE HERE
* }
*
* If getHTTPObject returns false, the browser isn't Ajax compatible. The if
* statement checks to see if it exists, then runs the code.
*/
function getHTTPObject() {
	var xhr = false;//set to false, so if it fails, do nothing
	if(window.XMLHttpRequest) {//detect to see if browser allows this method
		var xhr = new XMLHttpRequest();//set var the new request
	} else if(window.ActiveXObject) {//detect to see if browser allows this method
		try {
			var xhr = new ActiveXObject("Msxml2.XMLHTTP");//try this method first
		} catch(e) {//if it fails move onto the next
			try {
				var xhr = new ActiveXObject("Microsoft.XMLHTTP");//try this method next
			} catch(e) {//if that also fails return false.
				xhr = false;
			}
		}
	}
	return xhr;//return the value of xhr
}	
/*Executed on click. Passes the url to the function. Function opens the URL then
*the parseResponse function is called
*/
function updateInnerHTML(id, file) {
	var request = getHTTPObject();
	request.onreadystatechange = function() {
		parseResponse(request, id);//this is what happens once complete
	}
	request.open("GET",file,true);
	request.send(null);
}

/*Once the request state is complete and the file exists, it grabs the results
* div, and inserts the response text and innerHTML.
*/
function parseResponse(request, id) {
	if(request.readyState == 4){
		if(request.status == 200 || request.status == 304){
			var results = document.getElementById(id).innerHTML = request.responseText;
		}
	}
}