PageSourceSearch

https://business.orangechamber.com/Content/bundles/MNI?v=34V3-w6z5bLW9Yl7pjO3C5tja0TdKeHFrpRQ0eCPbz81

js orangechamber.com collected 2026-09-29 17:21:24 UTC 69,646 bytes, 1,619 lines download raw bytes

1/* Minification failed. Returning unminified contents.
2(502,32-33): run-time error JS1195: Expected expression: )
3(502,35-36): run-time error JS1195: Expected expression: >
4(503,43-44): run-time error JS1195: Expected expression: )
5(503,46-47): run-time error JS1195: Expected expression: >
6(512,18-19): run-time error JS1195: Expected expression: ,
7(512,35-36): run-time error JS1003: Expected ':': )
8(515,9-10): run-time error JS1002: Syntax error: }
9(516,30-31): run-time error JS1195: Expected expression: )
10(516,32-33): run-time error JS1004: Expected ';': {
11(518,10-11): run-time error JS1195: Expected expression: ,
12(519,41-42): run-time error JS1004: Expected ';': {
13(524,5-6): run-time error JS1002: Syntax error: }
14(526,58-59): run-time error JS1004: Expected ';': {
15(1560,1-2): run-time error JS1002: Syntax error: }
16(1566,25-26): run-time error JS1004: Expected ';': {
17(1600,2-3): run-time error JS1195: Expected expression: )
18 */
19/*
20 * jQuery MultiSelect UI Widget 1.12
21 * Copyright (c) 2011 Eric Hynds
22 *
23 * http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
24 *
25 * Depends:
26 *   - jQuery 1.4.2+
27 *   - jQuery UI 1.8 widget factory
28 *
29 * Optional:
30 *   - jQuery UI effects
31 *   - jQuery UI position utility
32 *
33 * Dual licensed under the MIT and GPL licenses:
34 *   http://www.opensource.org/licenses/mit-license.php
35 *   http://www.gnu.org/licenses/gpl.html
36 *
37 */
38
39var MNI = MNI || {};
40
41/* in SEO4 we use Select2*/
42if (MNI.jQuery.widget) {
43    (function (d) { var j = 0; d.widget("ech.multiselect", { options: { header: !0, height: 175, minWidth: 225, classes: "", checkAllText: "Check all", uncheckAllText: "Uncheck all", noneSelectedText: "Select options", selectedText: "# selected", selectedList: 0, show: "", hide: "", autoOpen: !1, multiple: !0, position: {} }, _create: function () { var a = this.element.hide(), b = this.options; this.speed = d.fx.speeds._default; this._isOpen = !1; a = (this.button = d('<button type="button"><span class="ui-icon ui-icon-triangle-2-n-s"></span></button>')).addClass("ui-multiselect ui-widget ui-state-default ui-corner-all").addClass(b.classes).attr({ title: a.attr("title"), "aria-haspopup": !0, tabIndex: a.attr("tabIndex") }).insertAfter(a); (this.buttonlabel = d("<span />")).html(b.noneSelectedText).appendTo(a); var a = (this.menu = d("<div />")).addClass("ui-multiselect-menu ui-widget ui-widget-content ui-corner-all").addClass(b.classes).appendTo(document.body), c = (this.header = d("<div />")).addClass("ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix").appendTo(a); (this.headerLinkContainer = d("<ul />")).addClass("ui-helper-reset").html(function () { return !0 === b.header ? '<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>' + b.checkAllText + '</span></a></li><li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>' + b.uncheckAllText + "</span></a></li>" : "string" === typeof b.header ? "<li>" + b.header + "</li>" : "" }).append('<li class="ui-multiselect-close"><a href="#" class="ui-multiselect-close"><span class="ui-icon ui-icon-circle-close"></span></a></li>').appendTo(c); (this.checkboxContainer = d("<ul />")).addClass("ui-multiselect-checkboxes ui-helper-reset").appendTo(a); this._bindEvents(); this.refresh(!0); b.multiple || a.addClass("ui-multiselect-single") }, _init: function () { !1 === this.options.header && this.header.hide(); this.options.multiple || this.headerLinkContainer.find(".ui-multiselect-all, .ui-multiselect-none").hide(); this.options.autoOpen && this.open(); this.element.is(":disabled") && this.disable() }, refresh: function (a) { var b = this.element, c = this.options, e = this.menu, h = this.checkboxContainer, g = [], f = [], i = b.attr("id") || j++; b.find("option").each(function (b) { d(this); var a = this.parentNode, e = this.innerHTML, h = this.title, j = this.value, b = this.id || "ui-multiselect-" + i + "-option-" + b, k = this.disabled, m = this.selected, l = ["ui-corner-all"]; "optgroup" === a.tagName.toLowerCase() && (a = a.getAttribute("label"), -1 === d.inArray(a, g) && (f.push('<li class="ui-multiselect-optgroup-label"><a href="#">
43' + a + "</a></li>"), g.push(a))); k && l.push("ui-state-disabled"); m && !c.multiple && l.push("ui-state-active"); f.push('<li class="' + (k ? "ui-multiselect-disabled" : "") + '">'); f.push('<label for="' + b + '" title="' + h + '" class="' + l.join(" ") + '">'); f.push('<input id="' + b + '" name="multiselect_' + i + '" type="' + (c.multiple ? "checkbox" : "radio") + '" value="' + j + '" title="' + e + '"'); m && (f.push(' checked="checked"'), f.push(' aria-selected="true"')); k && (f.push(' disabled="disabled"'), f.push(' aria-disabled="true"')); f.push(" /><span>" + e + "</span></label></li>") }); h.html(f.join("")); this.labels = e.find("label"); this._setButtonWidth(); this._setMenuWidth(); this.button[0].defaultValue = this.update(); a || this._trigger("refresh") }, update: function () { var a = this.options, b = this.labels.find("input"), c = b.filter("[checked]"), e = c.length, a = 0 === e ? a.noneSelectedText : d.isFunction(a.selectedText) ? a.selectedText.call(this, e, b.length, c.get()) : /\d/.test(a.selectedList) && 0 < a.selectedList && e <= a.selectedList ? c.map(function () { return d(this).next().text() }).get().join(", ") : a.selectedText.replace("#", e).replace("#", b.length); this.buttonlabel.html(a); return a }, _bindEvents: function () { function a() { b[b._isOpen ? "close" : "open"](); return !1 } var b = this, c = this.button; c.find("span").bind("click.multiselect", a); c.bind({ click: a, keypress: function (a) { switch (a.which) { case 27: case 38: case 37: b.close(); break; case 39: case 40: b.open() } }, mouseenter: function () { c.hasClass("ui-state-disabled") || d(this).addClass("ui-state-hover") }, mouseleave: function () { d(this).removeClass("ui-state-hover") }, focus: function () { c.hasClass("ui-state-disabled") || d(this).addClass("ui-state-focus") }, blur: function () { d(this).removeClass("ui-state-focus") } }); this.header.delegate("a", "click.multiselect", function (a) { if (d(this).hasClass("ui-multiselect-close")) b.close(); else b[d(this).hasClass("ui-multiselect-all") ? "checkAll" : "uncheckAll"](); a.preventDefault() }); this.menu.delegate("li.ui-multiselect-optgroup-label a", "click.multiselect", function (a) { a.preventDefault(); var c = d(this), g = c.parent().nextUntil("li.ui-multiselect-optgroup-label").find("input:visible:not(:disabled)"), f = g.get(), c = c.parent().text(); !1 !== b._trigger("beforeoptgrouptoggle", a, { inputs: f, label: c }) && (b._toggleChecked(g.filter("[checked]").length !== g.length, g), b._trigger("optgrouptoggle", a, { inputs: f, label: c, checked: f[0].checked })) }).delegate("label", "mouseenter.multiselect", function () { d(this).hasClass("ui-state-disabled") || (b.labels.removeClass("ui-state-hover"), d(this).addClass("ui-state-hover").find("input").focus()) }).delegate("label", "keydown.multiselect", function (a) { a.preventDefault(); switch (a.which) { case 9: case 27: b.close(); break; case 38: case 40: case 37: case 39: b._traverse(a.which, this); break; case 13: d(this).find("input")[0].click() } }).delegate('input[type="checkbox"], input[type="radio"]', "click.multiselect", function (a) { var c = d(this), g = this.value, f = this.checked, i = b.element.find("option"); this.disabled || !1 === b._trigger("click", a, { value: g, text: this.title, checked: f }) ? a.preventDefault() : (c.focus(), c.attr("aria-selected", f), i.each(function () { if (this.value === g) this.selected = f; else if (!b.options.multiple) this.selected = !1 }), b.options.multiple || (b.labels.removeClass("ui-state-active"), c.closest("label").toggleClass("ui-state-active", f), b.close()), b.element.trigger("change"), setTimeout(d.proxy(b.update, b), 10)) }); d(document).bind("mousedown.multiselect", function (a) { b._isOpen && !d.contains(b.menu[0], a.target) && !d.contains(b.button[0], a.target) && a.target !== b.button[0] && b.close() }); d(this.element[0].form).bind("reset.multiselect", function () { setTimeout(d.proxy(b.refresh, b), 10) }) }, _setButtonWidth: function () { var a = this.element.outerWidth(), b = this.options; if (/\d/.test(b.minWidth) && a < b.minWidth) a = b.minWidth; this.button.width(a) }, _setMenuWidth: function () { var a = this.menu, b = this.button.outerWidth() - parseInt(a.css("padding-left"), 10) - parseInt(a.css("padding-right"), 10) - parseInt(a.css("border-right-width"), 10) - parseInt(a.css("border-left-width"), 10); a.width(b || this.button.outerWidth()) }, _traverse: function (a, b) { var c = d(b), e = 38 === a || 37 === a, c = c.parent()[e ? "prevAll" : "nextAll"]("li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)")[e ? "last" : "first"](); c.length ? c.find("label").trigger("mouseover") : (c = this.menu.find("ul").last(), this.menu.find("label")[e ? "last" : "first"]().trigger("mouseover"), c.scrollTop(e ? c.height() : 0)) }, _toggleState: function (a, b) { return function () { this.disabled || (this[a] = b); b ? this.setAttribute("aria-selected", !0) : this.removeAttribute("aria-selected") } }, _toggleChecked: function (a, b) { var c = b && b.length ? b : this.labels.find("input"), e = this; c.each(this._toggleState("checked", a)); c.eq(0).focus(); this.update();
43 var h = c.map(function () { return this.value }).get(); this.element.find("option").each(function () { !this.disabled && -1 < d.inArray(this.value, h) && e._toggleState("selected", a).call(this) }); c.length && this.element.trigger("change") }, _toggleDisabled: function (a) { this.button.attr({ disabled: a, "aria-disabled": a })[a ? "addClass" : "removeClass"]("ui-state-disabled"); this.menu.find("input").attr({ disabled: a, "aria-disabled": a }).parent()[a ? "addClass" : "removeClass"]("ui-state-disabled"); this.element.attr({ disabled: a, "aria-disabled": a }) }, open: function () { var a = this.button, b = this.menu, c = this.speed, e = this.options; if (!(!1 === this._trigger("beforeopen") || a.hasClass("ui-state-disabled") || this._isOpen)) { var h = b.find("ul").last(), g = e.show, f = a.offset(); d.isArray(e.show) && (g = e.show[0], c = e.show[1] || this.speed); h.scrollTop(0).height(e.height); d.ui.position && !d.isEmptyObject(e.position) ? (e.position.of = e.position.of || a, b.show().position(e.position).hide().show()) : b.css({ top: f.top + a.outerHeight(), left: f.left }).show(); this.labels.eq(0).trigger("mouseover").trigger("mouseenter").find("input").trigger("focus"); a.addClass("ui-state-active"); this._isOpen = !0; this._trigger("open") } }, close: function () { if (!1 !== this._trigger("beforeclose")) { var a = this.options, b = a.hide, c = this.speed; d.isArray(a.hide) && (b = a.hide[0], c = a.hide[1] || this.speed); this.menu.hide(); this.button.removeClass("ui-state-active").trigger("blur").trigger("mouseleave"); this._isOpen = !1; this._trigger("close") } }, enable: function () { this._toggleDisabled(!1) }, disable: function () { this._toggleDisabled(!0) }, checkAll: function () { this._toggleChecked(!0); this._trigger("checkAll") }, uncheckAll: function () { this._toggleChecked(!1); this._trigger("uncheckAll") }, getChecked: function () { return this.menu.find("input").filter("[checked]") }, destroy: function () { d.Widget.prototype.destroy.call(this); this.button.remove(); this.menu.remove(); this.element.show(); return this }, isOpen: function () { return this._isOpen }, widget: function () { return this.menu }, _setOption: function (a, b) { var c = this.menu; switch (a) { case "header": c.find("div.ui-multiselect-header")[b ? "show" : "hide"](); break; case "checkAllText": c.find("a.ui-multiselect-all span").eq(-1).text(b); break; case "uncheckAllText": c.find("a.ui-multiselect-none span").eq(-1).text(b); break; case "height": c.find("ul").last().height(parseInt(b, 10)); break; case "minWidth": this.options[a] = parseInt(b, 10); this._setButtonWidth(); this._setMenuWidth(); break; case "selectedText": case "selectedList": case "noneSelectedText": this.options[a] = b; this.update(); break; case "classes": c.add(this.button).removeClass(this.options.classes).addClass(b) }d.Widget.prototype._setOption.apply(this, arguments) } }) })(MNI.jQuery);
44}
45
46(function ($, undefined) {
47
48    // Generic helpers
49
50    function redirectTo(absolutePath) {
51        window.location = MNI.BaseUrl + absolutePath;
52    };
53
54    // Popup window opening
55
56    function openAsWindow(element, width, height, resizable, scrollbars, menubar, toolbar, location) {
57        var href = $(element).attr('href'),
58            target = $(element).attr('target'),
59            features =
60                'resizable=' + resizable +
61                ',scrollbars=' + scrollbars +
62                ',menubar=' + menubar +
63                ',toolbar=' + toolbar +
64                ',location=' + location;
65
66        if (width !== undefined)
67            features = features + ',width=' + width;
68
69        if (height !== undefined)
70            features = features + ',height=' + height;
71
72        return window.open(href, target, features);
73    };
74
75    function openAsWindowDefault(element) {
76        return openAsWindow(element, 640, 435, 1, 1, 1, 0, 0);
77    };
78
79    function openAsWindowDefaultRefer(element) {
80        return openAsWindow(element, 580, 435, 1, 1, 0, 0, 0);
81    };
82
83    function openAsResponsive(element, resizable, scrollbars, menubar, toolbar, location) {
84        var height = window.screen.height * 0.75,
85            fullWidth = window.screen.width,
86            width = fullWidth >= 1376 ? 1280 :
87                fullWidth >= 1200 ? 1024 :
88                fullWidth >= 992 ? 800 :
89                null;
90
91        if (width)
92            return openAsWindow(element, width, height, resizable, scrollbars, menubar, toolbar, location);
93    };
94
95    function openNewWindow(absolutePath) {
96        window.open(MNI.BaseUrl + absolutePath);
97    };
98
99    var printFrame;
100
101    var windows = {
102        HotDeals: openAsWindowDefault,
103        MemberHotDeals: openAsWindowDefault,
104        Jobs: openAsWindowDefault,
105        VacancyInternal: function (element) {
106            return openAsWindow(element, 650, 500, 1, 1, 0, 1, 1);
107        },
108        VacancyExternal: function (element) {
109            return openAsWindow(element, 650, 500, 1, 1, 1, 1, 1);
110        },
111        ReferMember: openAsWindowDefaultRefer,
112        ContactMember: openAsWindowDefault,
113        ReferEvent: openAsWindowDefaultRefer,
114        ReferJob: openAsWindowDefaultRefer,
115        ReferMarketSpaceItem: openAsWindowDefaultRefer,
116        RegisterEvent: function (element) {
117            return openAsResponsive(element, 1, 1, 1, 0, 0);
118        },
119        EventPhoto: function (element, width, height) {
120            return openAsWindow(element, width + 30, height + 40, 1, 1, 0, 0, 0);
121        },
122        MemberPdf: function (element) {
123            return openAsWindow(element, undefined, undefined, 1, 1, 1, 0, 0);
124        },
125        Print: function (element) {
126            var printWindow = window.open($(element).attr('href'));
127            printWindow.closeMe = function () {
128                printWindow.close();
129            };
130            return true;
131        }
132    };
133
134    // Hit statistics modules
135
136    function logHitStat(type, id) {
137        return $.get(MNI.BaseUrl + '/hitstats/' + type + '/' + id);
138    };
139
140    var hitStats = {
141        MemberMap: function (memid) {
142            logHitStat("mbrmap", memid);
143        },
144        MemberWebsite: function (memid) {
145            logHitStat("mbrws", memid);
146        },
147        MarketWebsiteOffer: function (itemid) {
148            logHitStat("mrktwso", itemid);
149        },
150        MarketWebsiteDetail: function (itemid) {
151            logHitStat("mrktwsd", itemid);
152        }
153    };
154
155    // Path lookup helpers
156
157    var paths = {
158        Category: function (slug) {
159            return '/' + this._getMemberFilter() + '/category/' + slug;
160        },
161        QuickLink: function (slug) {
162            return '/' + this._getMemberFilter() + '/QL/' + slug;
163        },
164        Member: function (slug) {
165            return '/' + this._getMemberFilter() + '/member/' + slug;
166        },
167        MemberMapGeoInfo: function (id) {
168            return '/' + this._getMemberFilter() + '/GetGeoInfo?memId=' + id;
169        },
170        MemberMapPinInfo: function (id) {
171            return '/' + this._getMemberFilter() + '/MemberMapPinInfo/' + id;
172        },
173        GeoInfoForMapMembers: function () {
174            return '/' + this._getMemberFilter() + '/GetGeoInfoForMapMembers';
175        },
176        SEO3Plugins: function (path) {
177            return '/Content/SEO3/plugins/' + (path || '');
178        },
179        Scripts: function (path) {
180            return '/Content/Script/' + (path || '');
181        },
182        MemberKeywordSearch: function(keyword) {
183            return '/' + this._getMemberFilter() + '/search?q=' + encodeURIComponent(keyword);
184        },
185        ContactFriend: function (itemType, itemId) {
186            return '/inforeq/contactfriend?itemtype=' + itemType + '&itemid=' + itemId;
187        },
188        _getMemberFilter: function() {
189           return (MNI.Page && MNI.Page.MemberFilter) || 'list';
190    }
191    };
192
193    var preventDuplicateSubmissions = function (formSelector) {
194        $(document).on('invalid-form.validate', formSelector, function () {
195            var button = $(this).find('input[type="submit"]');
196            setTimeout(function () {
197                button.removeAttr('disabled');
198            }, 1);
199        });
200        $(document).on('submit', formSelector, function () {
201            var button = $(this).find('input[type="submit"]');
202            setTimeout(function () {
203                button.attr('disabled', 'disabled');
204            }, 0);
205        });
206    }
207
208    $.fn.scrollTo = function (duration, callback) {
209        $('html, body').animate({
210            scrollTop: $(this).offset().top
211        }, duration, callback);
212    };
213
214    // Autocomplete for directory searches
215
216    var autoComplete = {
217        Defaults: {
218            limit: 10
219        },
220        Init: function (selector, options) {
221            var opts = $.extend({}, autoComplete.Defaults, options),
222                elements = $(selector);
223
224            if (!elements.length)
225                return;
226
227            // CM-2567 - in the newer version of jQuery, data-autocomplete is not initialized
228            if (!elements.data('autocomplete'))
229                elements.data('autocomplete', {});
230
231            function getRawParams() {
232                return $.isFunction(opts.rawParams) ?
233                    opts.rawParams.apply(this, []) :
234                    opts.rawParams;
235            };
236
237            function addParams(url, rawParams) {
238                if (rawParams)
239                    url += (url.indexOf('?') < 0 ? '?' : '&') + rawParams;
240
241                return url;
242            };
243
244            elements.autocomplete({
245                source: function (request, response) {
246                    var $this = $(this),
247                        store = $this.data('MNI_Autocomplete');
248
249                    if (!store)
250                        $this.data('MNI_Autocomplete', store = { cache: {} });
251
252                    var term = request.term,
253                        params = $.isFunction(opts.params) ? opts.params.apply(this, []) : opts.params,
254                        paramsRaw = getRawParams(),
255                        paramData = $.param(params || {}),
256                        requestData = $.param({ q: term, limit: opts.limit }),
257                        cachedItem;
258
259                    if (paramData)
260                        requestData = [requestData, paramData].join('&');
261
262                    if (paramsRaw)
263                        requestData = [requestData, paramsRaw].join('&');
264
265                    cachedItem = store.cache[requestData];
266
267                    if (cachedItem) {
268                        response(cachedItem);
269                    } else {
270                        store.lastXhr = $.getJSON(
271                            MNI.BaseUrl + opts.path,
272                            requestData,
273                            function (data, status, xhr) {
274                                if (data) {
275                                    $.each(data, function (index, item) {
276                                        item.value = item.label = item.Name;
277                                    });
278                                }
279                                store.cache[requestData] = data;
280                                if (xhr === store.lastXhr) {
281                                    response(data);
282                                    delete store.lastXhr;
283                                }
284                            }
285                        );
286                    }
287                },
288                select: function (event, ui) {
289                    $(this).val(ui.item.Name);
290                    
291                    var openInNewWindow = MNI.Page.MemberPagePopup,
292                        doAction = openInNewWindow ? openNewWindow : redirectTo;
293
294                    switch (ui.item.ResultType) {
295                        case 1: // AutocompleteSearchResultType.Category
296                            doAction(addParams(paths.Category(ui.item.SlugWithI
296D), getRawParams()));
297                            break;
298                        case 2: // AutocompleteSearchResultType.QuickLink
299                            doAction(addParams(paths.QuickLink(ui.item.SlugWithID), getRawParams()));
300                            break;
301                        case 3: // AutocompleteSearchResultType.Member
302                            if (ui.item.MemberPageAction == 1) 
303                            {
304                                logHitStat("mbrws", ui.item.ID).then( function () {
305                                var location = ui.item.WebParticipation < 10 ?
306                                    paths.MemberKeywordSearch(ui.item.Name) :
307                                    paths.Member(ui.item.SlugWithID);
308                                doAction(location);
309                                });
310                            }
311                            else
312                            {
313                                var location = ui.item.WebParticipation < 10 ?
314                                    paths.MemberKeywordSearch(ui.item.Name) :
315                                    paths.Member(ui.item.SlugWithID);
316                                doAction(location);
317                            }
318                            break;
319                    }
320
321                    return false;
322                }
323            });
324
325            elements.data('ui-autocomplete')._renderItem = function (ul, item) {
326                $(ul).css({'z-index': 1000});
327                var name = $('<span></span>').addClass('mn-autocomplete-name').text(item.Name),
328                    type = $('<span></span>').addClass('mn-autocomplete-type'),
329                    link = $('<a></a>').addClass('mn-autocomplete').append(name).append('<br />').append(type);
330
331                switch (item.ResultType) {
332                    case 1: // AutocompleteSearchResultType.Category
333                        type.text('Category');
334                        break;
335                    case 2: // AutocompleteSearchResultType.QuickLink
336                        type.text('Quicklink');
337                        break;
338                    case 3: // AutocompleteSearchResultType.Member
339                        type.text('Type' in item ? (item.Type || '') : 'Member');
340                        if (item.WebParticipation >= 30) // WebParticipation.Gold
341                            link.addClass('mn-autocomplete-membergold');
342                        break;
343                }
344
345                return $('<li></li>')
346                    .data('item.autocomplete', item)
347                    .append(link)
348                    .appendTo(ul);
349            };
350        }
351    };
352
353    function getMapContentBasic(info) {
354        var mapMember = $('<div class="mn-map-member"></div>'),
355            mapInfo = $('<div class="mn-map-info"></div>').appendTo(mapMember);
356
357        if (info.Name)
358            $('<div class="mn-map-title"></div>').text(info.Name).appendTo(mapInfo);
359
360        if (info.Address)
361            $('<div class="mn-map-address"></div>').text(info.Address).appendTo(mapInfo);
362
363        if (info.City || info.State || info.Zip) {
364            var cszElement = $('<div class="mn-map-citystatezip"></div>').appendTo(mapInfo);
365
366            if (info.City)
367                $('<span class="mn-map-cityspan"></span>').text(info.City).appendTo(cszElement);
368
369            if (info.City && info.State)
370                $('<span class="mn-map-commaspan"></span>').text(', ').appendTo(cszElement);
371
372            if (info.State)
373                $('<span class="mn-map-stspan"></span>').text(info.State).appendTo(cszElement);
374
375            if (info.Zip && (info.City || info.State))
376                cszElement.append(document.createTextNode(' '));
377
378            if (info.Zip)
379                $('<span class="mn-map-zipspan"></span>').text(info.Zip).appendTo(cszElement);
380        }
381
382        if (info.Phone)
383            $('<div class="mn-map-phone"></div>').text(info.Phone).appendTo(mapInfo);
384
385        $('<div class="mn-clear"></div>').appendTo(mapMember);
386
387        return mapMember[0];
388    };
389
390    function createMapDialog(memid, title) {
391
392        var self = this,
393            data = self._mapData;
394
395        if (!data.isInitialized) {
396            var container = $('<div></div>').attr('id', 'mn-dialog-member-map').height(400).addClass('mn-reset');
397            data.dialog = $('<div></div>').append(container);
398
399            data.mapObj = new google.maps.Map(container[0], {
400                mapTypeId: google.maps.MapTypeId.ROADMAP,
401                scaleControl: true,
402                minZoom: 5,
403                zoom: 8
404            });
405
406            data.dialog.dialog({
407                title: name,
408                width: 600,
409                resizable: false
410            });
411
412            data.isInitialized = true;
413        }
414
415        if (data.marker) {
416            data.marker.setMap(null);
417            data.marker = null;
418        }
419
420        if (data.infoWindow) {
421            data.infoWindow.setMap(null);
422            data.infoWindow = null;
423        }
424
425        data.dialog.dialog({ title: title });
426
427        $.getJSON(MNI.BaseUrl + paths.GeoInfoForMapMembers(), { memId: memid }, function (results) {
428            var info = results[0],
429                point = new google.maps.LatLng(info.Lat, info.Lon);
430
431            data.marker = new google.maps.Marker({
432                map: data.mapObj,
433                position: point,
434                title: title,
435                icon: MNI.BaseUrl + '/Content/Images/map/greenpin.png'
436            });
437
438            google.maps.event.addListener(data.marker, 'click', function () {
439                function openInfoWindow(content) {
440                    if (!data.infoWindow) {
441                        data.infoWindow = new google.maps.InfoWindow({
442                            content: content,
443                            maxWidth: 350
444                        });
445                    }
446                    data.infoWindow.open(data.mapObj, data.marker);
447                };
448
449                if (info.Upg) {
450                    $.ajax({
451                        url: MNI.BaseUrl + MNI.Path.MemberMapPinInfo(memid),
452                        success: function (html) {
453                            var content = $(html);
454                            content.find('.mn-actiondetails').remove();
455                            openInfoWindow(content[0]);
456                        },
457                        error: function () {
458                            openInfoWindow(getMapContentBasic(info));
459                        }
460                    });
461                }
462                else {
463                    openInfoWindow(getMapContentBasic(info));
464                }
465            });
466
467            data.mapObj.setCenter(point);
468            data.mapObj.setZoom(13);
469        });
470    };
471
472    function contactFriendDialog(url) {
473        this._url = url;
474    };
475
476    function showSuccess(self) {
477        var content = "<p>Your message has been sent to your friend's email address.</p>";
478        self._updateButtons(function (buttons) { buttons[1].text = 'Close Window'; buttons.splice(0, 1); });
479        self._container.dialog({ position: { 'my': 'center', 'at': 'center' } });
480        self._container.html(content);
481    }
482    function showFailure(self, response) {
483        var $stage = $('<div></div>');
484        grecaptcha.reset();
485        $stage.html(response);
486        var $errorBox = self._container.find('.validation-summary-errors');
487        if ($errorBox[0]) $errorBox.remove();
488
489        self._container.prepend($stage.find('.validation-summary-errors'));
490    }
491    $.extend(contactFriendDialog.prototype, {
492        open: function () {
493            var self = this;
494
495            if (self._container) {
496                self._container.dialog('open');
497            }
498            else {
499                $.getJSON(self._url, function (data) {
500                    self._container = $('<div id="mn-dialog-contactfriend" class="mn-reset"></div>').append(data['Html']);
501                    $.getScript("https://www.google.com/recaptcha/api.js");
502                    self._container.dialog({
503                        title: 'Tell A Friend About ' + data['Title'],
504                        dialogClass: 'mn-dialog-contactfriend',
505                        autoOpen: false,
506                        modal: true,
507                        width: 600,
508                        buttons: [
509                            { text: 'Send to Friend', click: function () { self._onSend.call(self); } },
510                            { text: 'Cancel', click: function () { self._onCancel.call(self); } }
511                        ]
512                    }).dialog('open');
513                });
514            }
515        },
516        _onSend: function () {
517            var self = this;
518            var $form = $("form#mn-info-form");
519
520            waitForGrecaptcha(() => {
521                setReCaptchaToken($form, () => {
522                    $.ajax({
523                        url: self._url,
524                        type: 'POST',
525                        data: $('form', self._container).serialize()
526                    }).then(function (result) {
527                        if (result.Success) showSuccess(self);
528                        else showFailure(self, result.Html);
529                    });
530                }, "contactFriend");
531            })
532      
533        },
534        _onCancel: function () {
535            $(this._container).dialog('close');
536        },
537        _updateButtons: function (func) {
538            var buttons = this._container.dialog('option', 'buttons');
539            func(buttons);
540            this._container.dialog('option', 'buttons', buttons);
541        }
542    });
543
544    function createContactFriendDialog(itemType, itemId) {
545        var url = MNI.BaseUrl + paths.ContactFriend(itemType, itemId),
546            dialog = new contactFriendDialog(url);
547
548        dialog.open();
549        if ($('#shareModal')[0] && $('#shareModal').modal) $('#shareModal').modal("hide");
550    };
551
552    var dialogs = {
553        _mapData: {},
554        Map: createMapDialog,
555        ContactFriend: createContactFriendDialog
556    };
557
558    function stripHash(url) {
559        return url && url.replace(/#.*/, '');
560    };
561
562    var tabs = {
563        _GetHashElement: function (link) {
564            if (link.hash && stripHash(location.href) === stripHash(link.href)) {
565                return $(link.hash, '#mn-content')[0];
566            }
567        },
568        _OnLinkClick: function (event) {
569            var tab = tabs._GetHashElement(this);
570            if (tab) {
571                event.preventDefault();
572                $(tab).trigger('mn-tab-active');
573            }
574        },
575        _InitLink: function () {
576            var self = $(this),
577                clone = self.clone();
578
579            // Replace original hyperlink with a clone to remove conflicting
580            // event handlers attached by several CMS plugins.
581            clone.click(tabs._OnLinkClick);
582            self.replaceWith(clone);
583        },
584        Init: function (selector) {
585            $('.mn-tabs a', selector).each(tabs._InitLink);
586
587            $(selector).on('mn-tab-active', function (event) {
588                var activeClass = 'mn-active',
589                    tab = event.target;
590
591                $('.mn-tabs a', this).each(function () {
592                    $(this).toggleClass(activeClass, tabs._GetHashElement(this) === tab);
593                });
594                $(tab).addClass(activeClass).siblings().removeClass(activeClass);
595            });
596        },
597        InitExternal: function (selector) {
598            $(selector).each(tabs._InitLink);
599        }
600    };
601
602    var lightBox = {
603        Init: function (selector, options) {
604            var imagePath = paths.SEO3Plugins('lightbox/images/'),
605                defaultOptions = {
606                    imageLoading: imagePath + 'lightbox-ico-loading.gif',
607                    imageBtnClose: imagePath + 'lightbox-btn-close.gif',
608                    imageBtnPrev: imagePath + 'lightbox-btn-prev.gif',
609                    imageBtnNext: imagePath + 'lightbox-btn-next.gif',
610                    fixedNavigation: true
611                };
612
613            options = $.extend(defaultOptions, options);
614
615            return $(selector).lightBox(options);
616        }
617    };
618
619    var calendar = {
620        Init: $.noop,
621        SelectDate: function (element) {
622            if (typeof (cultureDateFormat) == 'undefined' || cultureDateFormat == null) { cultureDateFormat = "m/d/yy" }
623            $(element).closest('label').find(':text').datepicker({ showOn: '', dateFormat: cultureDateFormat }).datepicker('show');
624        }
625    };
626
627    var calendar2 = {
628        Init: $.noop,
629        SelectDate: function (element) {
630            $(element).closest('label').find(':text').datepicker({ showOn: '', dateFormat: 'd/m/yy' }).datepicker('show');
631        }
632    };
633
634    var toggler = {
635        Init: function (stateElements, stateSelector) {
636            var clientState = $(stateSelector || '#mn-search-clientstate');
637
638            stateElements = stateElements || { undefined: 1 };
639
640            $('.mn-form-toggler a').click(function (event, initialize) {
641                event.preventDefault();
642
643                var toggler = $(this).closest('.mn-form-toggler'),
644                    togglable = toggler.next('.mn-form-togglable'),
645                    flag = stateElements[toggler.attr('id')],
646                    stateValue = clientState.val(),
647                    newState;
648
649                if (initialize)
650                {
651                    newState = (stateValue == undefined || stateValue == "") ?
652                        togglable.is(':visible') :
653                        (stateValue & flag) == flag;
654                }
655                else
656                {
657                    newState = !toggler.is('.mn-form-toggler-active');
658
659                    stateValue = newState ?
660                        stateValue | flag :
661                        stateValue & ~flag;
662
663                    clientState.val(stateValue);
664                }
665
666                toggler.toggleClass('mn-form-toggler-active', newState).toggleClass('mn-form-toggler-inactive', !newState);
667                togglable.toggleClass('mn-form-togglable-active', newState).toggleClass('mn-form-togglable-inactive', !newState);
668
669            }).trigger('click', [true]);
670        }
671    };
672
673    var printUrls = {
674        Init: function (selector) {
675            $(selector).each(function () {
676                var self = $(this);
677
678                if (self.is('a'))
679                    printUrls._transform(self);
680                else
681                    self.find('a').each(function () { printUrls._transform(this); });
682            });
683        },
684        _transform: function (element) {
685            var self = $(element),
686                href = self.attr('href'),
687                match,
688                text;
689
690            if (href == undefined || !href.length || /^(#|javascript:)/i.test(href))
691                return;
692
693            if (match = href.match(/^(mailto|tel):(.*)/i)) {
694                var val = match[2].toLowerCase();
695
696                if (match[1].toLowerCase() == 'mailto')
697                    val = val.replace(/^([^?]*)\?.*/i, '$1');
698
699                if (self.text().toLowerCase().indexOf(val) < 0)
700                    text = val;
701            } else
702                text = href
703
704            if (text)
705                self.append(document.createTextNode(' [' + text 
705+ ']'));
706        }
707    };
708
709    var youTubeRegex = /(^|\/\/)(youtu\.be\/|([^\/]+\.)?youtube\.com\/((watch|embed|[ve])\/|.*?[?&]v=|.*?\/u\/[^\/]+\/))([\w-]+)/i,
710        youTubeCallback = 'onYouTubeIframeAPIReady',
711        youTubeReady = false,
712        sliderCacheIds = [];
713
714    $.fn.mediaSlider = function(opts) {
715        opts = $.extend({
716            slideshow: false,
717            delay: 3000,
718            rate: 0.35
719        }, opts);
720
721        $(this).each(function() {
722            var base = $(this).addClass('mn-mediaslider-base').wrap('<div class="mn-mediaslider"><div class="mn-mediaslider-window"></div></div>'),
723                slider = base.closest('.mn-mediaslider'),
724                viewer = $('<div class="mn-mediaslider-viewer"></div>').prependTo(slider),
725                cache = $('<div class="mn-mediaslider-cache"></div>').prependTo(viewer),
726                index = 0,
727                direction = 0,
728                slideshowTimer,
729                waitLock;
730
731            function animateStop()
732            {
733                direction = 0;
734            }
735
736            function animateNext()
737            {
738                if (base.children().get(index + 1)) {
739                    animateTo(++index, function() {
740                        if (direction == 1)
741                            animateNext();
742                    });
743                }
744            };
745
746            function animatePrev()
747            {
748                if (index > 0) {
749                    animateTo(--index, function() {
750                        if (direction == -1)
751                            animatePrev();
752                    });
753                }
754            };
755
756            function animateTo(index, callback)
757            {
758                pause(3);
759                var left = -base.children().eq(index).position().left;
760                base.animate({ left: left + 'px' }, Math.abs(base.position().left - left) / opts.rate, 'linear', function () {
761                    unpause(3);
762                    if (callback)
763                        callback();
764                });
765            };
766
767            function pause(lockNo) {
768                waitLock |= 1 << lockNo;
769                slideshowStop();
770            };
771
772            function unpause(lockNo) {
773                waitLock &= ~(1 << lockNo);
774                slideshowStart();
775            };
776
777            function slideshowStart()
778            {
779                if (waitLock || slideshowTimer)
780                    return;
781
782                slideshowTimer = setInterval(function() {
783                    var links = $('> *', base),
784                        active = links.filter('.mn-mediaslider-selected');
785
786                    index = (links.index(active) + 1) % links.length;
787                    animateTo(index);
788                    links.eq(index).trigger('click');
789                }, opts.delay);
790            };
791
792            function slideshowStop()
793            {
794                if (slideshowTimer)
795                    clearInterval(slideshowTimer);
796
797                slideshowTimer = null;
798            };
799
800            function initYouTubeAPI() {
801                var defer = $.Deferred();
802
803                if (youTubeReady || (window['YT'] && YT.loaded)) {
804                    defer.resolve();
805                } else {
806                    var oldCallback = window[youTubeCallback];
807
808                    window[youTubeCallback] = function () {
809                        var self = this,
810                            args = arguments;
811
812                        window[youTubeCallback] = oldCallback;
813                        youTubeReady = true;
814                        defer.resolve();
815
816                        if (oldCallback) {
817                            setTimeout(function () {
818                                oldCallback.apply(self, args);
819                            }, 0);
820                        }
821                    };
822
823                    $('<script>', { src: 'https://www.youtube.com/iframe_api' }).appendTo('head');
824                }
825
826                return defer.promise();
827            };
828
829            if (!opts.slideshow)
830                pause(0);
831
832            slider.hover(function () {
833                pause(1);
834            }, function () {
835                unpause(1);
836            });
837
838            $('<div class="mn-mediaslider-prev"></div>').appendTo(slider).mousedown(function() {
839                direction = -1;
840                animatePrev();
841            }).mouseup(animateStop);
842
843            $('<div class="mn-mediaslider-next"></div>').appendTo(slider).mousedown(function() {
844                direction = 1;
845                animateNext();
846            }).mouseup(animateStop);
847
848            $('> *', base).click(function(e) {
849                e.preventDefault();
850                var link = $('a', this),
851                    img = $('img', link),
852                    href = link.attr('href'),
853                    youTubeMatch = href.match(youTubeRegex),
854                    loadingClass = 'mn-mediaslider-loading',
855                    activeClass = 'mn-mediaslider-active';
856
857                viewer.children().not(cache).remove();
858                $(this).addClass('mn-mediaslider-selected').siblings().removeClass('mn-mediaslider-selected');
859                $(cache).children('.' + activeClass).removeClass(activeClass).each(function () {
860                    var player = $(this).data('mniPlayer');
861                    if (player)
862                        player.pauseVideo();
863                });
864
865                var elementId = 'mn-mediaslider-cache-' + ($.inArray(href, sliderCacheIds) + 1 || sliderCacheIds.push(href)),
866                    element = $('#' + elementId);
867
868                if (!element[0])
869                    element = $('<div>', { id: elementId }).addClass(loadingClass).appendTo(cache);
870
871                if (youTubeMatch)
872                {
873                    initYouTubeAPI().then(function () {
874                        if (element.hasClass(loadingClass)) {
875                            var player = new YT.Player(elementId, {
876                                height: '100%',
877                                width: '100%',
878                                videoId: youTubeMatch[6],
879                                playerVars: { rel: 0 },
880                                events: {
881                                    'onStateChange': function (event) {
882                                        if (event.data == YT.PlayerState.PLAYING || event.data == YT.PlayerState.BUFFERING)
883                                            pause(2);
884                                        else
885                                            unpause(2);
886                                    }
887                                }
888                            });
889
890                            element = $('#' + elementId).data('mniPlayer', player).addClass('mn-mediaslider-video').removeClass(loadingClass);
891                        }
892
893                        element.addClass(activeClass);
894                        slider.trigger('mniMediaSlideChanged', [viewer, link, element]);
895                    });
896                }
897                else
898                {
899                    if (element.hasClass(loadingClass)) {
900                        $('<div>')
901                            .addClass('mn-mediaslider-center')
902                            .append($('<img />', { src: href, title: img.attr('title'), alt: img.attr('alt') }))
903                            .appendTo(element);
904
905                        element.addClass('mn-mediaslider-image').removeClass(loadingClass);
906                    }
907
908                    element.addClass(activeClass);
909                    slider.trigger('mniMediaSlideChanged', [viewer, link, element]);
910                }
911            }).eq(0).trigger('click');
912
913            slideshowStart();
914        });
915    };
916
917    $.fn.verifyUrl = function () {
918        return $(this).hide().append('[ <a href="#" class="mn-link-arrow" target="_blank">Verify URL</a> ]').each(function () {
919            var $this = $(this),
920                link = $('a', $this).click(update),
921                input = $this.siblings(':text').bind('change keyup keydown keypress', update);
922
923            function update() {
924                var url = input.val();
925
926                $this.toggle(!!url);
927
928                if (!url)
929                    url = '#';
930                else if (url.indexOf('://') < 0)
931                    url = 'http://' + url;
932
933                link.attr('href', url);
934            };
935
936            update();
937        }).end();
938    };
939
940    $.fn.ensureSchema = function (opts) {
941        opts = $.extend({
942            'default': 'http'
943        }, opts);
944
945        function update() {
946            var $this = $(this),
947                url = $this.val();
948
949            if (url && url.indexOf('://') < 0)
950                $this.val(opts['default'] + '://' + url).trigger('change');
951        }
952
953        return $(this).bind('change blur', update).each(update);
954    };
955
956    $.fn.charsRemaining = function () {
957        return $(this).each(function () {
958            var self = $(this),
959                input = self.attr('data-element'),
960                html = (self.attr('data-format') || '{0} chars remaining.')
961                    .replace('{0}', '<span class="chars-left mn-chars-remaining"></span>'),
962                element = $('<div>').html(html),
963                counter = $('.chars-left', element);
964
965            input = input ? $('#' + input) : self.next(':input');
966
967            input.bind('keypress keyup keydown change', onchange_update).trigger('change');
968            function onchange_update(e) {
969                var self = $(this),
970                    maxlength = self.attr('maxlength'),
971                    remaining = maxlength - self.val().length;
972
973                if (remaining < 0) {
974                    counter.text(0);
975                }
976                else {
977                    counter.text(remaining);
978                }
979
980                if (remaining < 0 && e.keyCode != 46 && e.keyCode != 8) {
981                    e.preventDefault();
982                }
983            }
984
985            element.contents().appendTo(self);
986        });
987    };
988
989    $.fn.formatPhoneCountry = function (country) {
990        return this.each(function () {
991            $(this).bind('blur', function (e) {
992                var lowerCountry = $(country).val().toLowerCase();
993                var formatted = $(this).val();
994                var value = $(this).val();
995                var digitsOnly = "";
996                var containsText = false;
997                if (lowerCountry == null ||
998                    lowerCountry == "" ||
999                    lowerCountry == "usa" ||
1000                    lowerCountry == "us" ||
1001                    lowerCountry == "united states" ||
1002                    lowerCountry == "united states of america" ||
1003                    lowerCountry == "canada" ||
1004                    lowerCountry == "can" ||
1005                    lowerCountry == "ca") {
1006                    for (j = 0; j < value.length; j++) {
1007                        if ((value.substr(j, 1) != "-") && isNumeric(value.substr(j, 1), false, true)) {
1008                            digitsOnly += value.substr(j, 1);
1009                        } else if ((value.substr(j, 1) >= 'A' && value.substr(j, 1) <= 'Z') || (value.substr(j, 1) >= 'a' && value.substr(j, 1) <= 'z')) {
1010                            containsText = true;
1011                            break;
1012                        }
1013                    }
1014                    if (containsText) {
1015                        formatted = value;
1016                    } else if (digitsOnly.length == 7) {
1017                        formatted = digitsOnly.substr(0, 3) + "-" + digitsOnly.substr(3);
1018                    } else if (digitsOnly.length == 10) {
1019                        formatted = "(" + digitsOnly.substr(0, 3) + ") " + digitsOnly.substr(3, 3) + "-" + digitsOnly.substr(6);
1020                    } else if (digitsOnly.length == 11) {
1021                        formatted = digitsOnly.substr(0, 1) + "-" + digitsOnly.substr(1, 3) + "-" + digitsOnly.substr(4, 3) + "-" + digitsOnly.substr(7);
1022                    } else {
1023                        formatted = value;
1024                    }
1025                }
1026                $(this).val(formatted);
1027            });
1028        });
1029    };
1030
1031    function mapControl(element) {
1032        this._element = element;
1033        this._lat = 39.8333;
1034        this._lng = -98.5833;
1035        this._radius = 25;
1036        this._markerRadius = 1;
1037        this._items = {};
1038    };
1039
1040    $.extend(mapControl.prototype, {
1041        create: function () {
1042            var self = this,
1043                items = self._items,
1044                mapContainer = $(this._element)[0];
1045
1046            self._map = new google.maps.Map(mapContainer, {
1047                mapTypeId: google.maps.MapTypeId.ROADMAP,
1048                scaleControl: true
1049            });
1050
1051            google.maps.event.addListener(self._map, 'click', $.proxy(self.closeWindow, self));
1052
1053            self._updateCenter(self._lat, self._lng);
1054            self._updateRadius(self._radius);
1055
1056            for (var id in items)
1057                items[id].marker.setMap(self._map);
1058        },
1059        setCenter: function (lat, lng) {
1060            this._lat = lat;
1061            this._lng = lng;
1062            this._updateCenter(lat, lng);
1063        },
1064        _updateCenter: function (lat, lng) {
1065            var self = this,
1066                position = new google.maps.LatLng(lat, lng);
1067
1068            if (self._map)
1069                self._map.setCenter(position);
1070        },
1071        setRadius: function (radius) {
1072            this._radius = radius;
1073            this._updateRadius(radius);
1074        },
1075        _updateRadius: function (radius) {
1076            var self = this,
1077                circle = new google.maps.Circle();
1078
1079            if (self._map) {
1080                circle.setRadius(radius * 1609.0);
1081                circle.setCenter(self._map.getCenter());
1082
1083                self._map.fitBounds(circle.getBounds());
1084            }
1085        },
1086        setZoom: function (zoom) {
1087            var self = this;
1088
1089            self._zoom = zoom;
1090
1091            if (self._map)
1092                self._map.setPosition(self._zoom);
1093        },
1094        setMarkerRadius: function (radius) {
1095            this._markerRadius = radius;
1096        },
1097        addMarker: function (id, lat, lng, title, icon, html) {
1098            var self = this,
1099                point = new google.maps.LatLng(lat, lng),
1100                marker = new google.maps.Marker({
1101                    position: point,
1102                    title: title,
1103                    icon: icon
1104                });
1105
1106            google.maps.event.addListener(marker, 'click', $.proxy(self.openWindow, self, id));
1107
1108            self._items[id] = {
1109                marker: marker,
1110                html: html
1111            };
1112
1113            if (self._map)
1114                marker.setMap(self._map);
1115        },
1116        removeMarker: function(id) {
1117            var item = this._items[id];
1118
1119            if (item) {
1120                item.marker.setMap(null);
1121                delete this._items[id];
1122            }
1123        },
1124        clearMarkers: function () {
1125            var self = this;
1126            for (var id in self._items)
1127                self.removeMarker(id);
1128        },
1129        fitMarkers: function () {
1130            var self = this,
1131                bounds = new google.maps.LatLngBounds();
1132
1133            for (var id in self._items) {
1134                var circle = new google.maps.Circle();
1135                circle.setCenter(self._items[id].marker.getPosition());
1136                circle.setRadius(self._markerRadius * 1609.0);
1137
1138                bounds.union(circle.getBounds());
1139            }
1140
1141            self._map.fitBounds(bounds);
1142        },
1143        openWindow: function (id) {
1144            var self = this,
1145                item = self._items[id];
1146
1147            if (item && item.html) {
1148                if (!item.window) {
1149                    item.window = new google.maps.InfoWindow({
1150                        content: $.isFunction(item.html) ? item.html.call(self, id) : item.html,
1151                        maxWidth: 350
1152                    });
1153                }
1154
1155                if (self._lastWindow && item.window !== self._lastWindow)
1156                    self._lastWindow.close();
1157
1158                var bounds = self._map.getBounds(),
1159                    circle = new google.maps.Circle();
1160
1161                circle.setCenter(item.marker.getPosition());
1162                circle.setRadius(self._markerRadius * 1609.0);
1163
1164                if (self._map.getZoom() < self._getBoundsZoomLevel(circle.getBounds()))
1165                    self._map.fitBounds(circle.getBounds());
1166                else
1167                    self._map.panTo(item.marker.getPosition());
1168
1169                item.window.open(self._map, item.marker);
1170                self._lastWindow = item.window;
1171            }
1172        },
1173        closeWindow: function () {
1174            if (this._lastWindow)
1175                this._lastWindow.close();
1176        },
1177        _getBoundsZoomLevel: function (bounds) {
1178            var WORLD_DIM = { height: 256, width: 256 },
1179                ZOOM_MAX = 21;
1180
1181            function latRad(lat) {
1182                var sin = Math.sin(lat * Math.PI / 180),
1183                    radX2 = Math.log((1 + sin) / (1 - sin)) / 2;
1184
1185                return Math.max(Math.min(radX2, Math.PI), -Math.PI) / 2;
1186            }
1187
1188            function zoom(mapPx, worldPx, fraction) {
1189                return Math.floor(Math.log(mapPx / worldPx / fraction) / Math.LN2);
1190            }
1191
1192            var element = $(this._element),
1193                ne = bounds.getNorthEast(),
1194                sw = bounds.getSouthWest(),
1195                latFraction = (latRad(ne.lat()) - latRad(sw.lat())) / Math.PI,
1196                lngDiff = ne.lng() - sw.lng(),
1197                lngFraction = ((lngDiff + 360) % 360) / 360;
1198
1199            return Math.min(
1200                zoom(element.height(), WORLD_DIM.height, latFraction),
1201                zoom(element.width(), WORLD_DIM.width, lngFraction),
1202                ZOOM_MAX);
1203        }
1204    });
1205
1206    function vacancyControl(memberName, vacancyUrl) {
1207        this._memberName = memberName;
1208        this._url = vacancyUrl;
1209    };
1210
1211    $.extend(vacancyControl.prototype, {
1212        open: function () {
1213            var self = this;
1214
1215            if (self._container) {
1216                self._container.dialog('open');
1217            }
1218            else {
1219                $.get(self._url, function (data) {
1220                    self._container = $('<div id="mn-dialog-vacancy" class="mn-reset"></div>').append(data);
1221                    self._container.dialog({
1222                        title: 'Vacancy Information - ' + self._memberName,
1223                        dialogClass: 'mn-dialog-vacancy',
1224                        autoOpen: false,
1225                        width: 750
1226                    }).dialog('open');
1227                    self._initControls();
1228                });
1229            }
1230        },
1231        _initControls: function () {
1232            var self = this,
1233                today = new Date(),
1234                minDate = new Date(today.getFullYear(), today.getMonth(), today.getDate()),
1235                maxDate = new Date(minDate.getFullYear() + 2, minDate.getMonth(), minDate.getDate() - 1);
1236
1237            $('#mn-availability-date', self._container).datepicker({
1238                minDate: minDate,
1239                maxDate: maxDate,
1240                dateFormat: 'm/d/yy',
1241                onSelect: function () {
1242                    self.changeDate($(this).val());
1243                },
1244                beforeShow: function () {
1245                    var self = $(this),
1246                        dialog = self.closest('.ui-dialog');
1247
1248                    if (dialog.length) {
1249                        setTimeout(function () {
1250                            // Elevate the z-index priority; overriding base stylesheet rule for datepicker.
1251                            self.datepicker('widget').attr('style', function (_, attr) {
1252                                var index = parseInt(dialog.css('zIndex')) + 1;
1253                                return attr + 'z-index:' + index + '!important;'
1254                            });
1255                        }, 0);
1256                    }
1257                }
1258            });
1259
1260            $('.mn-availability-controls a', self._container).click(function () {
1261                self.changeDate($(this).data('date'));
1262                return false;
1263            });
1264        },
1265        changeDate: function (date) {
1266            var self = this;
1267
1268            $.get(self._url, { date: date }, function (data) {
1269                self._container.empty().append(data);
1270                self._initControls();
1271            });
1272        }
1273    });
1274
1275    /* Relative Time */
1276    function TimeAgo() {
1277    };
1278
1279    $.extend(TimeAgo.prototype, {
1280        _round: Math.round,
1281        _thresholds: {
1282            s: 45,  // seconds to minute
1283            m: 45,  // minutes to hour
1284            h: 22,  // hours to day
1285            d: 26,  // days to month
1286            M: 11   // months to year
1287        },
1288        _formats: {
1289            future: 'in %s',
1290            past: '%s ago',
1291            s: 'a few seconds',
1292            m: 'a minute',
1293            mm: '%d minutes',
1294            h: 'an hour',
1295            hh: '%d hours',
1296            d: 'a day',
1297            dd: '%d days',
1298            M: 'a month',
1299            MM: '%d months',
1300            y: 'a year',
1301            yy: '%d years'
1302        },
1303        words: function (current, other) {
1304            function words(current, other, round, thresholds, formats) {
1305                var diff = round(other - current),
1306                    seconds = round(Math.abs(diff) / 1000),
1307                    minutes = round(seconds / 60),
1308                    hours = round(minutes / 60),
1309                    days = round(hours / 24);
1310
1311                var years = current.getFullYear() - other.getFullYear(),
1312                    months = (current.getMonth() - other.getMonth()) + (12 * years);
1313
1314                var data =
1315                    seconds < thresholds.s && ['s', seconds] ||
1316                    minutes === 1 && ['m', 1] ||
1317                    minutes < thresholds.m && ['mm', minutes] ||
1318                    hours === 1 && ['h', 1] ||
1319                    hours < thresholds.h && ['hh', hours] ||
1320                    days === 1 && ['d', 1] ||
1321                    days < thresholds.d && ['dd', days] ||
1322                    months === 1 && ['M', 1] ||
1323                    months < thresholds.M && ['MM', months] ||
1324                    years === 1 && ['y', 1] ||
1325                    ['yy', years];
1326
1327                var format = formats[diff > 0 ? 'future' : 'past'],
1328                    units = formats[data[0]].replace(/%d/i, data[1]),
1329                    result = format.replace(/%s/i, units);
1330
1331                return result;
1332            };
1333
1334            var self = this;
1335            return words(current, other, self._round, self._thresholds, self._formats);
1336        }
1337    });
1338
1339    function formatDate(date, format) {
1340        /**
1341        * @param {*} str
1342        * @param {number=} len
1343        */
1344        function pad(str, len) {
1345            str = String(str);
1346            for (len = len || 2; str.length < len;)
1347                str = '0' + str;
1348            return str;
1349        };
1350
1351        function ordinal(day) {
1352            return (1 == day || 21 == day || 31 == day) ? "st" :
1353                (2 == day || 22 == day) ? "nd" :
1354                (3 == day || 23 == day) ? "rd" :
1355                "th";
1356        };
1357
1358        var daysAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1359            daysFull = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
1360            monthsAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1361            monthsFull = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
1362            designatorAbbr = ['A', 'P'],
1363            designatorFull = ['AM', 'PM'],
1364            tokens = /d{1,4}|M{1,4}|y{1,5}|o|"[^"]*"|'[^']*'|[hHmst]{1,2}/g,
1365            day = date.getDate(),
1366            weekDay = date.getDay(),
1367            month = date.getMonth(),
1368            year = date.getFullYear(),
1369            hours = date.getHours(),
1370            minutes = date.getMinutes(),
1371            seconds = date.getSeconds(),
1372            pattern = {
1373                d: day,
1374                dd: pad(day),
1375                ddd: daysAbbr[weekDay],
1376                dddd: daysFull[weekDay],
1377                M: month + 1,
1378                MM: pad(month + 1),
1379                MMM: monthsAbbr[month],
1380                MMMM: monthsFull[month],
1381                y: year,
1382                yy: pad(year % 100),
1383                yyy: pad(year % 1E3, 3),
1384                yyyy: pad(year % 1E4, 4),
1385                yyyyy: pad(year % 1E5, 5),
1386                o: ordinal(day),
1387                h: ((hours + 12) % 12) || 12,
1388                hh: pad(((hours + 12) % 12) || 12),
1389                H: hours,
1390                HH: pad(hours),
1391                m: minutes,
1392                mm: pad(minutes),
1393                s: seconds,
1394                ss: pad(seconds),
1395                t: designatorAbbr[hours < 12 ? 0 : 1],
1396                tt: designatorFull[hours < 12 ? 0 : 1]
1397            };
1398
1399        return format.replace(tokens, function (segment) {
1400            return segment in pattern ? pattern[segment] : segment.slice(1, segment.length - 1);
1401        });
1402    };
1403
1404    function CollectionPoller(fn, interval) {
1405        var self = this;
1406
1407        self._fn = fn;
1408        self._interval = interval;
1409        self._items = [];
1410        self._timeout = null;
1411    };
1412
1413    $.extend(CollectionPoller.prototype, {
1414        add: function (item) {
1415            var self = this,
1416                items = self._items;
1417
1418            items.push(item);
1419
1420            if (items.length) {
1421                self._enable();
1422            }
1423        },
1424        remove: function (item) {
1425            var self = this,
1426                items = self._items,
1427                index = items.indexOf(item);
1428
1429            if (index >= 0) {
1430                items.splice(index, 1);
1431
1432                if (!items.length) {
1433                    self._disable();
1434                }
1435            }
1436        },
1437        _enable: function () {
1438            var self = this;
1439
1440            if (!self._timeout) {
1441                self._timeout = setTimeout($.proxy(self._tick, self), self._interval);
1442            }
1443        },
1444        _disable: function () {
1445            var self = this;
1446
1447            if (self._timeout) {
1448                clearTimeout(self._timeout);
1449                self._timeout = null;
1450            }
1451        },
1452        _tick: function () {
1453            var self = this,
1454                caught = [];
1455
1456            self._disable();
1457
1458            $.each(self._items, function () {
1459                var item = this;
1460                try {
1461                    self._fn.call(item);
1462                } catch (ex) {
1463                    caught.push(item);
1464                }
1465            });
1466
1467            $.each(caught, function () {
1468                self.remove(this);
1469            });
1470
1471            self._enable();
1472        }
1473    });
1474
1475    var timeAgoPoller = new CollectionPoller(function () {
1476        this.update();
1477    }, 10000);
1478
1479    var timeAgoFunctions = {
1480        init: function (opts) {
1481            var self = $(this),
1482                timeAgo = new TimeAgo(),
1483                date = new Date(self.attr('datetime')),
1484                origText = self.text();
1485
1486            var updateFn = function () {
1487                var data = this,
1488                    now = new Date();
1489
1490                var absoluteFormat =
1491                    now.getFullYear() !== date.getFullYear() && opts.dateFormat ||
1492                    (now.getMonth() !== date.getMonth() || now.getDate() !== date.getDate()) && opts.monthFormat ||
1493                    opts.timeFormat;
1494
1495                var text = formatDate(date, absoluteFormat)
1496                    + ' (' + timeAgo.words(now, date) + ')';
1497
1498                if (data.lastText !== text) {
1499                    self.text(text);
1500                    data.lastText = text;
1501                }
1502            };
1503
1504            var title = opts.titleFormat && formatDate(date, opts.titleFormat) || origText,
1505                data = { update: updateFn };
1506
1507            self.attr('title', title).data('timeAgo', data);
1508
1509            data.update();
1510            timeAgoPoller.add(data);
1511        },
1512        refresh: function() {
1513            var self = $(this),
1514                data = self.data('timeAgo');
1515
1516            if (data) {
1517                data.update();
1518            }
1519        },
1520        dispose: function () {
1521            var self = $(this),
1522                data = self.data('timeAgo');
1523
1524            if (data) {
1525                timeAgoPoller.remove(data);
1526                self.removeData('timeAgo');
1527            }
1528        }
1529    };
1530
1531    $.fn.timeAgo = function (action, opts) {
1532        var fn = timeAgoFunctions[action];
1533
1534        if (!fn) {
1535            fn = timeAgoFunctions.init;
1536            opts = action;
1537        }
1538
1539        return this.each(function () {
1540            fn.call(this, opts);
1541        });
1542    };
1543
1544    var plugins = {
1545        AutoComplete: autoComplete,
1546        Tabs: tabs,
1547        LightBox: lightBox,
1548        Calendar: calendar,
1549        Calendar2 : calendar2,
1550        Toggler: toggler,
1551        PrintUrls: printUrls,
1552        Map: mapControl,
1553        Vacancy: vacancyControl
1554    };
1555
1556    // Assignment to the MicroNet namespace
1557
1558    window['MNI'] = $.extend(window.MNI || {}, {
1559        Hit: hitStats,
1560        Path: paths,
1561        Plugins: plugins,
1562        Window: windows,
1563        Dialog: dialogs
1564    });
1565
1566    $.extend(MNI, {
1567        getDateFormat: function () {
1568            return (MNI.CultureDateFormat || 'm/d/yy').replace('yyyy', 'yy').replace("M", "m").replace("mM", "m");
1569        },
1570        PreventDuplicateSubmission: function (formSelector) {
1571            preventDuplicateSubmissions(formSelector);
1572        },
1573        openNewWindow: openNewWindow,
1574        redirectTo: redirectTo,
1575        logHitStat: logHitStat
1576    });
1577
1578})(MNI.jQuery);
1579
1580// Optional feature for associations that choose to hide field names of
1581// textboxes. Input elements marked as placeholders will use its title value
1582// as placeholder text while its value is empty. Native support is used if
1583// HTML5 is supported by the browser
1584MNI.jQuery(function ($) {
1585    var test = document.createElement('input'),
1586        selector = '.mn-placeholder[title]',
1587        activeClass = 'mn-placeholder-active',
1588        elements = $(selector).not('#mn-directory-list #mn-search-keyword :text');
1589
1590    function hideTitle() {
1591        var $this = $(this);
1592
1593        if ($this.val() == $this.attr('title'))
1594            $this.removeClass(activeClass).val('');
1595    };
1596
1597    function showTitle() {
1598        var $this = $(this);
1599
1600        if (!$this.val())
1601            $this.addClass(activeClass).val($this.attr('title'));
1602    };
1603
1604    // Use HTML5 placeholder feature, if the browser supports it. Otherwise
1605    // fallback to using manual JavaScript and events.
1606    if ('placeholder' in test) {
1607        elements.each(function () {
1608            var $this = $(this);
1609            $this.attr('placeholder', $this.attr('title'));
1610        });
1611    } else {
1612        $(selector).focus(hideTitle).blur(showTitle).each(showTitle);
1613
1614        $('#mn-content form').submit(function () {
1615            $(selector, this).each(hideTitle);
1616        });
1617    }
1618});
1619;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.