+
+ /** Implement a drag and drop for markers */
+ /* TODO: veryfy that the scoping of variables works correctly everywhere */
+ var dragging = false;
+ var dragFunction = function(e) {
+ map.events.unregister("mouseup",map,dragFunction);
+ lonlat = map.getLonLatFromViewPortPx(e.xy);
+ lonlatApi = lonlat.clone().transform(map.getProjectionObject(), map.osbLayer.apiProjection);
+ marker.moveTo(map.getLayerPxFromViewPortPx(e.xy));
+ marker.popup.moveTo(map.getLayerPxFromViewPortPx(e.xy));
+ marker.popup.updateRelativePosition();
+ dragging = false;
+ return false;
+ };
+
+ marker.events.register("mouseover", this,
+ function(){ document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "move"; });
+ marker.events.register("mouseout", this,
+ function(){ if (!dragging) {document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "default"; }});
+ marker.events.register("mousedown", this,
+ function() { dragging = true; map.events.register("mouseup",map, dragFunction); return false;});
+
+