Popup and markers

Dear Community,

I am having some difficulty enabling popups on my OSM setup.


map = new OpenLayers.Map('map',options);
map.addControl(new OpenLayers.Control.LayerSwitcher()); 
layer = new OpenLayers.Layer.OSM( "Open Street Map"); 
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(8.787, 53.048).transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913")), 12); // Go directly to Bremen
var newl = new OpenLayers.Layer.Text( "Ladestationen", {location:"osm2/textfile.txt"} );
map.addLayer(newl);

Here I have a piece of ruby code (between ,%= %>) that performs a loop and gets a list of points to place the markers. This works fine. However, with popup.hide() or popup.show(), I can only either show all or hide all popups.


popup = new OpenLayers.Popup("<%=sub.name%>",coord,new OpenLayers.Size(200,200),"<%=n%>",true); 
map.addPopup(popup);
popup.toggle(); // popup.hide();

Is there a way to make the popup show on a mouseclick?

Any help would be appreciated.

Thank you,

Shailen.