function init_wrmap(i, jq_map) { jq_map = $(jq_map); var jq_sledruns = jq_map.children(); jq_sledruns.detach(); // Introduce EPSG:3857 as an alias of the built in EPSG:900913 projection (both are the "Google/OSM" projections) var EPSG4326 = new OpenLayers.Projection("EPSG:4326"); // lon/lat var EPSG3857 = new OpenLayers.Projection("EPSG:3857"); // google // Create the map var map = new OpenLayers.Map(jq_map.context, { projection: EPSG3857, displayProjection: EPSG4326, units: "m", theme: null }); // Google Layer var layer_map = new OpenLayers.Layer.Google("Google Physical", { type: google.maps.MapTypeId.TERRAIN }); // // Alternative: OSM map // var layer_map = new OpenLayers.Layer.OSM(); // // Alternative: Microsoft Bing Maps // var layer_map = new OpenLayers.Layer.Bing({ // type: "Road", // key: "AgPH3SlIXAwajrJKf0FORQyhTqsP8KIlvtN6RKfvxe6fOB6q6-HFmg8EOFm7LSOA"}); // Sledrun layer var layer_sledruns = new OpenLayers.Layer.Vector("Rodelbahnen", { styleMap: new OpenLayers.StyleMap({ "default": new OpenLayers.Style({ externalGraphic: "/vorlagen/gmap_rodelbahn_c.png", graphicWidth: 17, graphicHeight: 17, graphicXOffset: -8, graphicYOffset: -8, graphicZIndex: 11, backgroundGraphic: "/vorlagen/gmap_rodelbahn_c_s.png", backgroundWidth: 23, backgroundHeight: 23, backgroundXOffset: -8, backgroundYOffset: -8, backgroundZIndex: 12, title: "${label}" }), "highlight": new OpenLayers.Style({ label: "${label}", labelOutlineColor: "white", labelYOffset: 12, fontWeight: "bold" }) }), rendererOptions: {yOrdering: true} }); jq_sledruns.each(function(j, jq_sledrun) { jq_sledrun = $(jq_sledrun); var lon = parseFloat(jq_sledrun.attr('data-lon')); var lat = parseFloat(jq_sledrun.attr('data-lat')); var point = new OpenLayers.Geometry.Point(lon, lat).transform(EPSG4326, EPSG3857); layer_sledruns.addFeatures([new OpenLayers.Feature.Vector(point, { label: jq_sledrun.attr('data-title'), url: jq_sledrun.attr('data-url') })]); }); map.addControl(new OpenLayers.Control.SelectFeature(layer_sledruns, { hover: true, highlightOnly: true, autoActivate: true, renderIntent: "highlight" })); map.addControl(new OpenLayers.Control.SelectFeature(layer_sledruns, { autoActivate: true, toggle: true, onSelect: function(feature) { // Open popup var selectFeatureControl = this; var popup = new OpenLayers.Popup.FramedCloud("sledruninfopopup_" + feature.attributes['label'], feature.geometry.getBounds().getCenterLonLat(), null, "