function HtmlGenerator() { }
HtmlGenerator.BuildFilterAgencyTable = function (a, d) {
    var b = ""; if (a != void 0 && a != null && d != void 0 && d != null) {
        var c = HtmlGenerator.SortHashByDescription(d); if (AgencyFilterHelper.FilterAgencyID != null && AgencyFilterHelper.FilterAgencyID != "") b += '<option value="' + AgencyFilterHelper.FilterAgencyID + '">' + c[AgencyFilterHelper.FilterAgencyID].Description + ", " + c[AgencyFilterHelper.FilterAgencyID].StateAbbreviation + "</option>"; else {
            b += '<option value="">Only show crime reported by:</option>'; for (var e in c) a[e] != void 0 &&
a[e] != null && (b += '<option value="' + e + '">' + c[e].Description + ", " + c[e].StateAbbreviation + "</option>")
        } 
    } else b += AgencyFilterHelper.FilterAgencyID != null && AgencyFilterHelper.FilterAgencyID != "" ? '<option value="' + AgencyFilterHelper.FilterAgencyID + '">' + d[AgencyFilterHelper.FilterAgencyID].Description + ", " + d[AgencyFilterHelper.FilterAgencyID].StateAbbreviation + "</option>" : '<option value="">No agencies available</option>'; return b
};
HtmlGenerator.BuildAddressMarkerInfoWindow = function () {
    var a = ""; a += '<div class="address-info-window">'; a += '<a class="close-button" onclick="MapHelper.CloseInfoWindow();"></a>'; a += "<h4>" + $("#main-address-search").val() + "</h4>"; a += "<p>Search Radius: "; a += '<select id="address-info-window-radius-list" onchange="AddressFocusHelper.FocusCrimeAroundAddress($(\'#address-info-window-radius-list\').val(), AddressFocusHelper.AddressGraphic);">'; a += HtmlGenerator.BuildAddressMarkerInfoWindowOptions(); a += "</select>  ";
    $("#address-form-radius-list").val() != "0.0" && (a += '<a id="address-info-window-clear-buffer-button" class="link" onclick="AddressFocusHelper.RemoveAddressFocus();">Remove Radius</a>'); a += "</p></div>"; return a
};
HtmlGenerator.BuildAddressMarkerInfoWindowOptions = function () {
    var a, d = "miles", b = $("#address-form-radius-list").val(), c = CookieHelper.GetCookieData(); if (c != null && c != void 0) d = c.units; switch (d) {
        case "miles": a += '<option value="0.0" ' + (b == "0.0" ? " selected " : "") + ">None</option>"; a += '<option value="0.094696" ' + (b == "0.094696" ? " selected " : "") + ">500 feet</option>"; a += '<option value="0.2" ' + (b == "0.2" ? " selected " : "") + ">0.2 miles</option>"; a += '<option value="0.5" ' + (b == "0.5" ? " selected " : "") + ">0.5 miles</option>";
            a += '<option value="1.0" ' + (b == "1.0" ? " selected " : "") + ">1.0 mile</option>"; a += '<option value="2.0" ' + (b == "2.0" ? " selected " : "") + ">2.0 miles</option>"; break; case "kilometres": a += '<option value="0.0" ' + (b == "0.0" ? " selected " : "") + ">None</option>"; a += '<option value="0.0621371" ' + (b == "0.0621371" ? " selected " : "") + ">100 metres</option>"; a += '<option value="0.124274" ' + (b == "0.124274" ? " selected " : "") + ">0.2 kilometres</option>"; a += '<option value="0.310686" ' + (b == "0.310686" ? " selected " : "") + ">0.5 kilometres</option>";
            a += '<option value="0.621371" ' + (b == "0.621371" ? " selected " : "") + ">1.0 kilometre</option>"; a += '<option value="1.242742" ' + (b == "1.242742" ? " selected " : "") + ">2.0 kilometres</option>"; break; default: a += '<option value="0.0" ' + (b == "0.0" ? " selected " : "") + ">None</option>", a += '<option value="0.094696" ' + (b == "0.094696" ? " selected " : "") + ">500 feet</option>", a += '<option value="0.2" ' + (b == "0.2" ? " selected " : "") + ">0.2 miles</option>", a += '<option value="0.5" ' + (b == "0.5" ? " selected " : "") + ">0.5 miles</option>", a += '<option value="1.0" ' +
(b == "1.0" ? " selected " : "") + ">1.0 mile</option>", a += '<option value="2.0" ' + (b == "2.0" ? " selected " : "") + ">2.0 miles</option>"
    } return a
};
HtmlGenerator.BuildAddressFormRadiusList = function () {
    var a, d = "miles", b = CookieHelper.GetCookieData(); if (b != null && b != void 0) d = b.units; switch (d) {
        case "miles": a += '<option value="0.0" >None</option>'; a += '<option value="0.094696" >500 feet</option>'; a += '<option value="0.2" >0.2 miles</option>'; a += '<option value="0.5" >0.5 miles</option>'; a += '<option value="1.0" selected>1.0 mile</option>'; a += '<option value="2.0" >2.0 miles</option>'; break; case "kilometres": a += '<option value="0.0" >None</option>'; a += '<option value="0.0621371" >100 metres</option>';
            a += '<option value="0.124274" >0.2 kilometres</option>'; a += '<option value="0.310686" >0.5 kilometres</option>'; a += '<option value="0.621371" selected>1.0 kilometre</option>'; a += '<option value="1.242742" >2.0 kilometres</option>'; break; default: a += '<option value="0.0" >None</option>', a += '<option value="0.094696" >500 feet</option>', a += '<option value="0.2" >0.2 miles</option>', a += '<option value="0.5" >0.5 miles</option>', a += '<option value="1.0" selected>1.0 mile</option>', a += '<option value="2.0" >2.0 miles</option>'
    } return '<select id="address-form-radius-list">' +
a + "</select>"
};
HtmlGenerator.BuildAddressDistanceInfoWindow = function () {
    var a = ""; a += '<div class="address-info-window">'; a += '<a class="close-button" onclick="MapHelper.CloseInfoWindow();"></a>'; a += "<h4>" + AddressDistanceHelper.AddressText + "</h4>"; a += "<p>These points are " + AddressDistanceHelper.Distance + "</strong> " + (CookieHelper.HasCookie() && CookieHelper.GetCookieData().units == "kilometres" ? "kilometres" : "miles") + " apart.</p>"; a += '<p><a class="link" onclick="AddressDistanceHelper.RemovePolylineOverlay(); ">Remove Line</a></p>'; a +=
"</div>"; return a
}; HtmlGenerator.BuildAsCrowFliesHtml = function () { var a = ""; a += '<p class="address-finder">'; a += '<span id="address-finder-button"><a onclick="AddressDistanceHelper.ShowAddressDistanceFinder();">How close am I to this location?</a></span>'; a += HtmlGenerator.BuildAddressDistanceFinder(); a += "</p>"; return a };
HtmlGenerator.BuildAddressDistanceFinder = function () {
    var a = ""; a += '<span id="address-distance-finder-panel" style="display: none;">'; a += '   <span id="form">'; a += '       <input type="text" id="distance-finder-address" tabIndex="12" size="30" onkeypress="return UtilitiesHelper.CaptureEnterKey(event, \'#find-distance\');" '; a += AddressFocusHelper.AddressText != null && AddressFocusHelper.AddressText != "" ? ' value="' + AddressFocusHelper.AddressText + '" />' : "/>"; a += '       <input type="button" id="find-distance" tabIndex="13" onclick="AddressDistanceHelper.GetDistance();" value="Go" /><br/>';
    a += "   </span>"; a += '   <span id="iw-sample-address" class="ex">' + $("#main-sample-address").text() + "</span><br/>"; a += '   <span class="close"><a onclick="AddressDistanceHelper.HideAddressDistanceFinder(); AddressDistanceHelper.RemovePolylineOverlay(); $(\'#address-distance-button\').show();" tabIndex="14" style="cursor: pointer;">Clear?</a></span>'; a += "</span>"; return a
};
HtmlGenerator.BuildAgencyLinks = function (a, d) {
    var b = ""; if (a != void 0 && a != null && d != void 0 && d != null) {
        var c = d[a.AgencyID]; if (c != void 0 && c != null && c.AgencyLinks != void 0 && c.AgencyLinks != null) {
            b += '<div class="extra-links">'; b += '<p class="title"><a onclick="$(\'.extra-links ul\').slideToggle(function(){ MapHelper.UpdateInfoWindow(); });">' + c.Description + " Links</a></p>"; b += "<ul>"; for (var e = 0; e < c.AgencyLinks.length; e++) b += '<li><a target="_blank" href="' + c.AgencyLinks[e].Url + '">' + c.AgencyLinks[e].Description +
"</a></li>"; b += "</ul>"; b += "</div>"
        } 
    } return b
};
HtmlGenerator.BuildAgencyInfoWindowHtml = function (a) {
    html = '<div class="agency-window">'; html += '<a class="close-button" onclick="MapHelper.CloseInfoWindow();"></a>'; html += a.Url != null && a.Url != "" ? '<h4><a href="' + a.Url + '">' + a.Description + '</a>&nbsp;<a target="new" class="help-link" href="' + Configuration.WebRoot + 'help/help.aspx#agency-icon"><img src="' + Configuration.WebRoot + 'images/map/help.gif" alt="Help" title="Help" border="0" /></a></h4>' : "<h4>" + a.Description + '&nbsp;<a target="new" class="help-link" href="' +
Configuration.WebRoot + 'help/help.aspx#agency-icon"><img src="' + Configuration.WebRoot + 'images/map/help.gif" alt="Help" title="Help" border="0" /></a></h4>'; html += '<p><span class="total-crimes">' + a.CrimeCount + "</span> crimes between:</p>"; var d = new Date(UtilitiesHelper.FormatIncidentDate(a.LastIncidentDate)), d = new Date(d.getFullYear(), d.getMonth(), d.getDate() - Configuration.DefaultDateRange), b = new Date(UtilitiesHelper.FormatIncidentDate(a.LastIncidentDate)); html += '<p class="dates"><span>' + $.datepicker.formatDate("m/dd/yy",
d) + "</span> - <span>" + $.datepicker.formatDate("m/dd/yy", b) + "</span></p>"; html += "<p>Last crime reported on <strong>" + UtilitiesHelper.FormatIncidentDate(a.LastIncidentDate) + "</strong></p>"; html += '<ul class="action-menu">'; html += '<li><a onclick="Map.Map.infoWindow.hide(); MapHelper.ZoomToPointAndDate( ' + a.X + ", " + a.Y + ", " + a.Level + ", false, '" + $.datepicker.formatDate("m/dd/yy", b) + "');\">Zoom here</a></li>"; html += "</ul>"; html += "</div>"; return html
};
HtmlGenerator.BuildAgenciesList = function (a) {
    var d = "", b = null; if (a != void 0 && a != null && a.AgencyHashTable != void 0 && a.AgencyHashTable != null) {
        b = HtmlGenerator.SortHashByDescription(a.AgencyHashTable); d += '<select id="agency-list" onchange="MapHelper.JumpToAgency();">'; d += '<option value="">Choose an agency:</option>'; for (var c in b) UtilitiesHelper.FormatIncidentDate(b[c].LastIncidentDate), d += '<option value="' + b[c].X + "," + b[c].Y + "," + b[c].Level + "," + c + '">' + b[c].Description + ", " + b[c].StateAbbreviation + "</option>";
        d += "</select>"
    } return d
}; HtmlGenerator.SortHashByDescription = function (a) { var d = [], b; for (b in a) d.push([a[b].Description, a[b]]); d.sort(function (a, b) { return a < b ? -1 : a > b ? 1 : 0 }); a = []; for (b = 0; b < d.length; b++) a[d[b][1].AgencyID] = d[b][1]; return a };
HtmlGenerator.GetIncidentInfoWindowHtml = function (a, d) { var b = ""; a != void 0 && a != null && (b = a.length != void 0 && a.length != null && a.length > 1 ? HtmlGenerator.BuildTabbedIncidentInfoWindowHtml(a, d) : '<div class="incident-info-window" >' + HtmlGenerator.BuildIncidentInfoWindowHtml(a[0], d, true) + "</div>"); return b };
HtmlGenerator.BuildIncidentInfoWindowHtml = function (a, d, b) {
    var c = '<div class="details">', e = ""; Configuration.UsingLargeIcons ? (symbolUrl = Configuration.LargeLegendCrimeSymbols[dojo.indexOf(Configuration.CrimeCodes, a.CrimeCode)], e = "large") : (symbolUrl = Configuration.MiniLegendCrimeSymbols[dojo.indexOf(Configuration.CrimeCodes, a.CrimeCode)], e = "mini"); c += '<a class="close-button" onclick="MapHelper.CloseInfoWindow();"></a>'; c += '<h4 class="crime-type"><img src="' + symbolUrl + '" class="' + e + '" />' + a.CrimeCode + "</h4>";
    c += '<p><a class="link" onclick="javascript:MapHelper.ZoomToCrime(\'' + a.ObjectID + "')\">Zoom here</a></p>"; c += '<input id="info-window-object-id" type="hidden" value="' + a.ObjectID + '" />'; a.CaseNumber != null && a.CaseNumber != "" && (c += "<p><strong>Case Number: </strong>" + a.CaseNumber + "</p>"); a.DateReported != null && a.DateReported != "" && (c += "<p><strong>Date: </strong>" + UtilitiesHelper.FormatIncidentDate(a.DateReported) + "</p>"); a.Location != null && a.Location != "" && (c += "<p><strong>Location: </strong>" + a.Location + "</p>");
    a.Description != null && a.Description != "" && (c += "<p><strong>Description: </strong>" + a.Description + "</p>"); c += HtmlGenerator.BuildAgencyLinks(a, d); c += "</div>"; b && (c += HtmlGenerator.BuildAsCrowFliesHtml()); return c
};
HtmlGenerator.BuildTabbedIncidentInfoWindowHtml = function (a, d) {
    var b = '<div class="incident-info-window tabbed" >'; if (a != void 0 && a != null) for (var c = 0; c < a.length; c++) b += '<table id="iw_' + c.toString() + '" ', c > 0 && (b += ' style="display: none;" '), b += ">", b += '<tr><td colspan="2" >' + HtmlGenerator.BuildIncidentInfoWindowHtml(a[c], d, false) + "</td></tr>", b += "<tr>", b += '<td class="previous">', b += c > 0 ? '<a id="previous" onclick="MapHelper.ShowIncidentInfoWindowTab(\'table#iw_\', ' + (c - 1) + ');" alt="Previous" title="Previous"></a>' :
'<a id="previous" class="disabled"></a>', b += "</td>", b += '<td class="next">', b += c < a.length - 1 ? '<a id="next" onclick="MapHelper.ShowIncidentInfoWindowTab(\'table#iw_\', ' + (c + 1) + ');" alt="Next" title="Next" ></a>' : '<a id="next" class="disabled"></a>', b += "</td>", b += "</tr>", b += '<tr><td class="page-labels" colspan="2">' + (c + 1).toString() + " of " + a.length.toString() + "</td></tr>", b += "</table>"; b += HtmlGenerator.BuildAsCrowFliesHtml(); b += "</div>"; return b
};
