function HttpClient() { }
HttpClient.prototype = {
	requestType:'GET', // GET, POST, PUT, or PROPFIND
	returnType:'XML', // XML or Text
	isAsync:true, // true for asynchronous request, false for synchronous
	xmlhttp:false, //init to false, will hold the XMLHttpRequest object
	callback:false, // the method that will be called when the request
	
	// what is called when an http error happens
	onError:function(error) {
		alert(error);
	},

	// method to initialize an xmlhttpclient
	createHTTPRequestObject:function() {
		try { // Mozilla & Safari
			this.xmlhttp = new XMLHttpRequest();
		}
		catch (e) { // IE browsers
			var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP');
			var success = false;
			for (var i=0;i < XMLHTTP_IDS.length && !success; i++) {
				try {
					this.xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
					success = true;
				} catch (e) {}
			}
			if (!success) {
				//this.onError('Unable to create XMLHttpRequest.');
			}
		}
	},

	// method to make a page request
	// @param string url The page to make the request to
	// @param string payload What you're sending if this is a POST request
	makeRequest: function(url,payload) {

		if (!this.xmlhttp) {
			this.createHTTPRequestObject();
		}
		this.xmlhttp.open(this.requestType,url,this.isAsync);
		
		// set onreadystatechange here since it will be reset after a completed call in Mozilla
		var self = this;
		this.xmlhttp.onreadystatechange = function() {
			self._readyStateChangeCallback();
		}
		
		this.xmlhttp.send(payload);
		
		if (!this.isAsync) {
			return this.xmlhttp.responseText;
		}
	},

	// internal method used to handle ready state changes
	_readyStateChangeCallback:function() {
		switch(this.xmlhttp.readyState) {
			case 4:
				if (this.xmlhttp.status == 200) {
					if (this.returnType == 'XML')
					this.callback(this.xmlhttp.responseXML);
					else
					this.callback(this.xmlhttp.responseText);
					//this.callback(this.xmlhttp.responseText);
				} else {
				this.onError('HTTP Error Making Request: ' + '[' + this.xmlhttp.status + ']' + this.xmlhttp.statusText);
				}
			break;
		}
	}
}