jQuery(function($) {
 // First create a div to host the map
 var themap = jQuery('<div id="themap"></div>').css({
  'width': '90%',
  'height': '400px'
 }).insertBefore('div.frontplaces:first');

 // Now initialise the map
 var mapstraction = new Mapstraction('themap','google');
 mapstraction.addControls({
  zoom: 'large',
  map_type: true
 });

 mapstraction.setCenterAndZoom(
  new LatLonPoint(58.4, 15.7),
  8
 );

 // Add all coordinates in pretty data structure
 // 'Name': [latitude, longitude]
 var places = {
  'BFC Åtvidaberg' : [58.1971194, 15.9985417],
  'BFC Kisa' : [57.9844389, 15.6318278],
  'BFC Linköping' : [58.4087139, 15.6463972]
 };
 
 jQuery('.vcard').each(function() {
  var hcard = jQuery(this);
  var placename = hcard.find('.fn').text();
  var place = places[placename];

  var latitude = place[0];
  var longitude = place[1];

  var marker = new Marker(new LatLonPoint(latitude, longitude));
  marker.setLabel(placename);
  marker.setInfoBubble(
   '<div class="bubble">' + this.innerHTML + '</div>'
  );
  mapstraction.addMarker(marker);
 });
});
