function ajax() {
	this.req = null;
	this.url = null;
	this.method = 'GET';
	this.async = true;
	this.status = null;
	this.statusText = '';
	this.postData = null;
	this.readyState = null;
	this.responseText = null;
	this.responseXML = null;
	this.handleResp = null;
	this.responseFormat = 'text', // 'text', 'xml', or 'object'
	
	this.init = function() {  	
	  if (!this.req) {
		try {
	  	  // Firefox, Safari, IE7, etc.
		  this.req = new XMLHttpRequest();
		  } catch (e) {
		   try {
		    // IE Versi lama.
		    this.req = new ActiveXObject('MSXML2.XMLHTTP');
		   } catch (e) {
		   try {
			 // IE Versi terbaru.
			 this.req = new ActiveXObject('Microsoft.XMLHTTP');
		   } catch (e) {
			 // Gagal membuat object XMLHttpRequest.
			 return false;
		   }
		}
	  }
	}
	return this.req;
	};		
	
	this.doGet = function(url, hand, format) {	
		var self = this;
		self.url = url;
		self.handleResp = hand;
		self.responseFormat = format || 'text';
		self.doReq();
	};		
	
	
	this.doReq = function() {
		if (!this.init()) {
		  alert('Gagal membuat XMLHttpRequest object.');
		  return;
		}		
	
		this.req.open(this.method, this.url, this.async);
		
		var self = this;						
		this.req.onreadystatechange = function() {
			var resp = null;			
			if (self.req.readyState == 4) {				
			 switch (self.responseFormat) {
				case 'text':
					resp = self.req.responseText;
					break;
				case 'xml' :
					resp = this.req.responseXML;
					break;
				case 'object':
					resp = req;
					break;
			}
			self.handleResp(resp);
			}
		};
		
		this.req.send(this.postData);		
	};	
	
	this.handleErr = function() {
		  alert('ERROR, browser mengaktifkan pop-up blocker \n'
		  + 'Status Code: ' + this.req.status + '\n'
		  + 'Status Respon: ' + this.responseText + '\n'	  
		  + 'Status Description: ' + this.req.statusText);
	
	};	
	
	this.abort = function() {		
		if (this.req) {
	  	  this.req.onreadystatechange = function() { };
		  this.req.abort();
		  this.req = null;
		}
	};	
}