
function AJAX()
{
	this.XMLObj = function()
	{	
		var xmlHttpReq = false;
		var self = this;

		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		return self;

	}

	this.request_div = function(strURL, div_id)
	{		
		var div_obj = document.getElementById(div_id);
		if(typeof div_obj != "undefined" && div_obj != null)
		{		
			var self = this.XMLObj();	
			self.xmlHttpReq.open('POST', strURL, true);
			self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

			self.xmlHttpReq.onreadystatechange = function() 
			{
				if (self.xmlHttpReq.readyState == 4) 
				{		
				    div_obj.innerHTML =  self.xmlHttpReq.responseText;			
				}
			}
			self.xmlHttpReq.send(null);
		}
		else
		{
			alert("no div present");
		}
		
	}
	/** callback_obj must have get_response function defined **/
	this.request = function(strURL, callback_obj)
	{				
		var self = this.XMLObj();	
		self.xmlHttpReq.open('POST', strURL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq.onreadystatechange = function() 
		{
			if (self.xmlHttpReq.readyState == 4) 
			{
			    callback_obj.get_response(self.xmlHttpReq.responseText);
			}
		}
		self.xmlHttpReq.send(null);
		
	}
}
