var G_bpAjax;
if (!G_bpAjax) {
  G_bpAjax = new Array();
}
G_bpAjax.createXMLHttpRequest = function() {
   return window.XMLHttpRequest ? 
      new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
}

G_bpAjax.httpGetAsync = function(uri, getfunc) {
  var request = G_bpAjax.createXMLHttpRequest();
  request.onreadystatechange = function() {
    if (request.readyState == 4) {
      var stateId = 0;
	  if (request.status == 200) {
        getfunc(request);
	  }
	}
  };
  request.open("GET", uri, true);
  request.setRequestHeader("If-Modified-Since", "Thu, 01 Dec 1994 16:00:00 GMT");
  request.send(null);
}

G_bpAjax.ajaxGetText = function(request) {
    var text = request.responseText;
    if ( G_bpAjax.browser == 'khtml' ) {
      var esc = escape( text );
      if ( esc.indexOf("%u") < 0 && esc.indexOf("%") > -1 ) {
        text = decodeURIComponent( esc );
      }
    }
    return text;
}

G_bpAjax.httpGetAsyncText = function(uri, getfunc) {
  G_bpAjax.httpGetAsync(uri, function(request) {
    getfunc(G_bpAjax.ajaxGetText(request));
  });
}

G_bpAjax.httpGetAsyncXML = function(uri, getfunc) {
  G_bpAjax.httpGetAsync(uri, function(request) {
    getfunc(request.responseXML);
  });
}

G_bpAjax.httpGetAsyncBoth = function(uri, getfunc) {
  G_bpAjax.httpGetAsync(uri, function(request) {
    getfunc(G_bpAjax.ajaxGetText(request), request.responseXML);
  });
}

