//Copyright RealGo, Inc. 2005. All Rights Reserved
function RGXMLHttp() {
}

//XmlHttpRequest factory method
RGXMLHttp.create = function () {
    var xmlhttp = null;
    if (window.XMLHttpRequest) { //Mozilla/Firefox/Safari
        xmlhttp = new XMLHttpRequest();
        //xmlhttp.overrideMimeType('text/xml');
    } else if (window.ActiveXObject) {  //IE
        try {
            xmlhttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
    }
    
    if (xmlhttp == null) {
        alert('Error creating XMLHTTP object');
    } else {
        /*
         * Redefine the send method because Mozilla/Firefox/Safari ALWAYS
         * expects an argument to their implementation of the method.
         */
        try {
            // In IE, send is not readable and throws an exception.
            xmlhttp._RGSend = xmlhttp.send;
            xmlhttp.send = RGXMLHttp.send;
        } catch (e) {
            // ignore exception and use the native send method.
        }
        return xmlhttp;
    }
}
/*
 * Instead of having to pass null when we intended to pass no arguments with
 * Mozilla/Firefox/Safari browsers the method below checks if no arguments
 * were passed and calls the native send method with null. This isolates the
 * work-around to this one file (not every occurance in our code)
 */
RGXMLHttp.send = function(a) {
    if (a === undefined) {
        this._RGSend(null);
    } else {
        this._RGSend(a);
    }
}
