function _Map() {
    var id = null;
    var mapdiv = null;
    var map = null;
    var mappoints = null;
    var zoom = null;
    var CenterPoint_LatLong = null;
    //-----------------------------------------------------------------
    this.init = _init;
    function _init(uniqueid) {
        id = uniqueid;
        mapdiv = document.getElementById("mapdiv" + id);
        zoom = mapdiv.getAttribute("zoom");
        if (zoom==null||zoom == "")
            zoom = 12;
        var height = mapdiv.clientWidth;
        mapdiv.style.height = (height / 4) * 3;
        mappoints = document.getElementsByName("mappoint" + id);

        _GetMap();
    }

    //-----------------------------------------------------------------
    this.GetMap = _GetMap;
    function _GetMap() 
    {
        map = new VEMap(mapdiv.getAttribute("id"));
        map.onLoadMap = _OnLoadMap;
        map.LoadMap();
    }
    //-----------------------------------------------------------------
    this.OnLoadMap = _OnLoadMap;
    function _OnLoadMap() {

        map.ShowTrafficLegend();
        var centerpointaddress = mapdiv.getAttribute("centerpointaddress");
        if (mappoints != null && mappoints.length > 0 && (centerpointaddress == null || centerpointaddress == '')) {
            centerpointaddress = mappoints[0].getAttribute("address");
        }

        if (centerpointaddress != null && centerpointaddress != '') {
            map.Find(null, centerpointaddress, null, null, 0, 1, true, true, false, false
                , function(layer, resultsArray, places, hasMore, veErrorMessage) {
                    var place = null;
                    if (places!=null&&places.length > 0) { place = places[0]; }
                    _FindCallback_CenterPoint(place);
                });
        }
    }
    //-----------------------------------------------------------------
    this.GetPoint = _GetPoint;
    function _GetPoint(i) {
        if (mappoints.length > i) {
            var index = mappoints[i].getAttribute("index");
            var title = mappoints[i].getAttribute("addresstitle");
            var description = mappoints[i].innerHTML;
            var address = mappoints[i].getAttribute("address");

            var j = i + 1;

            map.Find(null, address, null, null, 0, 1, true, true, false, false
            , function(layer, resultsArray, places, hasMore, veErrorMessage) {
                var isCenterPoint = false;
                if (i == 0) { isCenterPoint = true; }
                var place = null;
                if (places != null && places.length > 0) { place = places[0]; }
                _FindCallback(place, index, title, description, isCenterPoint);
                _GetPoint(j);
            }
            );
        }
    }

//-----------------------------------------------------------------
    this.FindCallback_CenterPoint = _FindCallback_CenterPoint;
    function _FindCallback_CenterPoint(place) {
        if (place != null) {
            if (place.LatLong != null) {
                map.SetCenterAndZoom(place.LatLong, Number(zoom));
            }
        }
        _GetPoint(0);
    }
//-----------------------------------------------------------------
    this.FindCallback = _FindCallback;
    function _FindCallback(place, index, title, summary, isCenterPoint) {
        if (place != null) {
            if (place.LatLong != null) {
                if (isCenterPoint) {
                    CenterPoint_LatLong = place.LatLong;
                }
                var shape = new VEShape(VEShapeType.Pushpin, place.LatLong);
                shape.SetCustomIcon("<div class='Map_Pushpin'>" + index + "</div>");
                shape.SetTitle(title);
                shape.SetDescription(summary);
                map.AddShape(shape);
            }
        }
    }
}
