title: How to add a popup box to a vector in OpenLayers?
body: <p>In a previous version of my program I used <code>markers</code> to mark points on the map. In the current version I had to change from <code>markers</code> to <code>vectors</code>, because I need the extra flexibility. In the markers solution I used the function below to add a popup-box to a marker:</p>
  
  <pre><code>function createPopupBoxFeature(vector, lonLat, description) {
      var feature = new OpenLayers.Feature(vector, lonLat);
  
      feature.closeBox = true;
      feature.popupClass = OpenLayers.Class(OpenLayers.Popup.AnchoredBubble, 
          { "autoSize": true });
      feature.data.popupContentHTML = description;
  
      vector.events.register("mousedown", feature, function(evt) {
          if (this.popup == null) {
              this.popup = this.createPopup(this.closeBox);
              map.addPopup(this.popup);
              this.popup.show();
          } else {
              this.popup.toggle();
          }
          OpenLayers.Event.stop(evt);
      });
  
      return feature;
  }
  </code></pre>
  
  <p>But it is no longer working for <code>vectors</code>, because they have no <code>events</code> property. How do I fix this?</p>