function Map() { } Map.Map = null; Map.BingRoadLayer = null; Map.BingAerialLayer = null; Map.BingAerialLabeledLayer = null; Map.LargeSymbolRenderer = null; Map.MiniSymbolRenderer = null; Map.CrimeHashTable = {}; Map.MultipleCrimeHashTable = {}; Map.AgencyHashTable = {}; Map.ToolBar = null; Map.LargeMultiCrimeSymbol = null; Map.MiniMultiCrimeSymbol = null;
Map.Initialize = function () {
    jQuery.browser.msie && $("#overview-map-button").css({ top: "245px", right: "60px" }); window.name = "MapPage"; esriConfig.defaults.map.slider = { right: "20px", top: "70px", height: "200px" }; Map.Map = new esri.Map("map", { showInfoWindowOnClick: true, isZoomSlider: true, wrapAround180: true }); dojo.connect(Map.Map, "onMouseOut", Map.FireMapMouseUp); dojo.connect(Map.Map, "onLoad", Map.OnLoad); dojo.connect(Map.Map.infoWindow, "onShow", MapHelper.OnInfoWindowShow); dojo.connect(Map.Map, "onResize", function () {
        if (Configuration.HasCustomUrl ==
false && Configuration.HasDefaultExtentSet == true) Map.Map.setExtent(Configuration.DefaultExtent, false), Configuration.HasDefaultExtentSet = false
    }); Map.ToolBar = new esri.toolbars.Navigation(Map.Map); Map.Map.infoWindow.resize(Configuration.InfoWindowBaseWidth, Configuration.InfoWindowBaseHeight); Map.BingRoadLayer = Map.CreateBingLayer(Configuration.BingRoadLayerUrl, esri.virtualearth.VETiledLayer.MAP_STYLE_ROAD); Map.BingAerialLayer = Map.CreateBingLayer(Configuration.BingAerialLayerUrl, esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL);
    Map.BingAerialLabeledLayer = Map.CreateBingLayer(Configuration.BingAerialLabeledLayerUrl, esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL_WITH_LABELS); Configuration.GeometryService = new esri.tasks.GeometryService(Configuration.ArcGISGeometryServiceUrl); Map.CreateRenderers()
}; Map.OnLoad = function () { $(document).ready(Map.LoadUI) };
Map.LoadUI = function () {
    $("#main-address-search").watermark("Enter an address:", { className: "watermark" }); $("#address-form-search").watermark("Enter an address:", { className: "watermark" }); $("#main-address-search").focus(); UtilitiesHelper.CheckAllCrimeTypes(); EventBinderHelper.DisableNavigation(); EventBinderHelper.DisableRemoveFocusButtons(); EventBinderHelper.DisableRemoveLinesButtons(); EventBinderHelper.DisableRemoveFilterButtons(); $("td#address-form-radius-list-cell").html(HtmlGenerator.BuildAddressFormRadiusList());
    EventBinderHelper.EnablePanelControls(); EventBinderHelper.EnableMapCacheButtons(); EventBinderHelper.SetCurrentMapCache("ve_roads"); $("#map-tools").show(); $("#use-mini-icons-button").hide(); $("#loading-message").hide(); $(".toolbar .side-menu").fadeIn(); $("#address-form-radius-list").attr({ disabled: true }); $("#multi-agency-alert").hide(); $("#multi-agency-alert .heading").bind("click", function () { $("#multi-agency-alert ul").slideToggle("slow") }); UtilitiesHelper.FixCheckedCrimeTypes(); var a = new Date, b =
new Date(a.getFullYear(), a.getMonth(), a.getDate() - Configuration.DefaultDateRange), c = $("#inputStartDate, #inputEndDate").datepicker({ minDate: -180, maxDate: a, numberOfMonths: 1, onSelect: function (a) {
    var b = this.id == "inputStartDate" ? "minDate" : "maxDate", d = $(this).data("datepicker"), a = $.datepicker.parseDate(d.settings.dateFormat || $.datepicker._defaults.dateFormat, a, d.settings); c.not(this).datepicker("option", b, a); EventBinderHelper.EnableResetDatePickerButton(); this.id == "inputStartDate" ? $(".date-form .start .example").text($.datepicker.formatDate("DD, d MM, yy",
a)) : $(".date-form .end .example").text($.datepicker.formatDate("DD, d MM, yy", a))
} 
}); $("#inputStartDate").datepicker("setDate", b); $("#inputEndDate").datepicker("setDate", a); $(".date-form .start .example").text($.datepicker.formatDate("DD, d MM, yy", b)); CaptureDefaultSearch(); UtilitiesHelper.AttachResizeEvents(); UtilitiesHelper.ResizeMap(); MapHelper.WireMapMoveEvents(); MapHelper.ProcessCustomUrl(); Map.Map.addLayer(Map.CreateGraphicsLayer("geometryLayer")); Map.Map.addLayer(Map.CreateGraphicsLayer("agencyLayer"));
    Map.Map.addLayer(Map.CreateGraphicsLayer("crimesLayer"))
}; Map.CreateGraphicsLayer = function (a) { a = new esri.layers.GraphicsLayer({ id: a }); dojo.connect(a, "onMouseOver", function () { Map.Map.setMapCursor("pointer") }); dojo.connect(a, "onMouseOut", function () { Map.Map.setMapCursor("default") }); return a };
Map.CreateBingLayer = function (a, b) { var c = new esri.virtualearth.VETiledLayer({ bingMapsKey: Configuration.BingMapsKey, mapStyle: a, id: b, visible: false }); c != void 0 && c != null ? (dojo.connect(c, "onError", Map.VETileLayerError), dojo.connect(c, "onLoad", function () { Map.Map.addLayer(c) })) : ConsoleLogHelper.AddMessage("Map.CreateBingLayer failed. veTileLayer is null"); return c };
Map.VETileLayerError = function (a) { var b = ""; a.message != void 0 && a.message != null && (b += a.message); ConsoleLogHelper.AddMessage("A problem occurred retrieving the layer. Error Message: '" + b + "'") };
Map.CreateRenderers = function () {
    Map.LargeMultiCrimeSymbol = (new esri.symbol.PictureMarkerSymbol(Configuration.WebRoot + "images/map/crime-types/multiple-crimes-092911.png", 42, 38)).setOffset(10, 20); Map.MiniMultiCrimeSymbol = (new esri.symbol.PictureMarkerSymbol(Configuration.WebRoot + "images/map/crime-types/mini/multiple-crimes-092911.png", 26, 22)).setOffset(8, 12); Map.LargeSymbolRenderer = new esri.renderer.UniqueValueRenderer(Configuration.DefaultSymbol, "CrimeCode"); Map.MiniSymbolRenderer = new esri.renderer.UniqueValueRenderer(Configuration.DefaultSymbol,
"CrimeCode"); dojo.forEach(Configuration.CrimeCodes, function (a) { Map.LargeSymbolRenderer.addValue(a, Configuration.LargeCrimeSymbols[dojo.indexOf(Configuration.CrimeCodes, a)].setOffset(10, 20)); Map.MiniSymbolRenderer.addValue(a, Configuration.MiniCrimeSymbols[dojo.indexOf(Configuration.CrimeCodes, a)].setOffset(8, 12)) })
};
Map.FireMapMouseUp = function (a) {
    var b = null; if (document.createEvent) b = document.createEvent("MouseEvents"), b.initMouseEvent("mouseup", true, true, window, 0, 0, 0, a.pageX, a.pageY, false, false, false, false, 0, null); else if (document.createEventObject) b = document.createEventObject(), b.detail = 0, b.screenX = 0, b.screenY = 0, b.clientX = a.pageX, b.clientY = a.pageY, b.ctrlKey = false, b.altKey = false, b.shiftKey = false, b.metaKey = false, b.button = 0, b.relatedTarget = null; a = document.getElementById("map"); document.createEvent ? a.dispatchEvent(b) :
document.createEventObject && a.fireEvent("onmouseup", b)
};
function CaptureDefaultSearch() {
    var a = null, a = null, a = $("#inputCustomUrl").val() != null && $("#inputCustomUrl").val() != "" ? $("#inputCustomUrl").val() : window.location.search.substring(1); if (a != null && a != "") {
        Configuration.HasCustomUrl = true; a = new QueryString(a); if (a.get("db") != null && a.get("db") != "" && a.get("de") != null && a.get("de") != "") try {
            Configuration.SelectedDateBegin = new Date; Configuration.SelectedDateEnd = new Date; Configuration.SelectedDateBegin.setTime(Date.parse(a.get("db"))); Configuration.SelectedDateEnd.setTime(Date.parse(a.get("de")));
            var b = new Date; b.addDays(-180); if (Configuration.SelectedDateBegin < b) { Configuration.SelectedDateBegin = null; Configuration.SelectedDateEnd = null; alert("Sorry! It looks like this link has expired."); return } 
        } catch (c) { alert("Invalid format: Date Begin & Date End \r\n" + c.description) } if (a.get("ll") != null && a.get("ll") != "") Configuration.SelectedX = a.get("ll").split(",")[0], Configuration.SelectedY = a.get("ll").split(",")[1]; else if (a.get("x") != null && a.get("x") != "" && a.get("y") != null && a.get("y") != "") Configuration.SelectedX =
a.get("x"), Configuration.SelectedY = a.get("y"); else if (a.get("aid") != null && a.get("aid") != "") Configuration.SelectedAgencyID = a.get("aid"); else if (a.get("sid") != null && a.get("sid") != "") Configuration.SelectedStateID = a.get("sid"); else if (a.get("rid") != null && a.get("rid") != "") Configuration.SelectedRegionID = a.get("rid"); if (a.get("z") != null && a.get("z") != "") Configuration.SelectedZoomLevel = parseInt(a.get("z")); if (a.get("mc") != null && a.get("mc") != "") Configuration.SelectedMapCache = a.get("mc"); if (a.get("cc") != null &&
a.get("cc") != "") Configuration.SelectedCrimeCodes = a.get("cc"); if (a.get("loc") != null && a.get("loc") != "") Configuration.SelectedAddress = a.get("loc"), a.get("mll") != null && a.get("mll") != "" ? (Configuration.SelectedMeasureStartX = a.get("mll").split(",")[0], Configuration.SelectedMeasureStartY = a.get("mll").split(",")[1]) : Configuration.SelectedBufferRadius = a.get("br") != null && a.get("br") != "" ? a.get("br") : "1.0"; if (a.get("faid") != null && a.get("faid") != "") Configuration.SelectedFilterAgencyID = a.get("faid"); if (a.get("iid") !=
null && a.get("iid") != "") Configuration.SelectedCrimeID = a.get("iid"); a.get("mini") != null && a.get("mini") != "" && MapHelper.ToggleIconSizes()
    } 
} dojo.addOnLoad(Map.Initialize);
