//页面异步传输
var Ajax = function ( url,oShow,nType )
{
	this.req = null;
	this.ShowObj = oShow;
	this.ResponseType = nType;
	try
	{
		this.req = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(ex)
	{
		try
		{
			this.req = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (ex)
		{
			this.req = null;
		}
	}
	if( !this.req && typeof XMLHttpRequest != "undefined" )
	{
		this.req = new XMLHttpRequest();
	}
	if(!this.req)
	{
		alert('创建Ajax对象失败');
		return;
	}
	var oThis = this;
	
	if( this.ShowObj != null &&  this.ShowObj != "" )
	{
		this.ShowObj.innerHTML = "<img src=images/loading.gif />";
	}
	this.req.onreadystatechange = function()
	{
		oThis.processChech();
	}
	this.req.open( "get", url, true );
	this.req.setRequestHeader("If-Modified-Since","0");
	this.req.send();
	
}

Ajax.prototype.processChech = function()
{
	if ( this.req.readyState == 4)
	{
		if ( this.req.status == 200)
		{
			var sVar = unescape( escape( this.req.responseText ) );
			if( this.ResponseType == 1 )
			{
				if( this.ShowObj != null &&  this.ShowObj != "" )
				{
					this.ShowObj.innerHTML = sVar;
				}
			}
			else
				eval( sVar );
		}
		else
		{
			if( this.ShowObj != null &&  this.ShowObj != "" )
			{
				this.ShowObj.innerHTML = '<span style=\"color: red\">error</span>';
			}
		}
	}
}


