function XmlRequestNotSupportedException(){};
function XmlRequestFailedException(){};

function XmlRequest(){
	
	if (window.XMLHttpRequest){
		this._xmlRequest = new XMLHttpRequest();
	}
	else if (window.ActiveXObject){
		this._xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
		if (!this._xmlRequest){
			this._xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	else{
		throw new XmlRequestNotSupportedException();
	}
	
	this.open = function(method,uri,async){
		try{
			this._xmlRequest.open(method,uri,async);
		}
		catch(e){
			throw new XmlRequestFailedException();
		}
	}
	
	this.send = function(value){
		try{
			this._xmlRequest.send(value);
		}
		catch(e){
			throw new XmlRequestFailedException();
		}
	}
	
	this.setRequestHeader = function(header,value){
		this._xmlRequest.setRequestHeader(header,value);
	}
	
	this.getResponseHeader = function(header){
		return this._xmlRequest.getResponseHeader();
	}
	
	this.addEventListener = function(event,listener){
		eval('this._xmlRequest.on'+event+' = listener;');
	}
	
	this.getResponseText = function(){
		return this._xmlRequest.responseText;
	}
	
	this.getReadyState = function(){
		return this._xmlRequest.readyState;
	}
	
	this.getStatus = function(){
		return this._xmlRequest.status;
	}
}