// init function will be executed when dom is ready
function init() {
if (GBrowserIsCompatible()) {
// Create a new google map
var map = new GMap2(document.getElementById('map_sample2'));
// Center on the world
map.setCenter(new GLatLng(47, 1), 4);
// Add controls
map.addControl(new GSmallMapControl());
// Attach maptimize service
var maptimizeMap = new Maptimize.Map(map, {
onMarkerClicked: function(marker) {
// marker: is an instance of Maptimize.Marker
marker.getGMarker().openInfoWindowHtml('ID = ' + marker.getId());
},
onZoomMaxClusterClicked: function(cluster, ids) {
// cluster: is an instance of Maptimize.Cluster
cluster.getGMarker().openInfoWindowHtml('IDS = ' + ids);
}
});
}
}
// Code based on Prototype. Of course you can use any JavaScript framework
// like jQuery for example : $(document).ready(init);
//
// Or use window onload event : window.onload = init;
document.observe('dom:loaded', init);