function MQBrowser(){
    this.name = null;
    this.version = null;
    this.os = null;
    this.appname = null;
    this.appVersion = null;
    this.vMajor = null;
    this.isNS = null;
    this.isNS4 = null;
    this.isNS6 = null;
    this.isIE = null;
    this.isIE4 = null;
    this.isIE5 = null;
    this.isDOM = null;
    this.isSafari = null;
    this.platform = null;
}

function mqGetBrowserInfo(){
    var _1 = new MQBrowser();
    _1.name = _1.version = _1.os = "unknown";
    var _2 = window.navigator.userAgent.toLowerCase();
    var _3 = window.navigator.appName;
    var _4 = window.navigator.appVersion;
    var _5 = new Array("firefox", "msie", "netscape", "opera", "safari");
    var _6 = new Array("linux", "mac", "windows", "x11");
    var _7 = _5.length;
    var _8 = "";
    for (var i = 0, n = _7; i < n; i++) {
        _8 = _2.indexOf(_5[i]) + 1;
        if (_8 > 0) {
            _1.name = _5[i];
            var _b = _8 + _1.name.length;
            var _c = ((_1.name == "safari") || (_2.charAt(_b + 4) > 0 && _2.charAt(_b + 4) < 9)) ? 5 : 3;
            _1.version = _2.substring(_b, _b + _c);
        }
    }
    var _d = _6.length;
    for (var j = 0, m = _d; j < m; j++) {
        _8 = _2.indexOf(_6[j]) + 1;
        if (_8 > 0) {
            _1.os = _6[j];
        }
    }
    if (_3 == "Netscape") {
        _1.appname = "ns";
    }
    else {
        if (_3 == "Microsoft Internet Explorer") {
            _1.appname = "ie";
        }
    }
    _1.appVersion = _4;
    _1.vMajor = parseInt(_1.appVersion);
    _1.isNS = (_1.appname == "ns" && _1.vMajor >= 4);
    _1.isNS4 = (_1.appname == "ns" && _1.vMajor == 4);
    _1.isNS6 = (_1.appname == "ns" && _1.vMajor == 5);
    _1.isIE = (_1.appname == "ie" && _1.vMajor >= 4);
    _1.isIE4 = (_1.appVersion.indexOf("MSIE 4") > 0);
    _1.isIE5 = (_1.appVersion.indexOf("MSIE 5") > 0);
    _1.isDOM = (document.createElement && document.appendChild && document.getElementsByTagName) ? true : false;
    _1.isSafari = (_1.name == "safari");
    if (_2.indexOf("win") > -1) {
        _1.platform = "win";
    }
    else {
        if (_2.indexOf("mac") > -1) {
            _1.platform = "mac";
        }
        else {
            _1.platform = "other";
        }
    }
    return _1;
}

var mqBrowserInfo = mqGetBrowserInfo();
function MQObject(){
    var _10 = null;
    this.getM_XmlDoc = function(){
        return _10;
    };
    this.setM_XmlDoc = function(_11){
        _10 = _11;
    };
    var _12 = null;
    this.getM_Xpath = function(){
        return _12;
    };
    this.setM_Xpath = function(_13){
        _12 = _13;
    };
}

MQObject.prototype.getClassName = function(){
    return "MQObject";
};
MQObject.prototype.getObjectVersion = function(){
    return 0;
};
MQObject.prototype.setProperty = function(_14, _15){
    var _16;
    if (_14 !== null) {
        _16 = "/" + this.getM_Xpath() + "/" + _14;
    }
    else {
        _16 = "/" + this.getM_Xpath();
    }
    var _17 = mqSetNodeText(this.getM_XmlDoc(), _16, _15);
    if (_17 === null) {
        var _18 = this.getM_XmlDoc().createElement(_14);
        var _19 = this.getM_XmlDoc().documentElement.appendChild(_18);
        _17 = mqSetNodeText(this.getM_XmlDoc(), _16, _15);
    }
    return _17;
};
MQObject.prototype.getProperty = function(_1a){
    var _1b;
    if (_1a !== null) {
        _1b = "/" + this.getM_Xpath() + "/" + _1a;
    }
    else {
        _1b = "/" + this.getM_Xpath();
    }
    return mqGetXPathNodeText(this.getM_XmlDoc(), _1b);
};
MQObject.prototype.copy = function(){
    var cp = new this.constructor;
    cp.loadXml(this.saveXml());
    return cp;
};
MQObject.prototype.internalCopy = function(obj){
    var _1e = "<" + obj.getM_Xpath();
    if (this.getObjectVersion() > 0) {
        _1e = _1e + " Version=\"" + this.getObjectVersion() + "\"";
    }
    _1e = _1e + ">";
    var _1f = this.getM_XmlDoc().documentElement;
    var _20 = _1f.childNodes;
    var _21 = _20.length;
    for (var _22 = 0; _22 < _21; _22++) {
        _1e = _1e + mqXmlToStr(_20[_22]);
    }
    _1e = _1e + "</" + obj.getM_Xpath() + ">";
    var cp = new this.constructor;
    cp.loadXml(_1e);
    return cp;
};
MQPoint.prototype = new MQObject();
MQPoint.prototype.constructor = MQPoint;
function MQPoint(_24, _25){
    MQObject.call(this);
    this.x = 0;
    this.y = 0;
    this.setM_Xpath("Point");
    if (arguments.length == 1) {
        this.setM_Xpath(_24);
    }
    else {
        if (arguments.length == 2) {
            this.x = parseInt(_24);
            this.y = parseInt(_25);
            if (isNaN(this.x) || isNaN(this.y)) {
                throw new Error("MQPoint constructor called with invalid parameter");
            }
        }
        else {
            if (arguments.length > 2) {
                throw new Error("MQPoint constructor called with " + arguments.length + " arguments, but it expects 0, 1, or 2 arguments");
            }
        }
    }
}

