﻿var tmt=new Object();

tmt.CreateXMLHttp=function() {

	if (typeof(XMLHttpRequest)!='undefined') {
		return new XMLHttpRequest();
	}
	else if (window.createRequest) {
		return window.createRequest();
	}
	else {
		/*@cc_on @if (@_jscript_version>=5)
		try {
			return new ActiveXObject('Msxml2.XMLHTTP');
		}
		catch (e) {
			try {
				return new ActiveXObject('Microsoft.XMLHTTP');
			}
			catch (e) {}
		}
		@end @*/
	}
	return null;
}


if (document.implementation && document.implementation.hasFeature('XPath','3.0')) {

	if (typeof(XMLDocument)=='undefined') XMLDocument=Document; //Opera

	if (!Element.prototype.xml) if (Element.prototype.__defineGetter__) Element.prototype.__defineGetter__('xml', function() {
		return (new XMLSerializer()).serializeToString(this);
	});

	if (!XMLDocument.prototype.selectNodes) XMLDocument.prototype.selectNodes=function(cXPathString, xNode) { 
		if (!xNode) xNode=this;
		var oNSResolver=this.createNSResolver(this.documentElement);
		var aItems=this.evaluate(cXPathString,xNode,oNSResolver,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null) 
		var aResult=[];
		for (var i=0; i<aItems.snapshotLength; i++) aResult[i]=aItems.snapshotItem(i);
		aResult.item=function(i) {return this[i];}
		return aResult;
	} 

	if (!Element.prototype.selectNodes) Element.prototype.selectNodes=function(cXPathString) { 
		return this.ownerDocument.selectNodes(cXPathString,this);
	} 

	if (!XMLDocument.prototype.selectSingleNode) XMLDocument.prototype.selectSingleNode=function(cXPathString, xNode) { 
		if (!xNode) xNode=this;
		var xItems=this.selectNodes(cXPathString,xNode);
		if (xItems.length>0) return xItems[0]; else return null;
	} 

	if (!Element.prototype.selectSingleNode) Element.prototype.selectSingleNode=function(cXPathString) {
		return this.ownerDocument.selectSingleNode(cXPathString,this);
	} 
}
