function createXHR() {
    var result = null;
    try {
        result = new XMLHttpRequest();
    }
    catch (Error) {
        try {
            result = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (Error) {
            try {
                result = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (Error) {
                result = null;
            }
        }    
    }
    return result;
}