function doRequest(url, elementid, loading_screen, method){
    /*
    if (savehtml == true){
        document.getElementById(elementid).innerHTML = '';
    }
    */

    /*
    readyState Status Codes:
    	0 = uninitialized
    	1 = loading
    	2 = loaded
    	3 = interactive
    	4 = complete
    */

    if (!method){
        method = 'GET';
    }

    var elem = document.getElementById(elementid);

    if (window.XMLHttpRequest){ //non IE
        req = createXMLHttpRequest();

        req.onreadystatechange = function(){
            if (req.readyState == 4){
                    if (req.status == 200){
                        if(loading_screen){
                            //elem.parentNode.style.background = "";
                        }
                        elem.innerHTML = req.responseText;

                        //google analytics needs to be included above this JS file so this is a hack to keep it in the footer
                        window.onload = function(){pageTracker._trackPageview(url);}

                    }else {
                            alert("There was a problem retrieving the XML data:\n" + req.statusText);
                    }
            }else{
                    if(loading_screen){
                        //elem.parentNode.style.background = "#000 url(/images/icons/indicator-medium.gif) 50% 50% no-repeat";
				        //elem.parentNode.style.position = "relative";
				        //elem.style.visibility = "hidden"; // used for testing
                    }
            }
        }
        req.open(method, url, true);
        req.send("");
    }else if (window.ActiveXObject){ //IE
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req){
            req.onreadystatechange = function(){
                if (req.readyState == 4){ // complete
                        if (req.status == 200){ // OK response
                            elem.innerHTML = req.responseText;

                            //google analytics needs to be included above this JS file so this is a hack to keep it in the footer
                            window.onload = function(){pageTracker._trackPageview(url);}

                        }else {
                            alert("There was a problem retrieving the XML data:\n" + req.statusText);
                        }
                }else{
                    if(loading_screen){
                        //elem.parentNode.style.background = "url(/images/icons/indicator-medium.gif) 50% 50% no-repeat";
				        //elem.parentNode.style.position = "relative";
				        //elem.style.visibility = "hidden"; // used for testing
                    }
                }
            }
            req.open(method, url, true);
            req.send("");
        }
    }


    function createXMLHttpRequest(){
        if(typeof XMLHttpRequest != "undefined" ){
            return new XMLHttpRequest();
        }else if(typeof ActiveXObject != "undefined"){
            try{
            	return new ActiveXObject("Msxml2.XMLHTTP");
          	}catch(e){
            	try{
              		return new ActiveXObject("Microsoft.XMLHTTP");
              	}catch(e){
                    throw {"message" : "XMLHttpRequest not supported", "code" : 0};
              	}
            }
        }else{
            throw {"message" : "XMLHttpRequest not supported", "code" : 0};
        }
    }

}