var oHttp = null;
var hResponse = null;
var IDInterval = null;

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, qs){
	if(oHttp == null) oHttp = creaHttp();
	hResponse = hnd;
	oHttp.onreadystatechange = responseHttp;
	oHttp.open('get', qs);
	oHttp.send(null);
}	


function postHttp(hnd, action, vbody){
	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);
}

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

function startLoop(time, funct){
	if(IDInterval != null) clearInterval(IDInterval);
	eval(funct);
	if(!IDInterval) IDInterval = setInterval(funct, time);
}

function stopLoop(){
	if(IDInterval) clearInterval(IDInterval);
}