function WWW() {

	this.async = true; 
  	this.xmlhttp = false;  
	
  	try {
  		this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  	} catch (e) {
  		try {
  			this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  		} catch (E) {
  			this.xmlhttp = false;
  		}
  	}
  	
  	if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') {
		this.xmlhttp = new XMLHttpRequest();
	}
	
	this.get = _WWW_get;
	this.post = _WWW_post;
	this.postJson = _WWW_postJson;
}

function _WWW_get(url, callback) {

	this.xmlhttp.open("GET", url, this.async);
	var obj = this.xmlhttp;	
	var URL = url;
	
	this.xmlhttp.onreadystatechange = function() {
		
		if (obj.readyState==4 && obj.status==200) {
			//alert(URL + " > " + obj.responseText); 
			callback(obj.responseText);
		}
	}
	
	this.xmlhttp.send(null);
}


function _WWW_post(url, message, callback) {
	
	this.xmlhttp.open("POST", url, this.async);
	this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	
	var obj = this.xmlhttp;
	var URL = url;
	
	this.xmlhttp.onreadystatechange = function() {
		if (obj.readyState==4 && obj.status==200) {
			//alert(URL + " > " + obj.responseText);
			callback(obj.responseText);
		}
	}
	
	this.xmlhttp.send(message);
}

function _WWW_postJson(url, message, callback) {
	this.xmlhttp.open("POST", url, this.async);
	this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	
	var obj = this.xmlhttp;
	var URL = url;
	
	if (this.async) {
		this.xmlhttp.onreadystatechange = function() {
			if (obj.readyState==4 && obj.status==200) {
				var json = eval('(' + obj.responseText + ')');
				callback(json);
			}
		}
	}
	
	this.xmlhttp.send(message);
	if (!this.async) {
		var json = eval('(' + obj.responseText + ')');
		callback(json);
	}
}