function DomXml(sXml) {
	this.xml = null;
	this.xmlString = /\<\?xml|\<xml\>|\<xml\/\>|<xml \/\>/g.test(sXml);

	if (window.ActiveXObject) {
		this.xml       = new ActiveXObject("Microsoft.XMLDOM");
		this.xml.async = false;
		
		if (this.xmlString)
			this.xml.loadXML(sXml);
		else
			this.xml.load(sXml);

	} else if (document.implementation && document.implementation.createDocument) {
		if (this.xmlString) {
			this.xml       = new DOMParser();
			this.xml       = this.xml.parseFromString(sXml, "text/xml");
			this.xml.async = false;
		} else {
			this.xml       = document.implementation.createDocument("","",null);
			this.xml.async = false;
			this.xml.load(sXml);
		}
	} else {
		alert("Non!");
	}
	
	this.createXPath = function (objNode, sPath) {
		if (window.ActiveXObject) {
			return objNode.selectSingleNode(sPath);
		} else {
			var xPath = new XPathEvaluator();
			var Query = xPath.createNSResolver(objNode.ownerDocument == null ? objNode.documentElement : objNode.ownerDocument.documentElement)
			var Res   = xPath.evaluate(sPath, objNode, Query, XPathResult.FIRST_ORDERED_NODE_TYPE, null)
		
			return Res.singleNodeValue;
		}
	}

	this.selectSingleNodeAsString = function (strXPATH, objNodeIn){
		objNodeIn = (objNodeIn != null) ? objNodeIn : this.xml.documentElement;
	
		try {
			if (window.ActiveXObject) {
				return this.createXPath(objNodeIn, strXPATH).text;
			} else {
				return this.createXPath(objNodeIn, strXPATH).firstChild.nodeValue;
			}
		} catch(e) {
		    return "";
		}
	}
	
	this.selectSingleNode = function (strXPATH, objNodeIn){
		objNodeIn = (objNodeIn != null) ? objNodeIn : this.xml.documentElement;
	
		try {
			return this.createXPath(objNodeIn, strXPATH);
		} catch(e) {
		    return null;
		}
	}
	
	this.selectNodeAsNodes = function (strXPATH, objNodeIn){
		try {
			return this.selectSingleNode(objNodeIn, strXPATH).parentNode.getElementsByTagName( strXPATH.split("/")[ strXPATH.split("/").length ] );
		} catch(e) {
		    return null;
		}
	}

	this.getXML = function () { return this.xml; }
}

function printError(strMessage) {
	doPost('null', {'method': 'post', 'action': (COMMONS_PUBLIC + 'index.php'), 'actionName': 'Script.exibirErrors', 'errorMessage': escape(strMessage), 'currentURL': (CURRENT_PROJECT_PUBLIC + 'index.php?actionName=' + _REQUEST['actionName'])});
}