jQuery(function($) {
    // First create a div to host the map
    var themap = $('<div id="themap"></div>').css({
        'width': '720px',
        'height': '450px',
		'border': '5px solid #ccc'
    }).insertAfter('.inthedom');

    // Now initialise the map
    var mapstraction = new Mapstraction('themap','google');
    mapstraction.addControls({
        zoom: 'small',
        map_type: true
    });

    // Show map centred on Tunisia
    mapstraction.setCenterAndZoom(
        new LatLonPoint(33.88692,  	9.53750),
        2 // Zoom level
    );

    // Geocode each hcard and add a marker
    $('.vcard').each(function() {
        var hcard = $(this);
    
        var latitude = hcard.find('.geo .latitude').text();
        var longitude = hcard.find('.geo .longitude').text();
    
        var marker = new Marker(new LatLonPoint(latitude, longitude));
        marker.setInfoBubble(
            '<div class="bubble">' + hcard.html() + '</div>'
        );
        mapstraction.addMarker(marker);
    });
});

