// jx Library - http://binnyva.blogspot.com/2006/02/jx-ajax-library-in-object-notation.html (Version 1.01.A)
var jx = {
 http : false,
 getHTTPObject : function() {
  var xmlhttp = false;
  if(typeof ActiveXObject != 'undefined') {
   try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
   catch (e) {
    try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
    catch (E) {xmlhttp = false;}
   }
  } else if (XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
 },
 getData : function(url,callback,type) {
  if(!this.http) {
   this.init();
   if(!this.http) return;
  }
  if(!type) var type = "text";
  this.http.open("GET", url, true);
  this.http.onreadystatechange = function () {
   if (jx.http.readyState == 4) {
    var result = "";
    if(jx.http.responseText) result = jx.http.responseText;
    type = type.toLowerCase();
    if(type == "json" || type == "j") result = eval(result);
    if(callback) callback(result);
   }
  }
  this.http.send(null);
 },

 init : function() {
  this.http = this.getHTTPObject();
 }
}


//////////////// Init ///////////
//Call it like this.
//function init() {
// jx.getData("beer.htm",function (data) {
//  alert(data);
// },'t');
//}
//window.onload=init;