MQPoint.prototype.getClassName = function(){
    return "MQPoint";
};
MQPoint.prototype.getObjectVersion = function(){
    return 0;
};
MQPoint.prototype.loadXml = function(_26){
    if ("undefined" !== typeof(mqutils)) {
        this.setM_XmlDoc(mqCreateXMLDoc(_26));
        this.x = this.getProperty("X");
        this.y = this.getProperty("Y");
    }
};
MQPoint.prototype.saveXml = function(){
    return "<" + this.getM_Xpath() + "><X>" + this.x + "</X><Y>" + this.y + "</Y></" + this.getM_Xpath() + ">";
};
MQPoint.prototype.setX = function(x){
    this.x = parseInt(x);
    if (isNaN(this.x)) {
        throw new Error("MQPoint.setX called with invalid parameter");
    }
};
MQPoint.prototype.getX = function(){
    return this.x;
};
MQPoint.prototype.setY = function(y){
    this.y = parseInt(y);
    if (isNaN(this.y)) {
        throw new Error("MQPoint.setY called with invalid parameter");
    }
};
MQPoint.prototype.getY = function(){
    return this.y;
};
MQPoint.prototype.setXY = function(x, y){
    this.x = parseInt(x);
    this.y = parseInt(y);
    if (isNaN(this.x) || isNaN(this.y)) {
        throw new Error("MQPoint.setXY called with invalid parameter");
    }
};
MQPoint.prototype.valid = function(){
    if ("undefined" !== typeof(mqutils)) {
        return (Math.abs(this.x != MQCONSTANT.MQPOINT_INVALID) && Math.abs(this.y != MQCONSTANT.MQPOINT_INVALID));
    }
    return false;
};
MQPoint.prototype.equals = function(pt){
    if (pt) {
        return (this.x === pt.x && this.y === pt.y);
    }
    return false;
};
MQPoint.prototype.toString = function(){
    return this.x + "," + this.y;
};
MQLatLng.prototype = new MQObject();
MQLatLng.prototype.constructor = MQLatLng;
//function MQLatLng(_2c, _2d){
//    MQObject.call(this);
//    this.lat = 0;
//    this.lng = 0;
//    this.setM_Xpath("LatLng");
//    if (arguments.length == 1) {
//        this.setM_Xpath(_2c);
//    }
//    else {
//        if (arguments.length == 2) {
//            this.lat = parseFloat(_2c);
//            this.lng = parseFloat(_2d);
//            if (isNaN(this.lat) || isNaN(this.lng)) {
//                throw new Error("MQLatLng constructor called with invalid parameter");
//            }
//        }
//        else {
//            if (arguments.length > 2) {
//                throw new Error("MQLatLng constructor called with " + arguments.length + " arguments, but it expects 0, 1, or 2 arguments.");
//            }
//        }
//    }
//}

/**
 * Constructs a new MQLatLng object.
 * from regular mqcommon
 * @class Contains a latitude/longitude pair.
 * @param {float/string} param1 OPTIONAL: Depending on the absence of param2.
 * If param2 exists then param1 is initial latitude (float - default is 0.0)
 * otherwise param1 is xpath (string - default is "LatLng"). 
 * @param {float} param2 OPTIONAL: initial longitude (default is 0.0).
 * @extends MQObject
 */
function MQLatLng (param1, param2) {
   MQObject.call(this);
   /**
    * Value to represent the latitude
    * @type float
    */
   this.lat = 0.0;
   /**
    * Value to represent the longitude
    * @type float
    */
   this.lng = 0.0;

   // Set default path
   this.setM_Xpath("LatLng");

   if (arguments.length == 1){
      this.setM_Xpath(param1);
   }
   else if (arguments.length == 2){
      this.lat = parseFloat(param1);
      this.lng = parseFloat(param2);
      if (isNaN(this.lat) || isNaN(this.lng))
         throw new Error("MQLatLng constructor called with invalid parameter");
   }
   else if (arguments.length > 2){
      throw new Error("MQLatLng constructor called with "
         + arguments.length
         + " arguments, but it expects 0, 1, or 2 arguments.");
   }

}
MQLatLng.prototype.getClassName = function(){
    return "MQLatLng";
};
MQLatLng.prototype.getObjectVersion = function(){
    return 0;
};
MQLatLng.prototype.loadXml = function(_2e){
    if ("undefined" !== typeof(mqutils)) {
        this.setM_XmlDoc(mqCreateXMLDoc(_2e));
        this.lat = this.getProperty("Lat");
        this.lng = this.getProperty("Lng");
    }
};
MQLatLng.prototype.saveXml = function(){
    return "<" + this.getM_Xpath() + "><Lat>" + this.lat + "</Lat><Lng>" + this.lng + "</Lng></" + this.getM_Xpath() + ">";
};
MQLatLng.prototype.setLatitude = function(_2f){
    this.lat = parseFloat(_2f);
    if (isNaN(this.lat)) {
        throw new Error("MQLatLng.setLatitude called with invalid parameter");
    }
};
MQLatLng.prototype.getLatitude = function(){
    return this.lat;
};
MQLatLng.prototype.setLongitude = function(_30){
    this.lng = parseFloat(_30);
    if (isNaN(this.lng)) {
        throw new Error("MQLatLng.setLongitude called with invalid parameter");
    }
};
MQLatLng.prototype.getLongitude = function(){
    return this.lng;
};
MQLatLng.prototype.setLatLng = function(_31, _32){
    this.lat = parseFloat(_31);
    this.lng = parseFloat(_32);
    if (isNaN(this.lat) || isNaN(this.lng)) {
        throw new Error("MQLatLng.setLatLng called with invalid parameter");
    }
};
MQLatLng.prototype.arcDistance = function(ll2, _34){
    if ("undefined" !== typeof(mqutils)) {
        if (ll2) {
            if (ll2.getClassName() !== "MQLatLng") {
                alert("failure in arcDistance");
                throw "failure in arcDistance";
            }
        }
        else {
            alert("failure in arcDistance");
            throw "failure in arcDistance";
        }
        if (_34) {
            mqIsClass("MQDistanceUnits", _34, false);
        }
        else {
            _34 = new MQDistanceUnits(MQCONSTANT.MQDISTANCEUNITS_MILES);
        }
        if (this.getLatitude() == ll2.getLatitude() && this.getLongitude() == ll2.getLongitude()) {
            return 0;
        }
        var _35 = ll2.getLongitude() - this.getLongitude();
        var a = MQCONSTANT.MQLATLNG_RADIANS * (90 - this.getLatitude());
        var c = MQCONSTANT.MQLATLNG_RADIANS * (90 - ll2.getLatitude());
        var _38 = (Math.cos(a) * Math.cos(c)) + (Math.sin(a) * Math.sin(c) * Math.cos(MQCONSTANT.MQLATLNG_RADIANS * (_35)));
        var _39 = (_34.getValue() === MQCONSTANT.MQDISTANCEUNITS_MILES) ? 3963.205 : 6378.160187;
        if (_38 < -1) {
            return MQCONSTANT.PI * _39;
        }
        else {
            if (_38 >= 1) {
                return 0;
            }
            else {
                return Math.acos(_38) * _39;
            }
        }
    }
    return -1;
};
MQLatLng.prototype.valid = function(){
    if ("undefined" !== typeof(mqutils)) {
        return (Math.abs(this.getLatitude() - MQCONSTANT.MQLATLNG_INVALID) > MQCONSTANT.MQLATLNG_TOLERANCE && Math.abs(this.getLongitude() - MQCONSTANT.MQLATLNG_INVALID) > MQCONSTANT.MQLATLNG_TOLERANCE);
    }
    return false;
};
MQLatLng.prototype.equals = function(ll){
    if (ll !== null) {
        return (this.getLongitude() === ll.getLongitude() && this.getLatitude() === ll.getLatitude());
    }
    return false;
};
MQLatLng.prototype.toString = function(){
    return this.lat + "," + this.lng;
};
function mqCreateXMLDoc(_3b){
    var _3c;
    if (document.implementation.createDocument) {
        var _3d = new window.DOMParser();
        if (mqBrowserInfo.isSafari) {
            _3b = _3b.replace(/&/g, "&amp;");
        }
        _3c = _3d.parseFromString(_3b, "text/xml");
    }
    else {
        if (window.ActiveXObject) {
            _3c = new window.ActiveXObject("Microsoft.XMLDOM");
            _3c.async = "false";
            _3c.loadXML(_3b);
        }
    }
    return _3c;
}

