function netRequest(url,method,onloads)
{
	this.READY_STATE_UNINITIALIZED=0;
    this.READY_STATE_LOADING=1;
    this.READY_STATE_LOADED=2;
    this.READ_STATE_INTERACTIVE=3;
    this.READY_STATE_COMPLETE=4;
	this.method=method;
	this.xmlhttp=null;
	isyibu=true;
	if(onloads==null)
		isyibu =false;
	
	if(window.ActiveXObject )
	{
		try
		{
			this.xmlhttp =new ActiveXObject("Msxml2.XMLHTTP") ;
		}
		catch(er)
		{
			this.xmlhttp =new ActiveXObject("Microsoft.XMLHTTP") 
		}
	}
	else if(window.XMLHttpRequest)
	{
		this.xmlhttp=new XMLHttpRequest();
		
	}

	if(this.xmlhttp!=null&&onloads!=null)//异步调用
	{
		var loading =this;
		this.xmlhttp.onreadystatechange=function(){loader(loading);}
	}
	function loader(req)
	{
		if(req.xmlhttp.readyState==4)//正常状态
		{
			
			onloads.call();
		}
	}
	

	//POST方式与服务器进行交互获取XML数据
    this.PostOrder=function()
    {    	
    	
    	this.xmlhttp.open(method, url, isyibu); 
	
    	this.xmlhttp.setRequestHeader("context-type","text/xml;charset=UTF-8");
			if   (window.XMLHttpRequest) 
				this.xmlhttp.send(null);
			else   if   (window.ActiveXObject) 
				this.xmlhttp.send();
		if(onloads==null)
    	{
    		return this.xmlhttp.responseText;
		}
	}
	this.PostXml= function(xml)
	{
		    	
    	this.xmlhttp.open(method, url, isyibu); 

    	this.xmlhttp.setRequestHeader("context-type","text/xml;charset=UTF-8");
		this.xmlhttp.send(xml);
		
		if(onloads==null)
    	{
    		return this.xmlhttp.responseText;
		}
		 
	}
}
function xmlobj()
{
	this.xml=null;
    if(window.ActiveXObject)
    {
	    this.xml=new ActiveXObject("MSXML.DOMDocument");
	    this.xml.async=false;
	    var u=this.xml.createElement("xml");
	    this.xml.appendChild(u);
	}
	else
	{
	   
	    this.xml = document.implementation.createDocument("", "xml", null);//创建FIREFOX下XML文档对象
	    var u=this.xml.createElement("xml");
	    this.xml.importNode(u,true);
	}
	this.loadxml=function(xmlString)
	{
		if(window.ActiveXObject)
    	{
      	  this.xml.loadXML(xmlString);
    	}
    	else
    	{		
      	  var childNodes = this.xml.childNodes;
     	   for (var i = childNodes.length - 1; i >= 0; i--)
      	      this.xml.removeChild(childNodes[i]);
	  	  var dp = new DOMParser();
    		var newDOM = dp.parseFromString(xmlString, "text/xml");
    		var newElt = this.xml.importNode(newDOM.documentElement, true);
    		this.xml.appendChild(newElt);
    	
    	}
	}
	this.AppendChild =function (name,value)
	{
	
  	 	if(window.ActiveXObject)
    	{
	    	var u=this.xml.createElement(name);
		    u.text=value;
		    this.xml.childNodes[0].appendChild(u);
		}
		else
		{
		    var dp = new DOMParser();
	    	var newDOM = dp.parseFromString("<"+name+">"+value+"</"+name+">", "text/xml");
	    	
	    	var newElt = this.xml.importNode(newDOM.documentElement, true);
		    this.xml.childNodes[0].appendChild(newElt);
		}
	}
	this.GetNodes=function(nodename)
	{
		var ary =this.xml.getElementsByTagName(nodename);
		return ary;
	}
	this.GetSingleNode=function(nodename)
	{
		var ary =this.xml.getElementsByTagName(nodename);
		if(ary.length>0)
		{
			if(window.ActiveXObject)
	    	{
				return ary[0].text;
			}
			else
			{
				if(ary[0].childNodes[0]!=null)
					return ary[0].childNodes[0].nodeValue;
				else
					return null;
			}
		}
		return null;
	}
}