function createXHR(){
	var xmlHttp=false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
        xmlHttp = new XMLHttpRequest();
        if (xmlHttp.overrideMimeType) {
            xmlHttp.overrideMimeType('text/xml');
        }
	} else if (window.ActiveXObject) { // IE
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!xmlHttp) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
	return xmlHttp;
}

function getXml(url,func,loop){
	var xmlHttp=createXHR();
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4){
		if (xmlHttp.status == 200){
			var xmlDoc=xmlHttp.responseXML;
			window[func](xmlDoc);
			if(!loop){
				clearTimeout(t);
			}
		}else{
			alert('There was a problem with the request.');
		}
		}
	};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	var t=setTimeout("getXml('"+url+"','"+func+"',"+loop+")",timeout);
}

