﻿
    
    //创建并返回HttpRequest对象
//	function createXMLHttpRequest() 
//	{
//	    var rxml;
//		if (window.ActiveXObject)
//		{
//			rxml = new ActiveXObject("Microsoft.XMLHTTP");
//		}
//		else if (window.XMLHttpRequest)
//		{
//			rxml = new XMLHttpRequest();
//		}
//	}
	
	function $(ObjId)
	{
	    return document.getElementById(ObjId);
	}
	
    function Ajax()
    {
        this.url = "";
        this.html = "";
        this.GlobalObj = "";        
        this.execute = execute;
        this.GetResponseText = GetResponseText;
        if (window.ActiveXObject)
		{
			this.xml = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else if (window.XMLHttpRequest)
		{
			this.xml = new XMLHttpRequest();
		}
    }
    
	
	function execute()
	{
	    
		this.xml.open("GET",this.url,false);
		this.xml.send(null);
		
		if(this.xml.readyState == 4)
		{
			if(this.xml.status == 200)
			{
				$(this.GlobalObj).innerHTML = this.xml.responseText;
			}
		}
		
	}
	
	function GetResponseText()
	{
	    this.xml.open("GET",this.url,false);
		this.xml.send(null);
		
		if(this.xml.readyState == 4)
		{
			if(this.xml.status == 200)
			{
			    this.html = this.xml.responseText;
			}
		}
	}
	
	var ajax = new Ajax();
	
	function GetHtml(url,objid)
	{
		ajax.url = url;
		ajax.GlobalObj = objid;
		ajax.execute();
	}
	
	function ReturnHtml(url)
	{
	    ajax.url = url;
	    ajax.GetResponseText();
	    
	    return ajax.html;
	}
