function newXmlhttp() {
	// Boolean variable indicates whether browser is IE
	var xmlhttp = false;
	
	// Running IE?
	try {
		// IE5.0 or higher?
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e) {
		// Older version of IE?
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e) {
			// non-IE browser
			xmlhttp = false;
		}
	}
	
	// Non-IE browser; create a JavaScript instance of the object
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}

function getURLData(url, objID, wait) {
	var obj = document.getElementById(objID);
	var xmlhttp = newXmlhttp();
	
	if (arguments.length == 2) {
		wait = false;
	}
	
	xmlhttp.open('GET', url, !wait);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			switch (xmlhttp.status) {
				case 200:	// OK
					obj.innerHTML = xmlhttp.responseText;
					break;
				default:
					obj.innerHTML = 'Error: ' + xmlhttp.statusText;
			}
		}
	}
	xmlhttp.send(null);
	if (wait) {
		switch (xmlhttp.status) {
			case 200:	// OK
				obj.innerHTML = xmlhttp.responseText;
				break;
			default:
				obj.innerHTML = 'Error: ' + xmlhttp.statusText;
		}
	}
}

function postURLData(url, objID, params, wait) {
	var obj = document.getElementById(objID);
	var xmlhttp = newXmlhttp();
	
	if (arguments.length == 2) {
		wait = false;
	}
	
	xmlhttp.open('POST', url, !wait);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			switch (xmlhttp.status) {
				case 200:	// OK
					obj.innerHTML = xmlhttp.responseText;
					break;
				default:
					obj.innerHTML = 'Error: ' + xmlhttp.statusText;
			}
		}
	}
	xmlhttp.send(params);
	if (wait) {	// needed for synchronous calls
		switch (xmlhttp.status) {
			case 200:	// OK
				obj.innerHTML = xmlhttp.responseText;
				break;
			default:
				obj.innerHTML = 'Error: ' + xmlhttp.statusText;
		}
	}
}

function removeForm(objID) {
	var obj = document.getElementById(objID);
	obj.innerHTML = '';	// zap it
}