
function ajaxquery($url, $callbackfunction, $data){
// Get a new XMLHttpRequest instance
try { req = xhr(); }
catch(e) {
	req = false;
}

// Do Ajax query
if(req) {
	if($callbackfunction != null) { req.onreadystatechange = $callbackfunction; }
	if($data != null) { method = "POST"; }
	else { method = "GET"; }
	req.open(method,$url,true);
	req.send($data);
}else{ return false; }

return true;
}


function xhr() {
// Instanciation de XMLHTTP selon navigateurs
var newxhr=false;
if (window.XMLHttpRequest)
        newxhr = new XMLHttpRequest();
    else if (window.ActiveXObject)  // if IE
    {
        var ieversions = ['Microsoft.XMLHTTP','Msxml2.XMLHTTP','Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0'];

        for(var i=0; !newxhr && i<ieversions.length; i++)
        {
		    try
		    {
		        newxhr = new ActiveXObject(ieversions[i]);
		    }
		    catch(e)  { }
        }
    }
return newxhr;
}
