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");	
			var axO=['Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'];
			for(i=0;i<axO.length;i++)
				try{
					this.xmlhttp = new ActiveXObject(axO[i]);
				}catch(e){}
			
		}
  	} 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.async = this.async;
	
	var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; 
	var is_ie = navigator.userAgent.toLowerCase().indexOf('msie') > -1;
	var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
	var is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1;
	var is_safari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
	
	
	if (is_chrome){
		this.xmlhttp.open("GET", url, false);
		this.xmlhttp.send();
		this.xmlhttp.onreadystatechange = function() {
			if (obj.readyState==4 || obj.readyState == "complete") {
				//alert(URL + " > " + obj.responseText); 
				callback(obj);
			}
		}
	}
	//firefox
	else if (is_firefox || is_opera){
		this.xmlhttp = null;
		this.xmlhttp = document.implementation.createDocument("", "", null);
		this.xmlhttp.async="false";
		this.xmlhttp.load(url);
		var obj = this.xmlhttp;
		this.xmlhttp.onload = function(){
			callback(obj);
		}

	}
	//ie
	else if (is_ie){
		this.xmlhttp.onreadystatechange = function() {
			if (obj.readyState == 4 || obj.readyState == "complete") {						
				callback(obj);	
			}
		}
		this.xmlhttp.load(url);
	}
	else if (is_safari){
		this.xmlhttp.open("GET", url, false);
		this.xmlhttp.send();
		/*this.xmlhttp.onreadystatechange = function() {
			alert(obj.readyState)
			if (obj.readyState==4 || obj.readyState == "complete") {
				//alert(URL + " > " + obj.responseText); 
				callback(obj);
			}
		}*/
		callback(this.xmlhttp);
	}
	
	

}