var map; var google_street, popup, markers, feature; var p = [ new OpenLayers.Bounds(141.04248, -39.3, 150.00732, -34.05266), new OpenLayers.Bounds(144.28336, -36.75716, 144.27482, -36.76225), ]; function addMarker(ll, popupClass, popupContentHTML, closeBox, overflow) { feature = new OpenLayers.Feature(markers, ll); feature.closeBox = closeBox; feature.popupClass = popupClass; feature.data.popupContentHTML = popupContentHTML; feature.data.overflow = (overflow) ? "auto" : "hidden"; var marker = feature.createMarker(); var markerClick = function (evt) { if (this.popup == null) { this.popup = this.createPopup(this.closeBox); map.addPopup(this.popup); this.popup.show(); } else { this.popup.toggle(); } currentPopup = this.popup; OpenLayers.Event.stop(evt); }; marker.events.register("mousedown", feature, markerClick); markers.addMarker(marker); return marker } function add() { this.popup = feature.createPopup(feature.closeBox); map.addPopup(popup); } function mapContents() { var options = {numZoomLevels: 10}; map = new OpenLayers.Map("map", options); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.KeyboardDefaults()); map.addControl(new OpenLayers.Control.PanZoomBar()); this.google_street = new OpenLayers.Layer.Google( "Google Street Map", {type: G_HYBRID_MAP, "maxZoomLevel":16} ); markers = new OpenLayers.Layer.Markers("bunjathai"); map.addLayer(markers); AutoSizeFramedCloud = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {'autoSize': true, 'minSize': new OpenLayers.Size(150,100)}); AutoSizeAnchored = OpenLayers.Class(OpenLayers.Popup.Anchored, {'autoSize': true}); ll = new OpenLayers.LonLat(144.27936, -36.75918); popupClass = AutoSizeFramedCloud; popupContentHTML = '

Bunja Thai

'; var marker = addMarker(ll, popupClass, popupContentHTML, true); this.google_street.setVisibility(true); this.google_street.setIsBaseLayer(true); map.addLayer(google_street); map.zoomToExtent(p[1]); add(); }