var shouldbehash = ""; var currenthash = window.location.hash; var initzoom = 12; var marker = new Array(); var venues = [ ['BB8',52.44202000,13.23834000,50,'3',], ['BB8',52.45731700,13.29287800,51,'6',], ['BB8',52.52684000,13.39488000,52,'1',], ['BB8',52.52676600,13.39467800,53,'5',]]; var transport = [ [ 'Krumme Lanke', '52.442614', '13.240365', 41, '41' ], [ 'Dahlem Dorf', 52.457694, 13.290011, 42, '42' ], [ 'Wittenbergplatz', 52.502112, 13.342593, 43, '43' ], [ 'Alexanderplatz', 52.521155, 13.412847, 44, '44' ], [ 'Hackescher', 52.522645, 13.402234, 45, '45' ], [ 'Mexicoplatz', 52.437393, 13.232798, 46, '46' ] ]; var districts = [ [ 'REINIKENDORF', 52.566326, 13.347349, 21, '21' ], [ 'MOABIT', 52.529582, 13.342543, 22, '22' ], [ 'KREUZBERG', 52.498443, 13.391534, 25, '25' ], [ 'FRIDRICHSHAIN', 52.499488, 13.428356, 26, '26' ], [ 'LICHTENBERG', 52.512653, 13.484832, 27, '27' ], [ 'NEUKOLLN', 52.479105, 13.437797, 28, '28' ], [ 'JOHANNISTHAL', 52.443230, 13.502514, 29, '29' ], [ 'SCHONEBERG', 52.483078, 13.366729, 30, '30' ], [ 'DAHLEM', 52.453086, 13.287422, 31, '31' ], [ 'ZEHLENDORF', 52.433707, 13.258926, 32, '32' ] ]; var sites1 = $.merge( $.merge( [], venues ), transport ); var sites = $.merge( $.merge( [], sites1 ), districts ); var newmarkers = []; var activecontrols = (isIphone) ? true : false ; $(document).ready(function () { if ($("#map_canvas").length > 0) { initialize(); } if(currenthash != "" && currenthash != shouldbehash) { var marker_id = currenthash.replace("#",""); moveAndInfo(marker_id); } $("body").on("click", ".markerjump", function(){ $("body, html").animate({ scrollTop: 0 }, 400); $(".markerjump").not(this).removeClass("selected"); $(this).addClass("selected"); var marker_id = $(this).attr("href").replace("#",""); moveAndInfo(marker_id); }); }); function moveAndInfo(marker_id){ var row = find(marker_id, sites); var loc = new google.maps.LatLng(sites[row][1], sites[row][2]); var locinfo = $(".venueoverlay.v_" + marker_id); map.setCenter(loc); locinfo.show(); var thishash = "#"+sites[row][5]; $(".markerjump").removeClass("selected"); $(".markerjump[href='"+thishash+"']").addClass("selected"); } function find(thing, theArray) { var results, col, row, subArray; results = []; // Empty array for (row = 0; row < theArray.length; ++row) { subArray = theArray[row]; for (col = 0; col < subArray.length; ++col) { value = subArray[col]; if (value == thing) { // or whatever your criterion //results.push({row: row, col: col}); return row; } } } return results; } function initialize() { var centerMap = new google.maps.LatLng(52.482,13.38302); var myOptions = { zoom: initzoom ,center: centerMap ,mapTypeId: google.maps.MapTypeId.ROADMAP ,disableDefaultUI: activecontrols ,zoomControl: false ,zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL } } var clusterStyles = [ { url: '/css/icons/bb8-venues-clustered.png', height: 34, width: 30 } ]; var mcOptions = { styles: clusterStyles, enableRetinaIcons: true, gridSize: 2 }; var MAP_STYLE = [ { "stylers": [ { "visibility": "on" }, { "color": "#F5F4F4" } ] },{ "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#FFFFFF" } ] },{ "featureType": "road", "elementType": "geometry.stroke", "stylers": [ { "weight": 0.2 }, { "color": "#666565" } ] },{ "featureType": "water", "stylers": [ { "color": "#CDD7DE" } ] },{ "featureType": "poi", "stylers": [ { "color": "#DDE6D5" } ] },{ "featureType": "poi.attraction", "stylers": [ { "color": "#D0D2D3" } ] },{ "featureType": "poi.business", "stylers": [ { "color": "#D0D2D3" } ] },{ "elementType": "labels.text.fill", "stylers": [ { "visibility": "off" }, { "color": "#666565" } ] },{ "featureType": "road.highway", "elementType": "labels.text.fill", "stylers": [ { "visibility": "on" }, { "color": "#000000" } ] },{ "featureType": "road.arterial", "elementType": "labels.text.fill", "stylers": [ { "visibility": "on" }, { "color": "#000000" } ] } ]; var flightPlanCoordinates1 = [ new google.maps.LatLng(52.442614, 13.240365), new google.maps.LatLng(52.450138, 13.254100), new google.maps.LatLng(52.450999, 13.281666), new google.maps.LatLng(52.457694, 13.290011), new google.maps.LatLng(52.464166, 13.295211), new google.maps.LatLng(52.467345, 13.309275), new google.maps.LatLng(52.472465, 13.314384), new google.maps.LatLng(52.479430, 13.311758), new google.maps.LatLng(52.490224, 13.314612), new google.maps.LatLng(52.496586, 13.330748), new google.maps.LatLng(52.500557, 13.336821), new google.maps.LatLng(52.502112, 13.342593) ]; var flightPlanCoordinates2 = [ new google.maps.LatLng(52.502112, 13.342593), new google.maps.LatLng(52.499633, 13.353881), new google.maps.LatLng(52.497654, 13.362550), new google.maps.LatLng(52.499581, 13.374287), new google.maps.LatLng(52.503793, 13.374813), new google.maps.LatLng(52.509070, 13.377989), new google.maps.LatLng(52.511525, 13.383857), new google.maps.LatLng(52.512172, 13.389694), new google.maps.LatLng(52.513347, 13.395369), new google.maps.LatLng(52.511297, 13.402408), new google.maps.LatLng(52.511989, 13.408866), new google.maps.LatLng(52.517225, 13.412482), new google.maps.LatLng(52.521155, 13.412847) ]; var flightPath1 = new google.maps.Polyline({ path: flightPlanCoordinates1, geodesic: true, strokeColor: '#4d6aa8', strokeOpacity: 1.0, strokeWeight: 3 }); var flightPath2 = new google.maps.Polyline({ path: flightPlanCoordinates2, geodesic: true, strokeColor: '#c45e3a', strokeOpacity: 1.0, strokeWeight: 3 }); map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); setMarkers(map, sites); var markerCluster = new MarkerClusterer(map, marker, mcOptions); markerCluster.setCalculator(function(markers, numStyles){ return { text: "", index: 0 }; }); var mapType = new google.maps.StyledMapType(MAP_STYLE); map.mapTypes.set("Dummy Style", mapType); map.setMapTypeId("Dummy Style"); flightPath1.setMap(map); flightPath2.setMap(map); } function map_recenter(latlng,offsetx,offsety) { var point1 = map.getProjection().fromLatLngToPoint( (latlng instanceof google.maps.LatLng) ? latlng : map.getCenter() ); var point2 = new google.maps.Point( ( (typeof(offsetx) == 'number' ? offsetx : 0) / Math.pow(15, map.getZoom()) ) || 0, ( (typeof(offsety) == 'number' ? offsety : 0) / Math.pow(15, map.getZoom()) ) || 0 ); map.panTo(map.getProjection().fromPointToLatLng(new google.maps.Point( point1.x - point2.x, point1.y + point2.y ))); } function setMarkers(map, markers) { var hash = ""; for (var i = 0; i < markers.length; i++) { var sites = markers[i]; var siteLatLng = new google.maps.LatLng(sites[1], sites[2]); if (sites[4]==3) { var custompin = new google.maps.MarkerImage("/css/icons/bb8-venues-haus.png", null, null, null, new google.maps.Size(20.0, 40.0) ); } else if (sites[4]==6) { var custompin = new google.maps.MarkerImage("/css/icons/bb8-venues-dahlem.png", null, null, null, new google.maps.Size(20.0, 40.0) ); } else if (sites[4]==1) { var custompin = new google.maps.MarkerImage("/css/icons/bb8-venues-kw.png", null, null, null, new google.maps.Size(20.0, 40.0) ); } else if (sites[4]==5) { var custompin = new google.maps.MarkerImage("/css/icons/bb8-venues-crash.png", null, null, null, new google.maps.Size(20.0, 40.0) ); } else if (sites[4]==41) { var custompin = new google.maps.MarkerImage("/css/icons/stations_krumme.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(120.0, 20.0) ); } else if (sites[4]==42) { var custompin = new google.maps.MarkerImage("/css/icons/stations_dahlemdorf.png", null, null, new google.maps.Point(90, 10), new google.maps.Size(100.0, 20.0) ); } else if (sites[4]==43) { var custompin = new google.maps.MarkerImage("/css/icons/stations_wittehbergplatz.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(120.0, 20.0) ); } else if (sites[4]==44) { var custompin = new google.maps.MarkerImage("/css/icons/stations_alexanderplatz.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(120.0, 20.0) ); } else if (sites[4]==45) { var custompin = new google.maps.MarkerImage("/css/icons/stations_hackescher.png", null, null, new google.maps.Point(130, 10), new google.maps.Size(140.0, 20.0) ); } else if (sites[4]==46) { var custompin = new google.maps.MarkerImage("/css/icons/stations_mexikoplatz.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(100.0, 20.0) ); } else if (sites[4]==21) { var custompin = new google.maps.MarkerImage("/css/icons/district_reinickendo.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(100.0, 20.0) ); } else if (sites[4]==22) { var custompin = new google.maps.MarkerImage("/css/icons/district_moabit.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(55.0, 20.0) ); } else if (sites[4]==25) { var custompin = new google.maps.MarkerImage("/css/icons/district_kreuzberg.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(100.0, 20.0) ); } else if (sites[4]==26) { var custompin = new google.maps.MarkerImage("/css/icons/district_friedrichshain.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(140.0, 20.0) ); } else if (sites[4]==27) { var custompin = new google.maps.MarkerImage("/css/icons/district_litchtenberg.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(100.0, 20.0) ); } else if (sites[4]==28) { var custompin = new google.maps.MarkerImage("/css/icons/district_neukolln.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(100.0, 20.0) ); } else if (sites[4]==29) { var custompin = new google.maps.MarkerImage("/css/icons/district_johannisthal.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(120.0, 20.0) ); } else if (sites[4]==30) { var custompin = new google.maps.MarkerImage("/css/icons/district_schoneberg.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(100.0, 20.0) ); } else if (sites[4]==31) { var custompin = new google.maps.MarkerImage("/css/icons/district_dahlem.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(60.0, 20.0) ); } else if (sites[4]==32) { var custompin = new google.maps.MarkerImage("/css/icons/district_zehlendorf.png", null, null, new google.maps.Point(10, 10), new google.maps.Size(100.0, 20.0) ); } else { var custompin = new google.maps.MarkerImage("/css/icons/bb8-venues-haus.png", null, null, new google.maps.Point(50, 25), new google.maps.Size(120.0, 20.0) ); } marker[i] = new google.maps.Marker({ position: siteLatLng, map: map, flat: true, icon: custompin, title: sites[0], zIndex: sites[3], hash: sites[4] }); google.maps.event.addListener(marker[i], "click", function () { map_recenter(this.getPosition(),50,-150); var thishash = "#"+this.hash; var locinfo = $(".venueoverlay.v_" + this.hash); $(".markerjump").removeClass("selected"); $(".markerjump[href='"+thishash+"']").addClass("selected"); setTimeout(function() { locinfo.fadeIn(260); }, 260); window.location.hash = thishash; }); } }