// JavaScript Document



var isIE= window.ActiveXObject?true:false;

if(!isIE)
{
	 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); 
      } 
      return aResult; 
   } 

   // prototying the Element 
   Element.prototype.selectNodes = function(cXPathString) 
   { 
      if(this.ownerDocument.selectNodes) 
      { 
         return this.ownerDocument.selectNodes(cXPathString, this); 
      } 
      else{throw "For XML Elements Only";} 
   } 

	
	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; 
      } 
   } 
    
   // prototying the Element 
   Element.prototype.selectSingleNode = function(cXPathString) 
   {     
      if(this.ownerDocument.selectSingleNode) 
      { 
         return this.ownerDocument.selectSingleNode(cXPathString, this); 
      } 
      else{throw "For XML Elements Only";} 
   } 

}





function createXmlHttp() 
{
	try
	{
		return window.ActiveXObject ? new ActiveXObject("MSXML2.XMLHTTP.3.0") : new XMLHttpRequest();
	}
	catch(e)
	{
		alert("您当前的浏览器不支持该购买程序，请用IE5.0以上版本");
		return null;
	}
}


var parser = null;
function getParser()
{
	if(parser==null) parser = new DOMParser();
	return parser;
}

var oSerializer = null;
function getOSerializer()
{
	if(oSerializer== null) oSerializer = new XMLSerializer();
	return oSerializer;
}

function getNodeText(obj)
{
    if(!obj)
    {
        return "";
    }
    if(obj.textContent)
    {
        return obj.textContent;
    }
    
    if(obj.firstChild)
    {
        obj=obj.firstChild;    
    }
    if(obj.nodeValue)
    {
        return obj.nodeValue;
    }
    if(obj.data)
    {
        return obj.data;
    }
    return "";
    
}
function getNodeAttribute(node,name)
{
    if(!node || !name)
    {
        return false;
    }
    return getAttribute(name,node.attributes);
}
