function CHttpRequest(){
	
	this.HostAddress = "index.php?XmlRequest=1&";
	this.AsyncCall = true;
	this.arProperties = new Array();
	this.QueryString = "";
	this.OnResponse = null;
	this.Debug = false;
	this.onReturn = "";
	this.Additional = "";
	this.State = null;
	this._currentRequest = null;
	//this._currentRequest = null;
	
	this.AddProperty = function(PropertyName, PropertyValue){
		var arProperty = new Array();
		arProperty["PropertyName"] = PropertyName;
		arProperty["PropertyValue"] = PropertyValue;
		this.arProperties.push(arProperty);
	}
	
	this.Abort = function(){
		if(this._currentRequest != null)
			this._currentRequest.abort();
	}
	
	this.Send = function(){
	    
	    //////// Action/RecordID
	    if(typeof(window.arCurrentSiteNavigation) != "undefined"){
			for(var Key in window.arCurrentSiteNavigation){
				this.AddProperty( "Arguments[" + Key + "]", window.arCurrentSiteNavigation[ Key ] );
			}
		}
	    ////////
	    
//		try {
//			currentRequest = new ActiveXObject("Msxml2.XMLHTTP");
//		} catch (e) {
//			try {
//				currentRequest = new ActiveXObject("Microsoft.XMLHTTP");
//			} catch (e) {
//				return;
//			}
//		}
        if (window.XMLHttpRequest) { // Mozilla, Safari, IE7, ...
            this._currentRequest = new XMLHttpRequest();
        } else if (window.ActiveXObject) { // IE
            this._currentRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }

		this._currentRequest.open('POST', this.HostAddress, this.AsyncCall);
		this._currentRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
		
		if(this.AsyncCall){
			this._currentRequest.onreadystatechange = Controls.Delegates.CreateDelegate(this, this.onReturnUser);
		}
		
		for(var i = 0; i < this.arProperties.length; i++){
			var arProperty = this.arProperties[i];
			this.QueryString += "&"+ arProperty["PropertyName"] +"="+ encodeURIComponent(arProperty["PropertyValue"]);
		}
		if(this.Debug){
			window.Debug.DumpWindow(this.HostAddress +"&"+ this.QueryString);
		}
		
		this._currentRequest.send(this.QueryString);
		
		return this._currentRequest;
	}
	
	this.onReturnUser = function(){
		if (this._currentRequest.readyState == 4) {
			if (this._currentRequest.status == 200) {
				if(this.onReturn != null && this.onReturn != ""){
					var sString = this.onReturn + "(this._currentRequest, this.Additional);";
					eval(sString);
				}else if(this.OnResponse != null){
					this.OnResponse(this._currentRequest, (this.State == null) ?  this.Additional : this.State);
				}
			} else {
				//alert('Ajax crash!.');
			}
		}
	}
}
