function Glimpse()
{
	this.xmlHttp = new gwXmlHttpRequest();
}
var glimpse = new Glimpse();

function gwXmlHttpRequest()
{
	this.asynchronous = true;
	this.xhr = null;
	this.onReadyStateChangeHandler = '';
	this.onErrorHandler = '';

	try {
		xhr = new XMLHttpRequest();
	} catch (e) {
		try {
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
		}
	}

	this.setHandler = function(handler)
	{
		if (!handler) return false;
		if (!handler.length) return false;
		this.onReadyStateChangeHandler = handler;
		xhr.onreadystatechange = function ()
		{
			if (xhr.readyState == 4)
				if (xhr.status == 200)
					eval(glimpse.xmlHttp.onReadyStateChangeHandler+'()');
				else
					if (glimpse.xmlHttp.onErrorHandler.length)
						eval(glimpse.xmlHttp.onErrorHandler+'("' + document.gwXmlHttpRequestObject.xhr.statusText + '")');
					else
						alert("An error occured while procesing the request: " + xhr.statusText);
		}
		
		return true;
	}

//  this.setRequestHeader = function(header, charset)
//  {
//  	return xhr.setRequestHeader(header, charset);
//	}
  
	this.isXMLResponse = function()
	{
		if (xhr.responseXML)
			return true;
		return false;
	}

	this.getXMLResponse = function()
	{
		try {
			return xhr.responseXML.documentElement;
		} catch (e) {
			return null;
		}
	}
	
	this.getResponse = function()
	{
		if (!xhr.responseText)
			return '';
		return xhr.responseText;
	}
	
	this.getStatus = function()
	{
		return xhr.status;
	}

	this.get = function(url, queryString)
	{
		xhr.open("GET", url, this.asynchronous);
		xhr.send(queryString);
	}
	
	this.post = function(url, data)
	{
		xhr.open("POST", url, this.asynchronous);
		xhr.send(queryString);
	}
	
}

