String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
Request_Async = true;
function Request(){
	this.Waiting = false;
	this.Content = "";
	this.xmlhttp = null;

	function bind(toObject, methodName){
		return function(){toObject[methodName]()}
	}

	this.getUrl = function(url, Async){
		
		this.Waiting = true;
		this.xmlhttp=null;
		if (window.XMLHttpRequest)// code for Firefox, Opera, IE7, etc.
			this.xmlhttp = new XMLHttpRequest();
		else if (window.ActiveXObject)// code for IE6, IE5
			this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

		if (this.xmlhttp!=null){
			this.xmlhttp.onreadystatechange=bind(this, "_onStateChange");

			this.xmlhttp.open("GET",url,Request_Async);
			this.xmlhttp.send(null);
			if (this.xmlhttp.readyState==4)
				this.onStateChange();
		}else{
			alert("Your browser does not support XMLHTTP.");
		}
	}

	this._onStateChange = function(){
		if (this.xmlhttp.readyState==4){// 4 = "loaded"
			this.Waiting = false;
			if (this.xmlhttp.status==200){// 200 = "OK"
				
				this.Content = this.xmlhttp.responseText;
				this.onStateChange(this);
			}else
				alert("Problem retrieving data:" + this.xmlhttp.statusText);
		}
	}
	this.onStateChange = function(){}
}
