var oHttp = null;
var hResponse = null;
var gXml = false;

function creaHttp(){
	http = null;		
	try {
		http = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e) {
		try {http = new ActiveXObject("Microsoft.XMLHTTP");}
		catch(e2) { http = false;}
	}
	if(!http && typeof XMLHttpRequest != 'undefined') http = new XMLHttpRequest();
	return http;
}

function getHttp(hnd, url, xml){
	if(oHttp == null) oHttp = creaHttp();
	hResponse = hnd;
	oHttp.onreadystatechange = responseHttp;
	oHttp.open('get', url);
	oHttp.send(null);
	gXml = xml;
}	


function postHttp(hnd, action, vbody, xml){
	if(oHttp == null) oHttp = creaHttp();
	hResponse = hnd;
	oHttp.onreadystatechange = responseHttp;
	oHttp.open('post', action);
	oHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    oHttp.send(vbody);
	gXml = xml;
}

function responseHttp(){
	if(oHttp.readyState == 4){
		if(gXml) hResponse(oHttp.responseXML);
		else hResponse(oHttp.responseText);
	}
}

