// JavaScript Document

/*********************

This AJAX function allows you to pass a URL for an XML document and a function
to execute after the data has been loaded.

Start the function you want to execute with the following:

function myFunction() {	
	// The following will check if the data has been received
	if(ajaxRequest.readyState == 4) {
		xmldata = ajaxRequest.responseXML;
		
	// code to execute here if you'd like. All this function needs to do is put XML
	// code into the variable xmldata;
	}
}


**********************/

var ajaxRequest;	// The request object made public to access it from other functions
var xmldata;		// Returned XML data

function createRequest(){
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser doesn't support XML requests");
				return false;
			}
		}
	}
}

function getData(url, myFunction) {
	createRequest();
	var _execute = myFunction;
	ajaxRequest.onreadystatechange = _execute;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.send(null);
}
  

