
if( document.implementation.hasFeature("XPath", "3.0") ){
	if( typeof XMLDocument == "undefined" ){ XMLDocument = Document; }
  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 = [];
		//alert(aItems.snapshotLength);
		for( var i = 0; i < aItems.snapshotLength; i++)
			{
				aResult[i] =  aItems.snapshotItem(i);	
			}
		return aResult;
	}
	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;	}
	}
	Element.prototype.selectNodes = function(cXPathString){
		if(this.ownerDocument.selectNodes){	return this.ownerDocument.selectNodes(cXPathString, this);}
		else{throw "For XML Elements Only";}
	}
	Element.prototype.selectSingleNode = function(cXPathString){	
		if(this.ownerDocument.selectSingleNode){return this.ownerDocument.selectSingleNode(cXPathString, this);	}
		else{throw "For XML Elements Only";}
	}
}


//add the loadXML() method to the Document class
Document.prototype.loadXML = function(strXML) {
        
    //create a DOMParser
    var objDOMParser = new DOMParser();
        
    //create new document from string
    var objDoc = objDOMParser.parseFromString(strXML, "text/xml");

	//make sure to remove all nodes from the document
	while (this.hasChildNodes())
		this.removeChild(this.lastChild);

	//add the nodes from the new document
	for (var i=0; i < objDoc.childNodes.length; i++) {
            
	//import the node
	var objImportedNode = this.importNode(objDoc.childNodes[i], true);
            
	//append the child to the current document
	this.appendChild(objImportedNode);
        
	} //End: for
 
} //End: function


function getHttpRequestObject(){

	var xmlhttp=false;

	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
	xmlhttp = false;
	}
	}
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
    
    //if (!xmlhttp && typeof XMLHttpRequest!="undefined") {
    //    xmlhttp = new XMLHttpRequest();
    //}
    
return xmlhttp;
}

function loadXMLDoc(dname) 
{
	var xmlDoc;
	// code for IE
	if (window.ActiveXObject)
	{
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	    xmlDoc.async=false;
        xmlDoc.preserveWhiteSpace=true;
	    xmlDoc.loadXML(dname);
	}
	// code for Mozilla, Firefox, Opera, etc.
	else if (document.implementation && document.implementation.createDocument)
	{
		xmlDoc=document.implementation.createDocument("","",null);
	    xmlDoc.async=false;
        xmlDoc.preserveWhiteSpace=true;
	    xmlDoc.onload=function (){};
	    xmlDoc.loadXML(dname);
		//var domParser = new DOMParser();
		//xmlDoc = domParser.parseFromString(dname, 'text/xml');
	}
	else
	{
		alert('Your browser cannot handle this script');
		return null;
	}
	return(xmlDoc);
}


//Disable a control by the Id
function disable(Id)
{
	        document.getElementById(Id).disabled=true
	    // code for IE
	    if (window.ActiveXObject)
	    {
	    }
	    // code for Mozilla, Firefox, Opera, etc.
	    else if (document.implementation && document.implementation.createDocument)
	    {
	        //document.getElementById[Id].disabled=true
	    }
	    else
	    {
		    //alert('Your browser cannot handle this script');
		    //return null;
	    }

}
//Enable a control by the Id
function enable(Id)
{
	        document.getElementById(Id).disabled=false
	    // code for IE
	    if (window.ActiveXObject)
	    {
	    }
	    // code for Mozilla, Firefox, Opera, etc.
	    else if (document.implementation && document.implementation.createDocument)
	    {
	    //    document.getElementById[Id].disabled=false
	    }
	    else
	    {
		  //  alert('Your browser cannot handle this script');
		  //  return null;
	    }

}

function NewGlossario(idGlossario)
{	
	var objHTTP = getHttpRequestObject();
	var szURL = "div.aspx?idGlossario=" + idGlossario;
	var szHttpMethod = "POST";
		
	objHTTP.open(szHttpMethod, szURL, false);
	objHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	objHTTP.send(null);
	
	var szReply = objHTTP.responseText;
	
	if (objHTTP.readyState==4)
	{
		return szReply;
	}
	else
	{
		//failure
		szReply = "";
		return szReply;
	}
}

  