function empireAJAX(){
	//declare the local variables
	var m_url = '';
	var m_parameters = new Array();
	var m_transport = GetTransport(); 
	var m_method = 'post';
	var m_asynchronous = true;
	var m_events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
	var m_status = 0;
	var m_responsetext = '';
	var m_state = m_events[0];
	var m_callback;
	var m_callbackargs = new Array();
	
	//Variables to store the response if desired
	//If cache is true the cache will be stored until the timeout is hit
	//Array positions will be (Url + parameters (ordered alpha), time to recache (time of response + timeout), responsetext)
	var m_cache = false;
	var m_cacheTimeout = 0;  //in seconds
	var m_cachedResponses = new Array();
	
	this.setURL = function(page){
		m_url = page;
	}
	
	this.getURL = function(){
		return m_url;
	}
	
	this.reset = function(){
		m_url = '';
		m_parameters.length = 0;
		m_method = 'post';
		m_asynchronous = true;
		m_responsetext = '';
		m_callback = null;
		m_callbackargs.length = 0;
		m_cache = false;
		m_cacheTimeout = 0;
	}
	
	this.setCallback = function (callback){
		m_callback = callback;
	}
	
	this.setCallbackArgs = function (callbackargs){
		m_callbackargs = callbackargs;
	}
	
	this.cacheResponse = function(cache){
		m_cache = cache;
	}
	
	this.cacheTimeout = function(timeout){
		m_cacheTimeout = timeout;
	}
	
	this.addParameter = function(paramName, paramValue){
		m_parameters.length = m_parameters.length + 1;
		m_parameters[m_parameters.length - 1] = new Array(paramName, paramValue);
	}
	
	this.clearParameters = function(){
		m_parameters.length = 0;
	}

	this.setMethod = function (method){
		if (method.toLowerCase() == 'get' || method.toLowerCase() == 'post') {
			m_method = method.toLowerCase();
		}
	}
	
	this.getMethod = function(){
		return m_method;
	}
	
	this.setAsynch = function(asynch){
		m_asynchronous = asynch;
	}
	
	this.getAsynch = function(){
		return m_asynchronous;
	}
	
	
	this.send = function(){
		var tempURL = m_url;
	
		//Make sure the stuff is set correctly
		if (m_url == ''){
			return false;
		} 
		
		//Check to see if there is anything cached for this request.  Use the cached response if possible.
		if (m_cache) {
			if (getCache()) {
				if (m_callback){
					m_callback.apply(null, [m_callbackargs]);
				}
				return true;
			} 
		}
		
		//if the method is get append the parameters to the url
		if (m_method == 'get' && m_parameters.length > 0){
			tempURL = tempURL + '?';
			for (var j = 0; j <= m_parameters.length - 1; j++){
				tempURL = tempURL + (j == 0 ? '' : '&') + m_parameters[j][0] + '=' + escape(m_parameters[j][1]);
			}
		}
		
		//open the url
		try {
			
			m_transport.open(m_method.toUpperCase(), tempURL, m_asynchronous);
			
			//if ascynchronous set the function for ready state
			if (m_asynchronous) {
				m_transport.onreadystatechange = onStateChange;
			}
			
			setHeaders();
			
			//post needs the parameters in the body
			var l_parameters = '';
			if (m_method == 'post' && m_parameters.length > 0){
				for (var j = 0; j <= m_parameters.length - 1; j++){
					l_parameters = l_parameters + (j == 0 ? '' : '&') + m_parameters[j][0] + '=' + escape(m_parameters[j][1]);
				}
			}
			
			//make the request
			m_transport.send(m_method == 'post' ? l_parameters : null);
			
			if (m_asynchronous  == false && m_transport.status == 200){
				m_responsetext = m_transport.responseText;
				if (m_cache) {
					setCache();
				}
				if (m_callback){
					m_callback.apply(null, [m_callbackargs]);
				}
			}
			
		} catch (e) {
			return false;
		}
		
		return true;
		//End send
	}
	
	onStateChange = function(){
		var readyState = m_transport.readyState;
		m_state = m_events[readyState];

		var l_event = m_events[readyState];
		
		if (l_event == 'Complete'){
			//done check the status
			
			m_status = m_transport.status;
			
			if (m_status == 200){
				m_responsetext = m_transport.responseText;
				if (m_cache){
					setCache();
				}
				if (m_callback){
					m_callback.apply(null, [m_callbackargs]);
				}
			}
			else {
				m_responsetext = '';
			}
			//Clean up onreadystatechange
			m_transport.onreadystatechange = function(){};
		}
	}
	
	this.getState = function(){
		return m_state;
	}
	
	this.getResponseText = function(){
		return m_responsetext;
	}
	
	setHeaders = function(){
		//set the request headers
		//post needs special headers
		if (m_method == 'post'){
			m_transport.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		}
		
		if (m_transport.overrideMimeType){
			//needs removed when Mozilla 1.5b or else errors
			m_transport.overrideMimeType('Connection', 'close');
		}
	}
	
	setCache = function(){
		var tempURL = m_url + '?';
	
		m_parameters.sort();
		for (var j = 0; j <= m_parameters.length - 1; j++){
			tempURL = tempURL + (j == 0 ? '' : '&') + m_parameters[j][0] + '=' + escape(m_parameters[j][1]);
		}
			
		//check to see if it is already cached
		var position = checkCache(tempURL);
		
		if (position == -1){
			
			//add the response to the cache
			m_cachedResponses.length = m_cachedResponses.length + 1;
			m_cachedResponses[m_cachedResponses.length - 1] = new Array(tempURL, new Date((new Date()).getTime() + m_cacheTimeout * 1000), m_responsetext);
		}
		
	}
	
	checkCache = function(checkURL){
		//function to check if the cache already exists for this url and parameters
		//return the position in the array -1 if none
		var foundPos = -1;
		
		if (m_cachedResponses == '' || m_cachedResponses == null){return -1;}
		
		//Loop through to see if the url exists
		for (var j = 0; j <= m_cachedResponses.length - 1; j++){
			if (m_cachedResponses[j][0] == checkURL) {
				//Make sure that the date is not too old
				if (m_cachedResponses[j][1] > new Date()) {
					//it is ok we found the one to use;
					foundPos = j;
					break;
				} else {
					//delete this one and return
					m_cachedResponses.splice(j, 1);
				}
			}
		}
		
		return foundPos;
	}
	
	getCache = function(){
		//check to see if the cache exists for this one if does then set the response text and
		//return true if found  false if not found
		var tempURL = m_url + '?';
	
		m_parameters.sort();
		for (var j = 0; j <= m_parameters.length - 1; j++){
			tempURL = tempURL + (j == 0 ? '' : '&') + m_parameters[j][0] + '=' + escape(m_parameters[j][1]);
		}
			
		//check to see if it is already cached
		var position = checkCache(tempURL);
		
		if (position == -1) {
			return false;
		} else {
			m_responsetext = m_cachedResponses[position][2];
			m_status = 200;
			m_state = m_events[4];
			return true;
		}
	}
	
	//End AJAX object
}


/*---------------------------------------------*/
var Try = {
  these: function() {
    var returnValue;

    for (var i = 0; i < arguments.length; i++) {
      var arg = arguments[i];
      try {
        returnValue = arg();
        break;
      } catch (e) {}
    }

    return returnValue;
  }
}

function GetTransport(){
	return Try.these(
		function() {return new ActiveXObject('Msxml2.XMLHTTP')},
		function() {return new ActiveXObject('Microsoft.XMLHTTP')},
		function() {return new XMLHttpRequest()}
	) || null;
}

