var ib = null; var marker = new Array(); var sites = [ [51.314120,9.497390,0,'

Fridericianum

Friedrichsplatz 18

34117 Kassel

','1']]; var boxText = document.createElement("div"); boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: yellow; padding: 5px;"; boxText.innerHTML = "Empty"; var boxOptions = { alignBottom: true ,content: boxText ,disableAutoPan: false ,maxWidth: 0 ,pixelOffset: new google.maps.Size(-118, -48) ,zIndex: null ,boxStyle: { background: "#fff", width: "212px", height: "59px", padding: "12px", borderRadius: "5px" } ,closeBoxMargin: "0px 0px 0px 0px" ,closeBoxURL: "/css/img/fridericianum-close.png" ,infoBoxClearance: 100 ,isHidden: false ,pane: "floatPane" ,enableEventPropagation: false }; var ib = new InfoBox(boxOptions); var initzoom = 17; $(document).ready(function () { initialize(); moveAndInfo(0); }); function initialize() { var centerMap = new google.maps.LatLng(sites[0], sites[1]); var myOptions = { zoom: initzoom, center: centerMap ,mapTypeId: google.maps.MapTypeId.ROADMAP ,disableDefaultUI: true ,zoomControl: true ,zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL } } var styleOptions = { name: "Dummy Style" }; var MAP_STYLE = [ { stylers: [ { "saturation": -100 } ] } ]; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); setMarkers(map, sites); var mapType = new google.maps.StyledMapType(MAP_STYLE, styleOptions); map.mapTypes.set("Dummy Style", mapType); map.setMapTypeId("Dummy Style"); infowindow = new google.maps.InfoWindow({ content: "loading..." }); } function moveAndInfo(marker_id){ var row = find(marker_id, sites); var loc = new google.maps.LatLng(sites[row][0], sites[row][1]); map.setCenter(loc); } 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 setMarkers(map, markers) { var defaultpin = new google.maps.MarkerImage( "/css/img/fridericianum-pin-x2.png", null, null, null, new google.maps.Size(26, 30) ); var hash = ""; for (var i = 0; i < markers.length; i++) { var sites = markers[i]; var siteLatLng = new google.maps.LatLng(sites[0], sites[1]); marker[i] = new google.maps.Marker({ position: siteLatLng, map: map, icon: defaultpin, zIndex: sites[2], html: sites[3], hash: sites[5] }); var contentString = "Some content"; google.maps.event.addListener(marker[i], "click", function () { ib.setContent(this.html); ib.open(map, this); var thishash = "#"+this.hash; $(".markerjump").removeClass("selected"); $(".markerjump[href='"+thishash+"']").addClass("selected"); window.location.hash = thishash; }); } }