var map = null;

/* When Google maps API is loaded, draw the map at the appropriate location
------------------------------ */
function maps_loaded() {

  map = new GMap2( document.getElementById( 'googlemap' ) );
  map.setMapType( G_HYBRID_MAP );
  map.setUIToDefault();
  map.setCenter(new GLatLng( 49.8592347, 6.1221313), 9);
  add_markers();
}

function add_markers() {
  var points = new Array();
  $( '#google li' ).each( function() {
    if(points.length<100){
      var lat = $( '.geo .latitude', this ).text();
      var lon = $( '.geo .longitude', this ).text();
      var m = new GMarker( new GLatLng( lat, lon ) );
      m.bindInfoWindowHtml( '<div class="google_item"><p><strong>' + $( '.title', this ).html() + '</strong><br /><em>' + $( '.date', this ).html() + '</em><br />' + $( '.address', this ).html() + '</p></div>' );
      map.addOverlay( m );
      points.push(new GLatLng(lat, lon));
    }    
  });
}

$( document ).ready( function() {
  // load the Google Maps API
  maps_loaded();
});
