
function initialize() {
    if (GBrowserIsCompatible()) {
        var mapID;
        if (mapID = document.getElementById("googlemap")) {
        } else {
            mapID = document.getElementById("biggooglemap");
        }
        var map = new google.maps.Map2(mapID);
        map.setCenter(new google.maps.LatLng(46.8624960, 103.8466560), 5);
        map.setUIToDefault();

        var places = [
        {
            pays: 'France',
            address: 'Lille',
            lat: 50.6371834,
            lng: 3.0630174
        },

        {
            pays: 'Belgique',
            address: 'Brugge',
            lat: 51.2094345,
            lng: 3.2252377
        },

        {
            pays: 'La Haye',
            address: 'pays-bas',
            lat: 52.0782886,
            lng: 4.3136850
        },

        {
            pays: 'Allemagne',
            address: 'Hoxter',
            lat: 51.7739820,
            lng: 9.3812895
        },

        {
            pays: 'Allemagne',
            address: 'Berlin',
            lat: 52.5234051,
            lng: 13.4113999
        },


        {
            pays: 'Pologne',
            address: 'Pila',
            lat: 53.1509671,
            lng: 16.7382266
        },


        {
            pays: 'Russie',
            address: 'Kaliningrad',
            lat: 54.7115951,
            lng: 20.5099722
        },

        {
            pays: 'Lettonie',
            address: 'Riga',
            lat: 56.9465378,
            lng: 24.1048495
        },

        {
            pays: 'Estonie',
            address: 'Tartu',
            lat: 58.4109383,
            lng: 26.6670761
        },

        {
            pays: 'Russie',
            address: 'St-Petersbourg',
            lat: 60.2427814,
            lng: 30.7595630
        },

        {
            pays: 'Russie',
            address: 'Moscou',
            lat: 55.7557860,
            lng: 37.6176330
        },

        {
            pays: 'Russie',
            address: 'Irkoutsk',
            lat: 52.4168000,
            lng: 104.5279999
        },

        {
            pays: 'mongolie',
            address: 'mongolie',
            lat: 46.8624960,
            lng: 103.8466560,
            currentPos: 1
        },

        {
            pays: 'Chine',
            address: 'Shanghai',
            lat: 31.2243531,
            lng: 121.4759159
        }

        ];

        var createMarker = function(places, options)
        {
            var point = new google.maps.Point(places.lng, places.lat);
            var marker = new google.maps.Marker(point, options);

            GEvent.addListener(marker, "click", function() {
                marker.openInfoWindowHtml(
                    "<strong>" + places.pays + "</strong> - "
                    + places.address + "<p><a href=\"./itineraire.php\">Itinéraire</a></p>");
            });

            return marker;
        };

        var createLine = function(places) {
            return new google.maps.LatLng(places.lat, places.lng);
        }

        lines = new Array();

        var bikeIcon = new GIcon(G_DEFAULT_ICON);
        bikeIcon.image = "http://www.lilleshanghai.fr/images/googlemap/bike.png";
        bikeIcon.iconSize = new GSize(35, 31);
        bikeIcon.iconAnchor = new GPoint(9, 34);
        bikeIcon.infoWindowAnchor = new GPoint(9, 2);

        var baseIcon = new GIcon(G_DEFAULT_ICON);
        baseIcon.image = "http://www.lilleshanghai.fr/images/googlemap/icon.png";
        baseIcon.iconSize = new GSize(10, 10);
        baseIcon.shadow = "";
        baseIcon.iconAnchor = new GPoint(5, 5);

        for (var i=0 ; i < places.length ; i++)
        {
            lines.push(createLine(places[i]));

            if (places[i].currentPos) {
                
                var myIcon = new GIcon(bikeIcon);
                map.addOverlay(createMarker(places[i], {
                    icon:myIcon
                } ));

                var polylineDone = new GPolyline(lines, "#0072ff", 5);
                map.addOverlay(polylineDone);
                lines = new Array();
                lines.push(createLine(places[i]));
            } else {
                var mybaseIcon = new GIcon(baseIcon);
                map.addOverlay(createMarker(places[i], {
                    icon:mybaseIcon
                } ));
            }
        }
        var polyline = new GPolyline(lines, "#FF0000", 5); //0072ff
        map.addOverlay(polyline);
    }
}

var init = function ()
{
    google.load("maps", "2");
    google.setOnLoadCallback(initialize);
}; // init
