+var infoWindow; // shared among all users
+
+var clickHandler = function(ev) {
+ var feature = ev.feature;
+ if ( feature.getGeometry().getType() == 'Point' ) {
+ // then pop up an info box with the feature content
+ infoWindow.close();
+ infoWindow.setPosition(feature.getGeometry().get());
+
+ if ( feature.getProperty('content') ) {
+ infoWindow.setContent(feature.getProperty('content'));
+ } else {
+ infoWindow.setContent('');
+ }
+
+ if ( feature.getProperty('url') ) {
+ $.ajax({
+ url: feature.getProperty('url'),
+ success: function(data) {
+ infoWindow.setContent(data);
+ }
+ });
+ infoWindow.open(map);
+ } else {
+ infoWindow.open(map);
+ }
+ }
+
+ // snap to feature ROI if it has one
+ if ( feature.getProperty('bounds') ) {
+ map.fitBounds( feature.getProperty('bounds') );
+ }
+
+};
+
+var initMap = function() {