function GetHTTPObject() 
{
	var  XMLHttp = false;
	
	// If browser is not Internet Explorer
	if (window.XMLHttpRequest) 
	{
		 XMLHttp = new XMLHttpRequest();
	} 
	else if (window.ie) 
	{
		 XMLHttp = new ActiveXObject('Microsoft.XMLHTTP');
	}
	//	If browser is Internet Explorer
	else if (window.ActiveXObject) 
	{
		try 
		{
			 XMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch(e) 
		{
			try 
			{
				 XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(e) 
			{
				 XMLHttp = false;
			}
		}
	}
	return XMLHttp;
}

function Asynchronous( ) {
	
	this._xmlhttp = new GetHTTPObject();

}

// Function to send simple call to server
function Asynchronous_call(url) {
	
	var instance = this;
	
	this._xmlhttp.open('GET', url, true);
	
	this._xmlhttp.onreadystatechange = function() {
		
		switch(instance._xmlhttp.readyState) {
			case 1:
				instance.Loading();
				break;
			case 2:
				instance.Loaded();
				break;
			case 3:
				instance.Interactive();
				break;
			case 4:
				instance.Complete(
								  instance._xmlhttp.statusText,
								  instance._xmlhttp.responseText,
								  instance._xmlhttp.responseXML
								  );
				break;
		}
	}
	
	this._xmlhttp.send(null);
}

// Function to send POST data to server
function Asynchronous_post_call(url,data)
{
	var instance = this;
	
	this._xmlhttp.open('POST', url, true);
	
	this._xmlhttp.onreadystatechange = function() {
		
		switch(instance._xmlhttp.readyState) {
			case 1:
				instance.Loading();
				break;
			case 2:
				instance.Loaded();
				break;
			case 3:
				instance.Interactive();
				break;
			case 4:
				instance.Complete(
								  instance._xmlhttp.statusText,
								  instance._xmlhttp.responseText,
								  instance._xmlhttp.responseXML
								);
				break;
		}
	}
	
	this._xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	
	this._xmlhttp.send(data);	
}


function Asynchronous_loading() {

}

function Asynchronous_loaded() {

}

function Asynchronous_interactive() {

}

function Asynchronous_complete(statusText, responseText, responseXML){

}
Asynchronous.prototype.Loading = Asynchronous_loading;
Asynchronous.prototype.Loaded = Asynchronous_loaded;
Asynchronous.prototype.Interactive = Asynchronous_interactive;
Asynchronous.prototype.Complete = Asynchronous_complete;
Asynchronous.prototype.Call = Asynchronous_call;
Asynchronous.prototype.PostCall = Asynchronous_post_call;
