function makeHttpRequestEx(URL, formData, callbackFunc, ysnReturnXML)
{
	var xmlHttpRequest, sendMethod;

	if (window.XMLHttpRequest) { // Mozilla, Safari, IE7
		xmlHttpRequest = new XMLHttpRequest();
		if (xmlHttpRequest.overrideMimeType && !ysnReturnXML)
			xmlHttpRequest.overrideMimeType("text/html");
	} else if (window.ActiveXObject) { // IE6
		try {
			xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP.6.0");
		} catch (e) {
			try {
				xmlHttpRequest = new ActiveXObject("MSxml2.XMLHTTP"); // Version 3
			} catch (e) { }
		}
	}

	window.callbackFunc = callbackFunc;
	xmlHttpRequest.onreadystatechange = function() {
		if (xmlHttpRequest.readyState == 4)
			window.callbackFunc(xmlHttpRequest);
	}

	if (formData != null) {
		xmlHttpRequest.AddHeader("content-type", "application/x-www-form-urlencoded");
		sendMethod = "POST";
	}
	else
		sendMethod = "GET";

	xmlHttpRequest.open(sendMethod, URL, true);
	xmlHttpRequest.send(formData);

	return xmlHttpRequest;
}

function populateFromURL(id, resource) 
{
  var popHelper = function(httpReq) {
    document.getElementById(id).innerHTML = httpReq.responseText;
  }
  makeHttpRequestEx(resource, null, popHelper, false);
}

// Attach an event handler to an object (browser-independent).
// First clause is W3C DOM method, second is DHTML (IE).
function addEvent(obj, evType, fn, useCapture) {
	try {
		if (obj.addEventListener) {
			obj.addEventListener(evType, fn, useCapture);
			return true;
		}
		else if (obj.attachEvent) {
			var r = obj.attachEvent("on" + evType, fn);
			return r;
		}
	}
	catch (e) { }
}

// Release an event handler from an object (browser-independent).
// First clause is W3C DOM method, second is DHTML (IE).
function removeEvent(obj, evType, fn, useCapture) {
	if (obj.removeEventListener) {
		obj.removeEventListener(evType, fn, useCapture);
		return true;
	}
	else if (obj.detachEvent) {
		obj.detachEvent("on" + evType, fn);
		return true;
	}
}

// Stops a DOM event from propagating further than the current handler.
// Note: Returning false from event handlers in IE 6 & 7 does the same thing.
function stopEventPropagation(evObj) {
	if (evObj.preventDefault)
		evObj.preventDefault();
	// Calling cancelButton after stopPropagation
	// may negate the stopPropagation so do not do it. -KB
	if (evObj.stopPropagation)
		evObj.stopPropagation();
	else if (evObj.cancelBubble)
		evObj.cancelBubble();
}
