/********************************************
*	Broncos Country Administration Tool v2	*
*	@author Eric Neimeister					*
*	@version 1.0							*
*											*
*	This JavaScript file includes functions	*
*	which enable the AJAX portions of the	*
*	tool to function.						*
********************************************/

var xmlDoc;

function loadXML(file, data, callback) {
	xmlDoc = false;
	if(window.XMLHttpRequest && !(window.ActiveXObject)) {
		try {
			xmlDoc = new XMLHttpRequest();
		} catch(E) {
			xmlDoc = false;
		}
	} else if(window.ActiveXObject) {
		try {
			xmlDoc = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(E) {
			try {
				xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(E) {
				xmlDoc = false;
			}
		}
	}
	
	if(xmlDoc) {
		xmlDocCallback = callback;
		xmlDoc.onreadystatechange = handleXMLCallback;
		xmlDoc.open("POST", file, true);
		xmlDoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlDoc.send(data);
	} else {
		alert("It would appear that your browser does not support the required features needed to complete this task."); //YMMV
	}
}
	
function handleXMLCallback() {
	if (xmlDoc.readyState == 4) {
		if (xmlDoc.status == 200) {
			xmlDocCallback(xmlDoc.responseText);
		} else {
			alert("There was a problem retrieving the XML data:\n" + xmlDoc.statusText);
		}
	}
}