function mqCreateXMLDocFromNode(_3e){
    var _3f;
    _3e = _3e.documentElement;
    if (document.implementation.createDocument) {
        var _3f = document.implementation.createDocument("", "", null);
        try {
            _3f.appendChild(_3f.importNode(_3e, true));
        } 
        catch (error) {
            alert(error);
            alert(_3e.nodeName);
        }
    }
    else {
        if (window.ActiveXObject) {
            _3f = new ActiveXObject("Microsoft.XMLDOM");
            _3f.async = "false";
            _3f.loadXML(_3e.xml);
        }
    }
    return _3f;
}

function MQXMLDOC(){
    this.AUTOGEOCODECOVSWITCH = null;
    this.AUTOROUTECOVSWITCH = null;
    this.AUTOMAPCOVSWITCH = null;
    this.DBLAYERQUERY = null;
    this.LINEPRIMITIVE = null;
    this.POLYGONPRIMITIVE = null;
    this.RECTANGLEPRIMITIVE = null;
    this.ELLIPSEPRIMITIVE = null;
    this.TEXTPRIMITIVE = null;
    this.SYMBOLPRIMITIVE = null;
    this.LATLNG = null;
    this.POINT = null;
    this.POINTFEATURE = null;
    this.LINEFEATURE = null;
    this.POLYGONFEATURE = null;
    this.LOCATION = null;
    this.ADDRESS = null;
    this.SINGLELINEADDRESS = null;
    this.GEOADDRESS = null;
    this.GEOCODEOPTIONS = null;
    this.MANEUVER = null;
    this.ROUTEOPTIONS = null;
    this.ROUTERESULTS = null;
    this.ROUTEMATRIXRESULTS = null;
    this.RADIUSSEARCHCRITERIA = null;
    this.RECTSEARCHCRITERIA = null;
    this.POLYSEARCHCRITERIA = null;
    this.CORRIDORSEARCHCRITERIA = null;
    this.SIGN = null;
    this.TREKROUTE = null;
    this.INTCOLLECTION = null;
    this.DTCOLLECTION = null;
    this.LATLNGCOLLECTION = null;
    this.LOCATIONCOLLECTION = null;
    this.LOCATIONCOLLECTIONCOLLECTION = null;
    this.MANEUVERCOLLECTION = null;
    this.SIGNCOLLECTION = null;
    this.STRINGCOLLECTION = null;
    this.STRCOLCOLLECTION = null;
    this.FEATURECOLLECTION = null;
    this.PRIMITIVECOLLECTION = null;
    this.POINTCOLLECTION = null;
    this.TREKROUTECOLLECTION = null;
    this.FEATURESPECIFIERCOLLECTION = null;
    this.GEOCODEOPTIONSCOLLECTION = null;
    this.COVERAGESTYLE = null;
    this.RECORDSET = null;
    this.MAPSTATE = null;
    this.SESSION = null;
    this.SESSIONID = null;
    this.DTSTYLE = null;
    this.DTSTYLEEX = null;
    this.DTFEATURESTYLEEX = null;
    this.FEATURESPECIFIER = null;
    this.BESTFIT = null;
    this.BESTFITLL = null;
    this.CENTER = null;
    this.CENTERLATLNG = null;
    this.PAN = null;
    this.ZOOMIN = null;
    this.ZOOMOUT = null;
    this.ZOOMTO = null;
    this.ZOOMTORECT = null;
    this.ZOOMTORECTLATLNG = null;
    this.getAUTOGEOCODECOVSWITCH = function(){
        if (this.AUTOGEOCODECOVSWITCH === null) {
            this.AUTOGEOCODECOVSWITCH = mqCreateXMLDoc("<AutoGeocodeCovSwitch/>");
        }
        return this.AUTOGEOCODECOVSWITCH;
    };
    this.getAUTOROUTECOVSWITCH = function(){
        if (this.AUTOROUTECOVSWITCH === null) {
            this.AUTOROUTECOVSWITCH = mqCreateXMLDoc("<AutoRouteCovSwitch><Name/><DataVendorCodeUsage>0</DataVendorCodeUsage><DataVendorCodes Count=\"0\"/></AutoRouteCovSwitch>");
        }
        return this.AUTOROUTECOVSWITCH;
    };
    this.getAUTOMAPCOVSWITCH = function(){
        if (this.AUTOMAPCOVSWITCH === null) {
            this.AUTOMAPCOVSWITCH = mqCreateXMLDoc("<AutoMapCovSwitch><Name/><Style/><DataVendorCodeUsage>0</DataVendorCodeUsage><DataVendorCodes Count=\"0\"/><ZoomLevels Count=\"14\"><Item>6000</Item><Item>12000</Item><Item>24000</Item><Item>48000</Item><Item>96000</Item><Item>192000</Item><Item>400000</Item><Item>800000</Item><Item>1600000</Item><Item>3000000</Item><Item>6000000</Item><Item>12000000</Item><Item>24000000</Item><Item>48000000</Item></ZoomLevels></AutoMapCovSwitch>");
        }
        return this.AUTOMAPCOVSWITCH;
    };
    this.getDBLAYERQUERY = function(){
        if (this.DBLAYERQUERY === null) {
            this.DBLAYERQUERY = mqCreateXMLDoc("<DBLayerQuery/>");
        }
        return this.DBLAYERQUERY;
    };
    this.getLINEPRIMITIVE = function(){
        if (this.LINEPRIMITIVE === null) {
            this.LINEPRIMITIVE = mqCreateXMLDoc("<LinePrimitive Version=\"2\"/>");
        }
        return this.LINEPRIMITIVE;
    };
    this.getPOLYGONPRIMITIVE = function(){
        if (this.POLYGONPRIMITIVE === null) {
            this.POLYGONPRIMITIVE = mqCreateXMLDoc("<PolygonPrimitive Version=\"2\"/>");
        }
        return this.POLYGONPRIMITIVE;
    };
    this.getRECTANGLEPRIMITIVE = function(){
        if (this.RECTANGLEPRIMITIVE === null) {
            this.RECTANGLEPRIMITIVE = mqCreateXMLDoc("<RectanglePrimitive Version=\"2\"/>");
        }
        return this.RECTANGLEPRIMITIVE;
    };
    this.getELLIPSEPRIMITIVE = function(){
        if (this.ELLIPSEPRIMITIVE === null) {
            this.ELLIPSEPRIMITIVE = mqCreateXMLDoc("<EllipsePrimitive Version=\"2\"/>");
        }
        return this.ELLIPSEPRIMITIVE;
    };
    this.getTEXTPRIMITIVE = function(){
        if (this.TEXTPRIMITIVE === null) {
            this.TEXTPRIMITIVE = mqCreateXMLDoc("<TextPrimitive Version=\"2\"/>");
        }
        return this.TEXTPRIMITIVE;
    };
    this.getSYMBOLPRIMITIVE = function(){
        if (this.SYMBOLPRIMITIVE === null) {
            this.SYMBOLPRIMITIVE = mqCreateXMLDoc("<SymbolPrimitive Version=\"2\"/>");
        }
        return this.SYMBOLPRIMITIVE;
    };
    this.getLATLNG = function(){
        if (this.LATLNG === null) {
            this.LATLNG = mqCreateXMLDoc("<LatLng/>");
        }
        return this.LATLNG;
    };
    this.getPOINT = function(){
        if (this.POINT === null) {
            this.POINT = mqCreateXMLDoc("<Point/>");
        }
        return this.POINT;
    };
    this.getPOINTFEATURE = function(){
        if (this.POINTFEATURE === null) {
            this.POINTFEATURE = mqCreateXMLDoc("<PointFeature/>");
        }
        return this.POINTFEATURE;
    };
    this.getLINEFEATURE = function(){
        if (this.LINEFEATURE === null) {
            this.LINEFEATURE = mqCreateXMLDoc("<LineFeature/>");
        }
        return this.LINEFEATURE;
    };
    this.getPOLYGONFEATURE = function(){
        if (this.POLYGONFEATURE === null) {
            this.POLYGONFEATURE = mqCreateXMLDoc("<PolygonFeature/>");
        }
        return this.POLYGONFEATURE;
    };
    this.getLOCATION = function(){
        if (this.LOCATION === null) {
            this.LOCATION = mqCreateXMLDoc("<Location/>");
        }
        return this.LOCATION;
    };
    this.getADDRESS = function(){
        if (this.ADDRESS === null) {
            this.ADDRESS = mqCreateXMLDoc("<Address/>");
        }
        return this.ADDRESS;
    };
    this.getSINGLELINEADDRESS = function(){
        if (this.SINGLELINEADDRESS === null) {
            this.SINGLELINEADDRESS = mqCreateXMLDoc("<SingleLineAddress/>");
        }
        return this.SINGLELINEADDRESS;
    };
    this.getGEOADDRESS = function(){
        if (this.GEOADDRESS === null) {
            this.GEOADDRESS = mqCreateXMLDoc("<GeoAddress/>");
        }
        return this.GEOADDRESS;
    };
    this.getGEOCODEOPTIONS = function(){
        if (this.GEOCODEOPTIONS === null) {
            this.GEOCODEOPTIONS = mqCreateXMLDoc("<GeocodeOptions/>");
        }
        return this.GEOCODEOPTIONS;
    };
    this.getMANEUVER = function(){
        if (this.MANEUVER === null) {
            this.MANEUVER = mqCreateXMLDoc("<Maneuver Version=\"1\"><Narrative/><Streets Count=\"0\"/><TurnType>-1</TurnType><Distance>0.0</Distance><Time>-1</Time><Direction>0</Direction><ShapePoints Count=\"0\"/><GEFIDs Count=\"0\"/><Signs  Count=\"0\"/></Maneuver>");
        }
        return this.MANEUVER;
    };
    this.getROUTEOPTIONS = function(){
        if (this.ROUTEOPTIONS === null) {
            this.ROUTEOPTIONS = mqCreateXMLDoc("<RouteOptions Version=\"3\"><RouteType>0</RouteType><NarrativeType>1</NarrativeType><NarrativeDistanceUnitType>0</NarrativeDistanceUnitType><MaxShape>0</MaxShape><MaxGEFID>0</MaxGEFID><Language>English</Language><CoverageName>navt_r</CoverageName><CovSwitcher><Name></Name><DataVendorCodeUsage>0</DataVendorCodeUsage><DataVendorCodes Count=\"0\"/></CovSwitcher><AvoidAttributeList Count=\"0\"/><AvoidGefIdList Count=\"0\"/><AvoidAbsoluteGefIdList Count=\"0\"/><StateBoundaryDisplay>1</StateBoundaryDisplay><CountryBoundaryDisplay>1</CountryBoundaryDisplay></RouteOptions>");
        }
        return this.ROUTEOPTIONS;
    };
    this.getROUTERESULTS = function(){
        if (this.ROUTERESULTS === null) {
            this.ROUTERESULTS = mqCreateXMLDoc("<RouteResults Version=\"1\"><Locations Count=\"0\"/><CoverageName/><ResultMessages Count=\"0\"/><TrekRoutes Count=\"0\"/></RouteResults>");
        }
        return this.ROUTERESULTS;
    };
    this.getROUTEMATRIXRESULTS = function(){
        if (this.ROUTEMATRIXRESULTS === null) {
            this.ROUTEMATRIXRESULTS = mqCreateXMLDoc("<RouteMatrixResults/>");
        }
        return this.ROUTEMATRIXRESULTS;
    };
    this.getRADIUSSEARCHCRITERIA = function(){
        if (this.RADIUSSEARCHCRITERIA === null) {
            this.RADIUSSEARCHCRITERIA = mqCreateXMLDoc("<RadiusSearchCriteria/>");
        }
        return this.RADIUSSEARCHCRITERIA;
    };
    this.getRECTSEARCHCRITERIA = function(){
        if (this.RECTSEARCHCRITERIA === null) {
            this.RECTSEARCHCRITERIA = mqCreateXMLDoc("<RectSearchCriteria/>");
        }
        return this.RECTSEARCHCRITERIA;
    };
    this.getPOLYSEARCHCRITERIA = function(){
        if (this.POLYSEARCHCRITERIA === null) {
            this.POLYSEARCHCRITERIA = mqCreateXMLDoc("<PolySearchCriteria/>");
        }
        return this.POLYSEARCHCRITERIA;
    };
    this.getCORRIDORSEARCHCRITERIA = function(){
        if (this.CORRIDORSEARCHCRITERIA === null) {
            this.CORRIDORSEARCHCRITERIA = mqCreateXMLDoc("<CorridorSearchCriteria/>");
        }
        return this.CORRIDORSEARCHCRITERIA;
    };
    this.getSIGN = function(){
        if (this.SIGN === null) {
            this.SIGN = mqCreateXMLDoc("<Sign><Type>0</Type><Text></Text><ExtraText></ExtraText><Direction>0</Direction></Sign>");
        }
        return this.SIGN;
    };
    this.getTREKROUTE = function(){
        if (this.TREKROUTE === null) {
            this.TREKROUTE = mqCreateXMLDoc("<TrekRoute><Maneuvers Count=\"0\"/></TrekRoute>");
        }
        return this.TREKROUTE;
    };
    this.getINTCOLLECTION = function(){
        if (this.INTCOLLECTION === null) {
            this.INTCOLLECTION = mqCreateXMLDoc("<IntCollection Count=\"0\"/>");
        }
        return this.INTCOLLECTION;
    };
    this.getDTCOLLECTION = function(){
        if (this.DTCOLLECTION === null) {
            this.DTCOLLECTION = mqCreateXMLDoc("<DTCollection Version=\"1\" Count=\"0\"/>");
        }
        return this.DTCOLLECTION;
    };
    this.getLATLNGCOLLECTION = function(){
        if (this.LATLNGCOLLECTION === null) {
            this.LATLNGCOLLECTION = mqCreateXMLDoc("<LatLngCollection Version=\"1\" Count=\"0\"/>");
        }
        return this.LATLNGCOLLECTION;
    };
    this.getLOCATIONCOLLECTION = function(){
        if (this.LOCATIONCOLLECTION === null) {
            this.LOCATIONCOLLECTION = mqCreateXMLDoc("<LocationCollection Count=\"0\"/>");
        }
        return this.LOCATIONCOLLECTION;
    };
    this.getLOCATIONCOLLECTIONCOLLECTION = function(){
        if (this.LOCATIONCOLLECTIONCOLLECTION === null) {
            this.LOCATIONCOLLECTIONCOLLECTION = mqCreateXMLDoc("<LocationCollectionCollection Count=\"0\"/>");
        }
        return this.LOCATIONCOLLECTIONCOLLECTION;
    };
    this.getMANEUVERCOLLECTION = function(){
        if (this.MANEUVERCOLLECTION === null) {
            this.MANEUVERCOLLECTION = mqCreateXMLDoc("<ManeuverCollection Count=\"0\"/>");
        }
        return this.MANEUVERCOLLECTION;
    };
    this.getSIGNCOLLECTION = function(){
        if (this.SIGNCOLLECTION === null) {
            this.SIGNCOLLECTION = mqCreateXMLDoc("<SignCollection Count=\"0\"/>");
        }
        return this.SIGNCOLLECTION;
    };
    this.getSTRINGCOLLECTION = function(){
        if (this.STRINGCOLLECTION === null) {
            this.STRINGCOLLECTION = mqCreateXMLDoc("<StringCollection Count=\"0\"/>");
        }
        return this.STRINGCOLLECTION;
    };
    this.getSTRCOLCOLLECTION = function(){
        if (this.STRCOLCOLLECTION === null) {
            this.STRCOLCOLLECTION = mqCreateXMLDoc("<StrColCollectin/>");
        }
        return this.STRCOLCOLLECTION;
    };
    this.getFEATURECOLLECTION = function(){
        if (this.FEATURECOLLECTION === null) {
            this.FEATURECOLLECTION = mqCreateXMLDoc("<FeatureCollection Count=\"0\"/>");
        }
        return this.FEATURECOLLECTION;
    };
    this.getPRIMITIVECOLLECTION = function(){
        if (this.PRIMITIVECOLLECTION === null) {
            this.PRIMITIVECOLLECTION = mqCreateXMLDoc("<PrimitiveCollection Count=\"0\"/>");
        }
        return this.PRIMITIVECOLLECTION;
    };
    this.getPOINTCOLLECTION = function(){
        if (this.POINTCOLLECTION === null) {
            this.POINTCOLLECTION = mqCreateXMLDoc("<PointCollection Count=\"0\"/>");
        }
        return this.POINTCOLLECTION;
    };
    this.getTREKROUTECOLLECTION = function(){
        if (this.TREKROUTECOLLECTION === null) {
            this.TREKROUTECOLLECTION = mqCreateXMLDoc("<TrekRouteCollection Count=\"0\"/>");
        }
        return this.TREKROUTECOLLECTION;
    };
    this.getFEATURESPECIFIERCOLLECTION = function(){
        if (this.FEATURESPECIFIERCOLLECTION === null) {
            this.FEATURESPECIFIERCOLLECTION = mqCreateXMLDoc("<FeatureSpecifierCollection Count=\"0\"/>");
        }
        return this.FEATURESPECIFIERCOLLECTION;
    };
    this.getGEOCODEOPTIONSCOLLECTION = function(){
        if (this.GEOCODEOPTIONSCOLLECTION === null) {
            this.GEOCODEOPTIONSCOLLECTION = mqCreateXMLDoc("<GeocodeOptionsCollection Count=\"0\"/>");
        }
        return this.GEOCODEOPTIONSCOLLECTION;
    };
    this.getCOVERAGESTYLE = function(){
        if (this.COVERAGESTYLE === null) {
            this.COVERAGESTYLE = mqCreateXMLDoc("<CoverageStyle/>");
        }
        return this.COVERAGESTYLE;
    };
    this.getRECORDSET = function(){
        if (this.RECORDSET === null) {
            this.RECORDSET = mqCreateXMLDoc("<RecordSet/>");
        }
        return this.RECORDSET;
    };
    this.getMAPSTATE = function(){
        if (this.MAPSTATE === null) {
            this.MAPSTATE = mqCreateXMLDoc("<MapState/>");
        }
        return this.MAPSTATE;
    };
    this.getSESSION = function(){
        if (this.SESSION === null) {
            this.SESSION = mqCreateXMLDoc("<Session Count=\"0\"/>");
        }
        return this.SESSION;
    };
    this.getSESSIONID = function(){
        if (this.SESSIONID === null) {
            this.SESSIONID = mqCreateXMLDoc("<SessionID/>");
        }
        return this.SESSIONID;
    };
    this.getDTSTYLE = function(){
        if (this.DTSTYLE === null) {
            this.DTSTYLE = mqCreateXMLDoc("<DTStyle/>");
        }
        return this.DTSTYLE;
    };
    this.getDTSTYLEEX = function(){
        if (this.DTSTYLEEX === null) {
            this.DTSTYLEEX = mqCreateXMLDoc("<DTStyleEx/>");
        }
        return this.DTSTYLEEX;
    };
    this.getDTFEATURESTYLEEX = function(){
        if (this.DTFEATURESTYLEEX === null) {
            this.DTFEATURESTYLEEX = mqCreateXMLDoc("<DTFeatureStyleEx/>");
        }
        return this.DTFEATURESTYLEEX;
    };
    this.getFEATURESPECIFIER = function(){
        if (this.FEATURESPECIFIER === null) {
            this.FEATURESPECIFIER = mqCreateXMLDoc("<FeatureSpecifier/>");
        }
        return this.FEATURESPECIFIER;
    };
    this.getBESTFIT = function(){
        if (this.BESTFIT === null) {
            this.BESTFIT = mqCreateXMLDoc("<BestFit Version=\"2\"/>");
        }
        return this.BESTFIT;
    };
    this.getBESTFITLL = function(){
        if (this.BESTFITLL === null) {
            this.BESTFITLL = mqCreateXMLDoc("<BestFitLL Version=\"2\"/>");
        }
        return this.BESTFITLL;
    };
    this.getCENTER = function(){
        if (this.CENTER === null) {
            this.CENTER = mqCreateXMLDoc("<Center/>");
        }
        return this.CENTER;
    };
    this.getCENTERLATLNG = function(){
        if (this.CENTERLATLNG === null) {
            this.CENTERLATLNG = mqCreateXMLDoc("<CenterLatLng/>");
        }
        return this.CENTERLATLNG;
    };
    this.getPAN = function(){
        if (this.PAN === null) {
            this.PAN = mqCreateXMLDoc("<Pan/>");
        }
        return this.PAN;
    };
    this.getZOOMIN = function(){
        if (this.ZOOMIN === null) {
            this.ZOOMIN = mqCreateXMLDoc("<ZoomIn/>");
        }
        return this.ZOOMIN;
    };
    this.getZOOMOUT = function(){
        if (this.ZOOMOUT === null) {
            this.ZOOMOUT = mqCreateXMLDoc("<ZoomOut/>");
        }
        return this.ZOOMOUT;
    };
    this.getZOOMTO = function(){
        if (this.ZOOMTO === null) {
            this.ZOOMTO = mqCreateXMLDoc("<ZoomTo/>");
        }
        return this.ZOOMTO;
    };
    this.getZOOMTORECT = function(){
        if (this.ZOOMTORECT === null) {
            this.ZOOMTORECT = mqCreateXMLDoc("<ZoomToRect/>");
        }
        return this.ZOOMTORECT;
    };
    this.getZOOMTORECTLATLNG = function(){
        if (this.ZOOMTORECTLATLNG === null) {
            this.ZOOMTORECTLATLNG = mqCreateXMLDoc("<ZoomToRectLatLng/>");
        }
        return this.ZOOMTORECTLATLNG;
    };
}

