function ajax( ax_evt, timeout ) {
	this.http = null;
	
	if (XMLHttpRequest) { // Mozilla, Safari,...
		this.http = new XMLHttpRequest();
	}
	else if (ActiveXObject) { // IE
		try {
			this.http = new ActiveXObject( 'Msxml2.XMLHTTP' );
		}
		catch (e1) {
			try {
				this.http = new ActiveXObject( 'Microsoft.XMLHTTP' );
			}
			catch (e2) {
			}
		}
	}
	
	if (this.http !== null) {
		this.timeout = timeout || 1500;
		var self = this;
		var fnc = function() {
			self.abort();
			if (self.ax_evt !== null) {
				self.ax_evt.call( self, self, 'timeout' );
			}
		};

		this.time_id = setTimeout( fnc, this.timeout );
		this.ax_evt = ax_evt;
	}
}

ajax.prototype.get = function( uri, params, is_async ) {
	//'&rnd='+Math.random()
	this.http.open( 'get', uri+'?'+params, is_async );

	var self = this;
	this.http.onreadystatechange = function() {
		self.received.call( self );
	};

	this.http.send( null );
};

ajax.prototype.post = function( uri, params, is_async ) {
	this.http.open( 'post', uri, is_async );

	this.http.setRequestHeader( 'Content-type', 'application/x-www-form-urlencoded');

	var self = this;
	this.http.onreadystatechange = function() {
		self.received.call( self );
	};

	this.http.send( params );
};

ajax.prototype.abort = function() {
	this.http.abort();
};

ajax.prototype.received = function() {
	if (this.ax_evt !== null) {
		
		if (this.http.readyState == 4) {
			clearTimeout( this.time_id );
			
			if (this.http.status == 200) {
				this.ax_evt( this, this.http.responseText );
			}
			else {
				this.ax_evt( this, 'error' );
			}
		}
	}
};
