function HTTPRequest(_url,_method,_data,_responseType){
	// Begin HTTPRequest Construction
	var req = null;
	this.url =_url;
	this.method =_method;
	this.data =_data;
	this.responseType =_responseType;

	var self = this;

	this.exec = exec;
	this.onComplete = onComplete;
	this.onBegin = onBegin;
	this.onEnd = onEnd;

	if(this.method == "GET") {
		this.url += "?" + this.data;
		this.data = null;
	}

	if (window.XMLHttpRequest) {
		this.req = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		this.req = new ActiveXObject("Msxml2.XMLHTTP");
		if (!this.req) {
			this.req = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	if (this.req) {
		this.req.onreadystatechange =  handleRequest;
	}
	else {
		alert("HTTPRequest is not supported!");
		return false;
	}
	// End HTTPRequest Construction
	
	function exec(){
		this.onBegin();
		this.req.open(this.method, this.url, true);
		if(this.method == "POST") {
			this.req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		}
		this.req.setRequestHeader("Pragma","no-cache");
		this.req.setRequestHeader("Cache-Control","no-cache");
		this.req.send(this.data);
	}

	function handleRequest(){
		if (self.req.readyState == 4) {
			if (self.req.status == 200) {
				self.onEnd();
				if(self.responseType == 'text') {
					self.onComplete(self.req.responseText);
				}
				else {
					self.onComplete(self.req.responseXML);
				}
			} else {
				alert("Server response is not valid!");
				return false;
			}
		}
	}

	function onComplete(responseText){
		alert("You must override 'onComplete(responseText)' method!");
	}

	function onBegin(){
	}
	
	function onEnd(){
	}
}
