function WWW(async, type) {
	this.xmlhttp = false;  
	
  	try {
  		if (type == "xml" || type == "xsl"){
			this.xmlhttp = new ActiveXObject("MSXML2.DOMDocument.6.0");
		}
		else{
			this.xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");	
		}
  	} catch (e) {
  		try {
  			if (type == "xml" || type == "xsl"){
				this.xmlhttp = new ActiveXObject("Microsoft.DOMDocument.6.0");
			}
			else{
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");	
			}
			
  		} catch (E) {
  			this.xmlhttp = false;
  		}
  	}
  	
  	if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') {
		this.xmlhttp = new XMLHttpRequest();
	}
	
	//this.xmlhttp.async = async;
	this.async = async;
	
	this.get = _WWW_get;
	this.post = _WWW_post;
	this.loadXMLXSL = _WWW_load;
}

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.readyState == "complete") {
			//alert(URL + " > " + obj.responseText); 
			callback(obj.responseText, obj.status);
		}
	}
	
	if (typeof(this.xmlhttp) == "object"){
		this.xmlhttp.send();
	}
}


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_load(url, callback){
	var obj = this.xmlhttp;
	this.xmlhttp.onreadystatechange = function changedState() {
		if (obj.readyState == 4 || obj.readyState == "complete") {						
			callback();	
		}
	}
	this.xmlhttp.async = this.async;
	this.xmlhttp.load(url);
}