var MQXML = new MQXMLDOC();
MQObjectCollection.prototype = new MQObject();
MQObjectCollection.prototype.constructor = MQObjectCollection;
function MQObjectCollection(max){
    MQObject.call(this);
    var _41 = new Array();
    this.getM_Items = function(){
        return _41;
    };
    var _42 = (max !== null) ? max : -1;
    var _43 = "MQObject";
    this.getValidClassName = function(){
        return _43;
    };
    this.setValidClassName = function(_44){
        _43 = _44;
    };
    this.add = function(obj){
        if (this.isValidObject(obj)) {
            if (_42 !== -1 && _41.length === max) {
                return;
            }
            _41.push(obj);
            return _41.length;
        }
        return;
    };
    this.getSize = function(){
        return _41.length;
    };
    this.get = function(i){
        return _41[i];
    };
    this.remove = function(_47){
        return _41.splice(_47, 1);
    };
    this.removeAll = function(){
        _41 = null;
        _41 = new Array();
    };
    this.contains = function(_48){
        var _49 = this.getSize();
        for (var _4a = 0; _4a < _49; _4a++) {
            if (_41[_4a] === _48) {
                return true;
            }
        }
        return false;
    };
    this.append = function(_4b){
        if (this.getClassName() === _4b.getClassName()) {
            _41 = _41.concat(_4b.getM_Items());
        }
        else {
            alert("Invalid attempt to append " + this.getClassName() + " to " + _4b.getClassName() + "!");
            throw "Invalid attempt to append " + this.getClassName() + " to " + _4b.getClassName() + "!";
        }
    };
    this.set = function(i, _4d){
        var _4e = get(i);
        _41[i] = _4d;
        return _4e;
    };
    this.isValidObject = function(obj){
        if (obj !== null) {
            if (_43 === "ALL") {
                return true;
            }
            else {
                if (_43 === "MQObject") {
                    return true;
                }
                else {
                    if (_43 === "String") {
                        return true;
                    }
                    else {
                        if (_43 === "int") {
                            if (isNaN(obj)) {
                                return false;
                            }
                            else {
                                if (obj === Math.floor(obj)) {
                                    return true;
                                }
                            }
                        }
                        else {
                            if (obj.getClassName() === _43) {
                                return true;
                            }
                        }
                    }
                }
            }
        }
        return false;
    };
    var _50 = "Item";
    this.getM_itemXpath = function(){
        return _50;
    };
    this.setM_itemXpath = function(_51){
        _50 = _51;
    };
    this.getById = function(_52){
        try {
            for (var _53 = 0; _53 < this.getSize(); _53++) {
                if (_41[_53].getId() == _52) {
                    return _41[_53];
                }
            }
        } 
        catch (Error) {
        }
        return null;
    };
    this.removeItem = function(_54){
        for (var i = 0; i < _41.length; i++) {
            if (_41[i] == _54) {
                this.remove(i);
                i = _41.length;
            }
        }
    };
}

