function getXMLHTTPObj() {
	try {
		return new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			return new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			return null;
		}
	}
}

function getURL(url, method, data, basync, fcallback, bshowError) {
	if (method == null) {
		method = "GET";
	}
	
	if (basync == null) {
		basync = false;
	}
	
	if (bshowError == null) {
		bshowError = true;
	}
	
	var httpObj = getXMLHTTPObj();
	if (httpObj == null) {
		if (!basync) {
			return "";
		}
		else {
			return false;
		}
	}		

	try {
		httpObj.open(method, url, basync);
		if (fcallback != null) {
			httpObj.onreadystatechange = function() {
				if (httpObj.readyState == 4) {
					if (httpObj.status == 200) {
						if (typeof fcallback == "function") {
							fcallback(checkReturnXML(httpObj.responseText));
						}
					}
				}
			}
		}
		for (var strHeader in customHeaders) {
			httpObj.setRequestHeader(strHeader, customHeaders[strHeader]);
		}
		if (data == null) {
			httpObj.setRequestHeader("Content-Type", "text/xml");
			httpObj.send();
		}
		else {
			httpObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
			httpObj.send("=" + data);
		}
		if (!basync) {
			return httpObj.status == 200 ? checkReturnXML(httpObj.responseText) : "";
		}
		return true;
	}
	catch(err) {
		if (bshowError) {
			alertFade('<span style="color: maroon; font-weight: bold; font-size: 14px;">Problem Encountered:</span><br><br><span style="color: green; font-size: 12px;">' + err.description + '</span>', 5);
		}
		if (!basync) {
			return "";
		}
		return false;
	}
}

function checkReturnXML(strXML) {
	var domObj = new ActiveXObject("Microsoft.XMLDOM");

	if (domObj.loadXML(strXML)) {
		var objRoot = domObj.documentElement;
		if ((objRoot.getAttribute("Error") == null) || (objRoot.getAttribute("Error") == "0")) {
			return objRoot.xml;
		}
		else {
			var objMessage = objRoot.selectSingleNode("//ErrorMessage");
			alertFade('<span style="color: maroon; font-weight: bold; font-size: 14px;">Problem Encountered:</span><br><br><span style="color: green; font-size: 12px;">' + objMessage.text + '</span>', 5);
		}
	}
	return "";
}

var customHeaders = new Object();

function addCustomHeader(strHeader, strValue) {
	customHeaders[strHeader] = strValue;
}

function removeCustomHeader(strHeader) {
	delete customHeaders[strHeader];
}

