﻿function createInfoWindowContent(a) { var b = new RegExp("^http://"); var c = a.latitude; var d = a.longitude; var e = new GLatLng(c, d); var f = []; f.push('<div class="theaterName">' + a.theaterName); f.push("</div>"); f.push("<div>"); f.push('<div class="ul">'); if (a["dolbyDigital"] > 0) { f.push('<div class="li"><div class="first"><img title="Dolby Digital Cinema" alt="Dolby Digital Cinema" src="/images/icons/dolby.gif" align="baseline" border="0" /></div></div>') } if (a["dolby3D"] > 0) { f.push('<div class="li"><img title="Dolby 3D" alt="Dolby 3D" src="/images/icons/dolby_3D.gif" align="baseline" border="0" /></div>') } if (a["dolby7.1"] > 0) { f.push('<div class="li"><img title="Dolby Surround 7.1" alt="Dolby Surround 7.1" src="/images/icons/dolby_7-1.gif" align="baseline" border="0" /></div>') } f.push("</div></div>"); f.push('<div style="float:none;margin-top:50px;">'); for (j = 0; j < a.address.length; j++) { if (a.address[j].length > 0) { f.push(a.address[j] + "<br/>") } } if (a.url !== "") { var g = a.url.substring(0, 25); var h = a.url; if (b.test(h) == false) { h = "http://" + h } if (a.url.length > 25) { f.push('<a target="_blank" href="' + h + "\" onmousedown=\"gaEventTrack('7','" + h + "');\">" + g + "...</a><br/>") } else { f.push('<a target="_blank" href="' + h + "\" onmousedown=\"gaEventTrack('7','" + h + "');\">" + h + "</a><br/>") } f.push("</div>") } return '<div align="left" id="InfoMarker">' + f.join("") + "</div>" } function getParameterByName(a) { a = a.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var b = "[\\?&]" + a + "=([^&#]*)"; var c = new RegExp(b); var d = c.exec(window.location.href); if (d == null) return ""; else return decodeURIComponent(d[1].replace(/\+/g, " ")) } function createMarker(a) { base_icon = new GIcon; base_icon.image = getIcon(a); base_icon.transparent = null; base_icon.shadow = null; base_icon.iconSize = new GSize(39, 45); base_icon.shadowSize = null; base_icon.iconAnchor = new GPoint(19, 39); base_icon.infoWindowAnchor = new GPoint(19, 22); base_icon.infoShadowAnchor = null; marker_options = { icon: base_icon, clickable: true }; var b = new GMarker(new GLatLng(a.latitude, a.longitude), marker_options); b.pointInfos = a; GEvent.addListener(b, "click", function(a) { this.textInfoWindow = createInfoWindowContent(this.pointInfos); showInfoWindow(this) }); return b } function showInfoWindow(a, b) { var c = document.createElement("div"); c.className = "infowindowParent"; c.innerHTML = a.textInfoWindow; c.style.display = "none"; document.body.appendChild(c); setTimeout(function() { c.style.height = $(c).height() + 3 + "px"; a.openInfoWindow(c); if (b !== undefined) { setTimeout(function() { infoWindowOpened = b }, 200) } c.style.display = "block" }, 200) } function getIcon(a) { if (dolbyDigital) { icon = "/images/icons/marker_dolby.png" } else if (dolby3D) { icon = "/images/icons/marker_dolby_3D.png" } else if (dolby7_1) { icon = "/images/icons/marker_dolby_7-1.png" } else { var b = 0; if (a["dolbyDigital"]) { icon = "/images/icons/marker_dolby.png"; b++ } if (a["dolby3D"]) { icon = "/images/icons/marker_dolby_3D.png"; b++ } if (a["dolby7.1"]) { icon = "/images/icons/marker_dolby_7-1.png"; b++ } if (b >= 3 || b == 0) { icon = icon = "/images/icons/marker_dolby_all.png" } } return icon } function getCinemaDistance(a, b) { var c = a.distanceFrom(new GLatLng(b.latitude, b.longitude)) * .000621371192; return c } function updateNearest(a) { var b = (new Date).getTime(); $.ajax({ url: "/GetCinemaPoints.ashx?v=" + b, data: { requestType: "nearest", longitude: a.lng(), latitude: a.lat(), dolbyDigital: dolbyDigital, dolby3D: dolby3D, dolby7_1: dolby7_1, dolby10_1: dolby10_1 }, dataType: "json", success: function(b) { var c = new GLatLngBounds; for (var d = 0; d < b.length; d++) { var e = b[d]; c.extend(new GLatLng(e.latitude, e.longitude)) } c.extend(a); var f = c.getSouthWest().lng(); var g = c.getNorthEast().lng(); var h = c.getSouthWest().lat(); var i = c.getNorthEast().lat(); var j = g - f; var k = i - h; if (f > g) { j = g + 360 - f } var l = map.getSize().width; var m = map.getSize().height; var n = j / l; var o = k / m; var p = 40; f -= n * p; if (f < -180) { f += 360 } g += n * p; if (g > 180) { g -= 360 } h -= o * p; i += o * p; var c = new GLatLngBounds(new GLatLng(h, f), new GLatLng(i, g)); if (newSearchOrigin) { searchOrigin = new GMarker(a, { icon: marker_icon }); searchOrigin.textInfoWindow = '<div style="height:25px;">' + document.getElementById("gmapsearch").value + "</div>"; GEvent.addListener(searchOrigin, "click", function() { searchOrigin.openInfoWindowHtml(searchOrigin.textInfoWindow); infoWindowOpened = false }); var q = new GLatLng(a.lat() + .01667, a.lng()); var r = new GSize(1978, 2755); var s = getCinemaDistance(a, b[b.length - 1]); var t = s / 69.172; var u = s / (Math.cos(t * (Math.PI / 180)) * 69.172); var v = new GLatLng(a.lat() + t, a.lng() + u); var w = new GLatLng(a.lat() - t, a.lng() - u); var x = new GLatLngBounds(w, v); var y = map.getCurrentMapType().getBoundsZoomLevel(x, r); map.setCenter(a, y) } getSearchResults(a, b) } }) } function updatePoints() { if (updating || infoWindowOpened) { return } updating = true; var a = 70; var b = 38; var c = b / 2 / a; var d = map.getSize().width; if (map.getBounds().isFullLng()) { var e = map.fromLatLngToContainerPixel(new GLatLng(0, -180)).x; var f = map.fromLatLngToContainerPixel(new GLatLng(0, 0)).x; if (e > f) { d = e - f } else { d = f - e } d = d * 2; a = 90; c = c / 1.5 } var g = map.getSize().height; var h = map.getBounds(); var i = h.getSouthWest(); var j = h.getNorthEast(); var k = i.lng(); var l = i.lat(); var m = j.lng(); var n = j.lat(); var o = m - k; var p = n - l; if (k > m) { o = m + 360 - k } var q = 40; var r = o / d; var s = p / g; k += r * q; m -= r * q; l += s * q; n -= s * q; var t = a * o / d; var u = a * p / g; var v = false; var w = null; if (map.getZoom() < CLUSTER_MAXZOOMLEVEL) { v = true } var x = (new Date).getTime(); $.ajax({ url: "/GetCinemaPoints.ashx?v=" + x, data: { xmin: k, ymin: l, xmax: m, ymax: n, clusterDeltaX: t, clusterDeltaY: u, activateClustering: v, dolbyDigital: dolbyDigital, dolby3D: dolby3D, dolby7_1: dolby7_1, dolby10_1: dolby10_1, overlappingRatio: c }, dataType: "json", success: function(a) { map.clearOverlays(); for (var b = 0; b < a.length; b++) { var c = a[b]; if (typeof c.longitude != "undefined") { var d = createMarker(c); map.addOverlay(d); if (showmarkerEvent) { if (!w) { if (comparMarkerData(d.pointInfos, showmarkerEvent)) { w = d } } } } else { map.addOverlay(new KClusterMarker(c)) } } if (searchOrigin) { map.addOverlay(searchOrigin); if (newSearchOrigin) { showInfoWindow(searchOrigin, false); infoWindowOpened = false; newSearchOrigin = false } } if (w) { GEvent.trigger(w, "click"); w = null; showmarkerEvent = null } updating = false } }) } function setFilterByParam(a) { if (a.toLowerCase() == "dolby-digital-cinema") { dolbyDigital = true; filterObj.setTextfilterDolbyDigital(); gaEventTrack("8") } else if (a.toLowerCase() == "dolby-3d") { dolby3D = true; filterObj.setTextfilterDolby3D(); gaEventTrack("9") } else if (a.toLowerCase() == "dolby-surround-7.1") { dolby7_1 = true; filterObj.setTextfilterDolby71(); gaEventTrack("10") } } function updatePointsDelayed() { if (!infoWindowOpened) { updatePointsTimeout = window.setTimeout(function() { updatePoints() }, 200) } } function initialize(a, b, c) { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(a, b), c); map.setUIToDefault(); updatePoints(); GEvent.addListener(map, "moveend", function() { updatePointsDelayed() }); GEvent.addListener(map, "infowindowopen", function() { infoWindowOpened = true }); GEvent.addListener(map, "infowindowclose", function() { infoWindowOpened = false; updatePointsTimeout = window.setTimeout(function() { if (!infoWindowOpened) { updatePoints() } }, 200) }) } loadMap() } function showInitMap() { var a = getParameterByName("cq"); var b = getParameterByName("ct"); if (a != "") { $("#gmapsearch").val(a); var c = new GClientGeocoder; c.getLatLng(a, function(a) { if (a) { newSearchOrigin = true; initialize(a.lat(), a.lng(), 5); updateNearest(a); gaEventTrack("3") } else { initialize(DEFAULT_MAP_COORDS.lat, DEFAULT_MAP_COORDS.lng, DEFAULT_MAP_COORDS.zoom); setTimeout('alert(LOCALIZEDTEXT["LocationNotFoundError"])', 200); gaEventTrack("11") } }) } else { initialize(DEFAULT_MAP_COORDS.lat, DEFAULT_MAP_COORDS.lng, DEFAULT_MAP_COORDS.zoom) } if (b != "") { setFilterByParam(b) } } function filterCinemas(a) { dolbyDigital = false; dolby3D = false; dolby7_1 = false; dolby10_1 = false; switch (a) { case FILTER_DOLBYDIGITAL: dolbyDigital = true; gaEventTrack("8"); break; case FILTER_DOLBY3D: dolby3D = true; gaEventTrack("9"); break; case FILTER_DOLBY71: dolby7_1 = true; gaEventTrack("10"); break; case FILTER_DOLBY101: dolby10_1 = true; break } map.closeInfoWindow(); if (searchOrigin) { updateNearest(searchOrigin.getLatLng()) } updatePoints() } function setFilterComboBehavior() { $("#gmapsearch").keydown(function(a) { checkEnter(a) }); $("#gmapsearch").keypress(function(a) { return disableEnterKey(a) }); $("#gmapsearchsubmit").click(function() { plotInput(); return false }); $("input[type=text],textarea").each(function() { if (this.value !== "") { var a = this.value; $(this).focus(function() { if (this.value === a) { this.value = "" } }); $(this).blur(function() { if (this.value === "") { this.value = a } }) } }); $("#gmapfilter-styled ul.collapsed li.handle a").click(function() { var a = $(this).parent().parent(); if (a.hasClass("collapsed")) { $(a).removeClass("collapsed"); $(a).addClass("expanded") } else { $(a).removeClass("expanded"); $(a).addClass("collapsed") } return false }); $(document).pngFix() } var FilterObj = function() { function d(a) { $("li.handle a").html(b + " : " + '<span class="selFilter">' + $(a).text() + "</span>") } function c(c, d) { $(c).click(function() { $("li.handle a").html(b + " : " + '<span class="selFilter">' + $(this).text() + "</span>"); filterCinemas(d); a.removeClass("expanded"); a.addClass("collapsed"); return false }) } var a = $("#gmapfilter-styled ul"); var b = $("#gmapfilter-styled ul li.handle a").text(); c("#filter-all a", FILTER_ALL); c("#filter-ddc a", FILTER_DOLBYDIGITAL); c("#filter-d3d a", FILTER_DOLBY3D); c("#filter-ds7 a", FILTER_DOLBY71); var e = this; this.filterAll = function() { $("#filter-all a").click() }; this.filterDolbyDigital = function() { $("#filter-ddc a").click() }; this.filterDolby3D = function() { $("#filter-d3d a").click() }; this.filterDolby71 = function() { $("#filter-ds7 a").click() }; this.setTextfilterAll = function() { d("#filter-all a") }; this.setTextfilterDolbyDigital = function() { d("#filter-ddc a") }; this.setTextfilterDolby3D = function() { d("#filter-d3d a") }; this.setTextfilterDolby71 = function() { d("#filter-ds7 a") } }; var map = null; var infoWindowOpened = false; var dolbyDigital = false; var dolby3D = false; var dolby7_1 = false; var dolby10_1 = false; var FILTER_ALL = 1; var FILTER_DOLBYDIGITAL = 2; var FILTER_DOLBY3D = 3; var FILTER_DOLBY71 = 4; var FILTER_DOLBY101 = 5; var CLUSTER_MAXZOOMLEVEL = 7; var markers = new Array; var updatePointsTimeout = null; var updating = false
