function UtilitiesHelper() { } UtilitiesHelper.OldWindowSize = null; UtilitiesHelper.CheckWindowSizeChanged = function () { var a = UtilitiesHelper.GetViewportSize(); return UtilitiesHelper.OldWindowSize == null || a[0] != UtilitiesHelper.OldWindowSize[0] || a[1] != UtilitiesHelper.OldWindowSize[1] ? (UtilitiesHelper.OldWindowSize = a, !0) : !1 };
UtilitiesHelper.AttachResizeEvents = function () { window.attachEvent ? window.attachEvent("onresize", function () { UtilitiesHelper.CheckWindowSizeChanged() && UtilitiesHelper.ResizeMap() }, !1) : window.addEventListener("resize", function () { UtilitiesHelper.ResizeMap() }, !1) };
UtilitiesHelper.ResizeMap = function () { var a = UtilitiesHelper.GetViewportWidth(), b = UtilitiesHelper.GetViewportHeight() - $(".header-wrapper").height() - $(".container-wrapper").height(); Map.Map != null && ($("#map").css({ height: b, width: a }), Map.Map.resize(), Map.Map.reposition()); UtilitiesHelper.MoveDidYouMeanPanel() }; UtilitiesHelper.GetViewportSize = function () { return [UtilitiesHelper.GetViewportHeight(), UtilitiesHelper.GetViewportWidth()] };
UtilitiesHelper.GetViewportWidth = function () { var a = 0; document.documentElement && document.documentElement.clientWidth ? a = document.documentElement.clientWidth : document.body && document.body.clientWidth ? a = document.body.clientWidth : window.innerWidth && (a = window.innerWidth - 18); return a };
UtilitiesHelper.GetViewportHeight = function () { var a = 0; document.documentElement && document.documentElement.clientHeight ? a = document.documentElement.clientHeight : document.body && document.body.clientHeight ? a = document.body.clientHeight : window.innerHeight && (a = window.innerHeight - 18); return a }; UtilitiesHelper.CheckAllCrimeTypes = function () { $(".check-box-form input[name='crime-types-check-list']").each(function () { $(this).attr({ checked: !0 }) }) }; UtilitiesHelper.UncheckAllCrimeTypes = function () { $(".check-box-form input[name='crime-types-check-list']").each(function () { $(this).attr({ checked: !1 }) }) };
UtilitiesHelper.FixCheckedCrimeTypes = function () {
    var a = !1, b = 0; $(".check-box-form input[name='crime-types-check-list']").each(function () { $(this).attr("checked") && (a = !0, b++) }); a ? (b == 15 ? $("a#check-all").unbind("click").addClass("disabled") : $("a#check-all").bind("click", function () { UtilitiesHelper.CheckAllCrimeTypes(); MapHelper.GetCrimes(); UtilitiesHelper.FixCheckedCrimeTypes() }).removeClass("disabled"), $("a#uncheck-all").bind("click", function () {
        UtilitiesHelper.UncheckAllCrimeTypes(); MapHelper.GetCrimes();
        UtilitiesHelper.FixCheckedCrimeTypes()
    }).removeClass("disabled")) : ($("a#uncheck-all").unbind("click").addClass("disabled"), $("a#check-all").bind("click", function () { UtilitiesHelper.CheckAllCrimeTypes(); MapHelper.GetCrimes(); UtilitiesHelper.FixCheckedCrimeTypes() }).removeClass("disabled"))
}; UtilitiesHelper.Bookmark = function (a, b) { document.all ? window.external.AddFavorite(a, b) : window.sidebar ? window.sidebar.addPanel(b, a, "") : alert("It appears your browser does not support an automatic bookmarking feature.") };
UtilitiesHelper.BuildEmailDialog = function (a, b) { var c = "Hello!  You've just received a CrimeMapping report email from a friend.%0A%0A"; c += "To view the report click the link below:%0A%0A"; c += a; alert(a); window.location = "mailto:?body=" + c + "&subject=" + b }; UtilitiesHelper.CaptureEnterKey = function (a, b) { if (navigator.appName.indexOf("Netscape") > -1 && a.keyCode == 13) return $(b).click(), !1; if (navigator.appName.indexOf("Microsoft Internet Explorer") > -1 && event.keyCode == 13) return $(b).click(), !1 };
UtilitiesHelper.FormatIncidentDate = function (a) { var b = "", c = "", d = "", e = "", f = "AM", b = ""; a != void 0 && a != null ? (b = a.substr(0, 4), d = a.substr(5, 2), c = a.substr(8, 2), e = a.substr(11, 2), minute = a.substr(14, 2), e.indexOf("0") == 0 && (e = e.substr(1, 1)), e = parseInt(e, 10), e >= 12 ? (e > 12 && (e -= 12), f = "PM") : e == 0 && (e = 12, f = "AM"), d.indexOf("0") == 0 && (d = d.substr(1, 1)), c.indexOf("0") == 0 && (c = c.substr(1, 1)), b = d + "/" + c + "/" + b + " " + e + ":" + minute + " " + f) : b = "null"; return b };
UtilitiesHelper.ToggleFilterFormImages = function (a) {
    var b = "", c = "", d = "", e = "", f = ""; a ? (b = Configuration.WebRoot + "images/map/crime-types/legend/", d = c = "24", f = e = "28") : (b = Configuration.WebRoot + "images/map/crime-types/legend/mini/", d = c = "13", e = "15", f = "16"); $("#cbxArsonImage").attr({ src: b + "arson.png", height: c, width: d }); $("#cbxAssaultImage").attr({ src: b + "assault.png", height: c, width: d }); $("#cbxBurglaryImage").attr({ src: b + "burglary.png", height: c, width: d }); $("#cbxDisturbingThePeaceImage").attr({ src: b + "disturbing-the-peace.png",
        height: c, width: d
    }); $("#cbxDrugAlcoholViolationsImage").attr({ src: b + "drugs-alcohol-violations.png", height: c, width: d }); $("#cbxDUIImage").attr({ src: b + "dui.png", height: c, width: d }); $("#cbxFraudImage").attr({ src: b + "fraud.png", height: c, width: d }); $("#cbxHomicideImage").attr({ src: b + "homicide.png", height: c, width: d }); $("#cbxMotorVehicleTheftImage").attr({ src: b + "motor-vehicle-theft.png", height: c, width: d }); $("#cbxRobberyImage").attr({ src: b + "robbery.png", height: c, width: d }); $("#cbxSexCrimesImage").attr({ src: b + "sex-crimes.png",
        height: c, width: d
    }); $("#cbxTheftLarcenyImage").attr({ src: b + "theft-larceny.png", height: c, width: d }); $("#cbxVandalismImage").attr({ src: b + "vandalism.png", height: c, width: d }); $("#cbxVehicleBreakInTheftImage").attr({ src: b + "vehicle-break-in-theft.png", height: c, width: d }); $("#cbxWeaponsImage").attr({ src: b + "weapons.png", height: c, width: d }); $("#imgMultipleCrimes").attr({ src: b + "multiple-crimes-092911.png", height: e, width: f })
};
UtilitiesHelper.MoveDidYouMeanPanel = function () { $("#did-you-mean-panel").css("display") == "block" && UtilitiesHelper.ShowDidYouMeanPanel() }; UtilitiesHelper.ShowDidYouMeanPanel = function () { var a = $("#main-address-search").offset(), b = $("#main-address-search").parent().height(); $("#did-you-mean-panel").width(); b = a.top + b; a = a.left; jQuery.browser.msie ? (b -= 13, a -= 9) : (b -= 13, a -= 10); $("#did-you-mean-panel").css({ position: "absolute", top: b, left: a }).show() };
UtilitiesHelper.ConvertMilesToKilometres = function (a) { return Math.round(a * 16.09344) / 10 }; UtilitiesHelper.IsDate = function (a) { return null != a && !isNaN(a) && "undefined" !== typeof a.getDate }; Date.prototype.addDays = function (a) { this.setDate(this.getDate() + a) };
UtilitiesHelper.SetDateBoundaries = function (a, b) { $("#inputStartDate").datepicker("option", "maxDate", b); $("#inputEndDate").datepicker("option", "minDate", a); $(".date-form .start .example").text($.datepicker.formatDate("DD, d MM, yy", a)); $(".date-form .end .example").text($.datepicker.formatDate("DD, d MM, yy", b)) };