MQObjectCollection.prototype.getClassName = function(){
    return "MQObjectCollection";
};
MQObjectCollection.prototype.getObjectVersion = function(){
    return 0;
};
MQObjectCollection.prototype.getAt = function(i){
    return this.get(i);
};
MQLatLngCollection.prototype = new MQObjectCollection(32678);
MQLatLngCollection.prototype.constructor = MQLatLngCollection;
function MQLatLngCollection(){
    MQObjectCollection.call(this, 32678);
    this.setValidClassName("MQLatLng");
    this.setM_Xpath("LatLngCollection");
    this.setM_XmlDoc(mqCreateXMLDocFromNode(MQXML.getLATLNGCOLLECTION()));
}

MQLatLngCollection.prototype.getClassName = function(){
    return "MQLatLngCollection";
};
MQLatLngCollection.prototype.getObjectVersion = function(){
    return 1;
};
MQLatLngCollection.prototype.loadXml = function(_57){
    this.removeAll();
    var _58 = mqCreateXMLDoc(_57);
    this.setM_XmlDoc(_58);
    if (_58 !== null) {
        this._loadCollection(_58);
    }
};
MQLatLngCollection.prototype.loadXmlFromNode = function(_59){
    this.removeAll();
    var _5a = mqCreateXMLDocImportNode(_59);
    this.setM_XmlDoc(_5a);
    if (_5a !== null) {
        this._loadCollection(_5a);
    }
};
MQLatLngCollection.prototype._loadCollection = function(_5b){
    var _5c = _5b.documentElement;
    var _5d = _5c.childNodes;
    var _5e = _5d.length;
    _5e = (_5e < 32678) ? _5e : 32678;
    var _5f = 0;
    var _60 = 0;
    var _61 = 0;
    var _62 = 0;
    var _63 = null;
    if (this.getValidClassName() === "MQLatLng") {
        for (var _64 = 0; _64 < _5e; _64++) {
            if (_64 == 0) {
                if (_5d[_64].firstChild !== null) {
                    _61 = _5d[_64].firstChild.nodeValue / 1000000;
                }
                _64++;
                if (_5d[_64].firstChild !== null) {
                    _62 = _5d[_64].firstChild.nodeValue / 1000000;
                }
            }
            else {
                if (_5d[_64].firstChild !== null) {
                    _61 = _5f + (_5d[_64].firstChild.nodeValue / 1000000);
                }
                _64++;
                if (_5d[_64].firstChild !== null) {
                    _62 = _60 + (_5d[_64].firstChild.nodeValue / 1000000);
                }
            }
            _5f = _61;
            _60 = _62;
            _63 = new MQLatLng(_61, _62);
            this.add(_63);
        }
    }
};
MQLatLngCollection.prototype.saveXml = function(){
    var _65 = "<" + this.getM_Xpath() + " Version=\"" + this.getObjectVersion() + "\" Count=\"" + this.getSize() + "\">";
    var _66 = parseInt(this.getSize());
    if (_66 >= 1) {
        var _67 = nLng = nPrevLat = nPrevLng = nDeltaLat = nDeltaLng = 0;
        var _68 = null;
        for (var i = 0; i < _66; i++) {
            _68 = this.getAt(i);
            _67 = parseInt(_68.getLatitude() * 1000000);
            nLng = parseInt(_68.getLongitude() * 1000000);
            nDeltaLat = _67 - nPrevLat;
            nDeltaLng = nLng - nPrevLng;
            _65 += "<Lat>" + nDeltaLat + "</Lat>";
            _65 += "<Lng>" + nDeltaLng + "</Lng>";
            nPrevLat = _67;
            nPrevLng = nLng;
        }
    }
    _65 = _65 + "</" + this.getM_Xpath() + ">";
    return _65;
};
MQLatLngCollection.prototype.generalize = function(_6a){
    var _6b = function(){
        this.pLL = null;
        this.dSegmentLength = 0;
        this.dPriorLength = 0;
    };
    var _6c = function(){
        this.pLL = null;
        this.ulOriginalPoint = 0;
    };
    mqllAnchor = null;
    var _6d;
    var i;
    var _6f = 0;
    var _70 = this.getSize();
    var _71 = new Array(_70);
    var _72 = new Array(_70);
    var _73 = 0;
    if (_70 < 2) {
        return;
    }
    for (i = 0; i < _70; i++) {
        _71[i] = new _6b();
        _72[i] = new _6c();
        _71[i].pLL = this.getAt(i);
    }
    for (i = 0; i < _70 - 1; i++) {
        _71[i].dSegmentLength = _71[i].pLL.arcDistance(_71[(i + 1)].pLL);
        if (i == 0) {
            _71[i].dPriorLength = 0;
        }
        else {
            _71[i].dPriorLength = _6f;
        }
        _6f += _71[i].dSegmentLength;
    }
    mqllAnchor = _71[0].pLL;
    _6d = 0;
    _72[0].pLL = mqllAnchor;
    _72[0].ulOriginalPoint = 0;
    _73 = 1;
    for (i = 2; i < _70; i++) {
        if (!this.isEverybodyWithinDeviation(_71, _6d, i, _6a)) {
            mqllAnchor = _71[(i - 1)].pLL;
            _6d = (i - 1);
            _72[_73].pLL = mqllAnchor;
            _72[_73].ulOriginalPoint = (i - 1);
            _73++;
        }
    }
    _72[_73].pLL = _71[_70 - 1].pLL;
    _72[_73].ulOriginalPoint = _70 - 1;
    _73++;
    var _74 = _70;
    var _75;
    for (_75 = (_73 - 1); _75 >= 0; _75--) {
        if ((_74 - 1) != _72[_75].ulOriginalPoint) {
            for (var x = (_74 - 1); x > _72[_75].ulOriginalPoint; x--) {
                try {
                    this.remove(x);
                } 
                catch (e) {
                }
            }
            _74 = _72[_75].ulOriginalPoint;
        }
        else {
            _74--;
        }
    }
    _71 = null;
    _72 = null;
};
MQLatLngCollection.prototype.isEverybodyWithinDeviation = function(_77, _78, _79, _7a){
    var _7b = 0;
    var _7c = 0;
    var _7d = null;
    var _7e = null;
    var _7f = 0;
    var _80 = 0;
    var _81 = 0;
    var i;
    var _83 = null;
    var _84 = 0;
    var _85 = 0;
    var _86 = 0;
    var _87 = 0;
    var _88 = 0;
    var _89 = 0;
    var _8a = 0;
    var _8b = 0;
    _7b = DistanceApproximation.getMilesPerLngDeg(_77[_78].pLL.getLatitude());
    _7c = _7a * _7a;
    _7d = _77[_78].pLL;
    _7e = _77[_79].pLL;
    _7f = (_7e.getLatitude() - _7d.getLatitude()) * DistanceApproximation.MILES_PER_LATITUDE;
    _80 = (_7e.getLongitude() - _7d.getLongitude()) * _7b;
    _81 = _7f * _7f + _80 * _80;
    for (i = _78 + 1; i < _79; i++) {
        _83 = _77[i].pLL;
        _84 = (_83.getLatitude() - _7d.getLatitude()) * DistanceApproximation.MILES_PER_LATITUDE;
        _85 = (_83.getLongitude() - _7d.getLongitude()) * _7b;
        _86 = _84 * _84 + _85 * _85;
        _88 = _7f * _84 + _80 * _85;
        _89 = _7f * _7f + _80 * _80;
        if (_89 == 0) {
            _87 = 0;
        }
        else {
            _87 = _88 / _89;
        }
        _8a = _87 * _87 * _81;
        _8b = _86 - _8a;
        if (_8b > _7c) {
            return false;
        }
    }
    return true;
};
var DistanceApproximation = new function(){
    this.m_testLat;
    this.m_testLng;
    this.m_mpd;
    this.m_milesPerLngDeg = new Array(69.170976, 69.160441, 69.128838, 69.076177, 69.002475, 68.907753, 68.792041, 68.655373, 68.497792, 68.319345, 68.120088, 67.900079, 67.659387, 67.398085, 67.116253, 66.813976, 66.491346, 66.148462, 65.785428, 65.402355, 64.999359, 64.576564, 64.134098, 63.672096, 63.190698, 62.690052, 62.17031, 61.63163, 61.074176, 60.498118, 59.903632, 59.290899, 58.660106, 58.011443, 57.345111, 56.66131, 55.96025, 55.242144, 54.507211, 53.755675, 52.987764, 52.203713, 51.403761, 50.588151, 49.757131, 48.910956, 48.049882, 47.174172, 46.284093, 45.379915, 44.461915, 43.530372, 42.58557, 41.627796, 40.657342, 39.674504, 38.679582, 37.672877, 36.654698, 35.625354, 34.585159, 33.534429, 32.473485, 31.40265, 30.322249, 29.232613, 28.134073, 27.026963, 25.911621, 24.788387, 23.657602, 22.519612, 21.374762, 20.223401, 19.065881, 17.902554, 16.733774, 15.559897, 14.38128, 13.198283, 12.011266, 10.820591, 9.626619, 8.429716, 7.230245, 6.028572, 4.825062, 3.620083, 2.414002, 1.207185, 1);
    this.MILES_PER_LATITUDE = 69.170976;
    this.KILOMETERS_PER_MILE = 1.609347;
    this.getMilesPerLngDeg = function(lat){
        return (Math.abs(lat) <= 90) ? this.m_milesPerLngDeg[parseInt(Math.abs(lat) + 0.5)] : 69.170976;
    };
};


