// Ajax core components

/* The default AJAX request object.  Creating the default AJAX
 * up front effectivly test to see if the browser supports AJAX.
 * The actual object creation takes place after the function
 * definition.
 */
var FRL_ajax_request = null;

/* Generate a new request object using one of the browser specific
 * options available. (from: Head Rush Ajax. O'reilly)
 */
function FRL_new_ajax_request() {
	try {
		request = new XMLHttpRequest();
	} 
	catch (trymicrosoft) {
		try {
			request = new ActiveXObject("msxml12.XMLHTTP");
		} 
		catch (othermicrosoft) {
			try {
				request = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (failed) {
				request = null;
			}
		}
	}
	if(request == null) {
		alert("Error creating XMLHttpRequest!");
	}
	else {
		return request;
	}
}

FRL_ajax_request = FRL_new_ajax_request();

function FRL_ajax_shout() {
	if (FRL_ajax_request.readyState == 4) {
		alert(FRL_ajax_request.responseText);
	}
}
function FRL_ajax_chatter() {
	alert(FRL_ajax_request.responseText);
}

function FRL_ajax_error(e) {
	alert("Error:  The request failed with the following error(s):\n\n" + e);
}
