function getXMLHTTP() { 
	var A=null;
	try { 
		A=new ActiveXObject("Msxml2.XMLHTTP");	// MSXML 3.0
	} catch(e) { 
		try { 
			A=new ActiveXObject("Microsoft.XMLHTTP");	// MSXML 2.x
		} catch(oc) { 
			A=null;
		} 
	} 
	if ( !A && typeof XMLHttpRequest != "undefined" ) 
	{ 
		A=new XMLHttpRequest();
	} 
	return A;
} 

function getDOMDocument() { 
	try {
		var A = new ActiveXObject("Msxml2.DOMDocument.4.0");
	} catch (e) {
		try { 
			A=new ActiveXObject("MSXML2.DOMDocument");	// MSXML 3.0
		} catch(e) { 
			try { 
				A=new ActiveXObject("MSXML.DOMDocument");	// MSXML 2.x
			} catch(oc) { 
				A=null;
			} 
		}
	}
	return A;
}

function svrcmd( asp, dat ) {
	var xmlhttp = getXMLHTTP();
	xmlhttp.open("POST", "/Scripts/" + asp, false);
	if ( typeof( dat ) == "string" || dat == null ) {
		if ( dat == null || dat == "" ) {
			var xml_dom = getDOMDocument();
			xml_dom.loadXML('<?xml version="1.0" ?> <root/>');
			xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
			var node = xml_dom.createElement("text");
			node.nodeTypedValue = "";
			xml_dom.documentElement.appendChild(node);
			xmlhttp.send( xml_dom );
		} else {
			var xml_dom = getDOMDocument();
			xml_dom.loadXML('<?xml version="1.0" ?> <root/>');
			xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
			var node = xml_dom.createElement("text");
			node.nodeTypedValue = dat;
			xml_dom.documentElement.appendChild(node);
			xmlhttp.send( xml_dom );
		}
	} else {
		xmlhttp.send( dat );
	}
	if ( xmlhttp.status == 200 )
		return xmlhttp.ResponseText;

	alert( "Invoke [" + asp + "] Error: " + xmlhttp.statusText );
	return "";
}

function AddNode( xml_dom, node_name, dat ) {
	var node = xml_dom.createElement(node_name);
	node.nodeTypedValue = dat;
	xml_dom.documentElement.appendChild(node);
}
