/**
 * @author Pascal MARTIN
 * 
 * Copyright (c) 2008 Pascal MARTIN
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

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


var createMarker = function(infosStation)
{
    var point = new GPoint(infosStation.lng, infosStation.lat);
    var marker = new GMarker(point);
    return marker;
}; // createMarker



var initMap = function ()
{
    var map = new google.maps.Map2(document.getElementById('map'));
    map.addControl(new GSmallMapControl());  // Contrôle de zoom, déplacement sur la carte
    
    var adresse = 'place bellecour, Lyon, france';
    var geocoder = new google.maps.ClientGeocoder();
    geocoder.getLatLng(adresse, function (coord) {
        map.setCenter(coord, 13);  // Centrage sur le point dont on a obtenu les coordonnées depuis l'adresse
        map.setMapType(G_HYBRID_MAP);  // Vue satellite + informations cartographiques
        
        // Ajout d'un marqueur pour chacune des stations de metro de Lyon
        for (var i=0 ; i<stationsMetro.length ; i++)
        {
            map.addOverlay(createMarker(stationsMetro[i]));
        }
        
    });
    
}; // initMap




// Liste des stations de metro de Lyon
var stationsMetro = [
    // Ligne A
    {ligne: 'A', loc: 'L. Bonnevay Astroballe', lat: 45.76434960130271, lng: 4.91063117980957},
    {ligne: 'A', loc: 'Cusset', lat: 45.76482861073421, lng: 4.901275634765625},
    {ligne: 'A', loc: 'Flachet', lat: 45.76746308908782, lng: 4.890203475952148},
    {ligne: 'A', loc: 'Gratte-ciel', lat: 45.76961847883504, lng: 4.881963729858398},
    {ligne: 'A', loc: 'République - Villeurbanne', lat: 45.770336923575734, lng: 4.874238967895508},
    {ligne: 'A', loc: 'Charpennes - Charles Hernu', lat: 45.77027705353416, lng: 4.86393928527832},
    {ligne: 'A', loc: 'Masséna', lat: 45.769139510533385, lng: 4.852867126464844},
    {ligne: 'A', loc: 'Foch', lat: 45.76866053811873, lng: 4.8442840576171875},
    {ligne: 'A', loc: 'Hôtel de ville - Louis Pradel', lat: 45.766984102277746, lng: 4.836387634277344},
    {ligne: 'A', loc: 'Cordeliers', lat: 45.7632119374188, lng: 4.835872650146484},
    {ligne: 'A', loc: 'Bellecour', lat: 45.7579424547621, lng: 4.833469390869141},
    {ligne: 'A', loc: 'Ampère - Victor Hugo', lat: 45.75261258543035, lng: 4.829092025756836},
    {ligne: 'A', loc: 'Perrache', lat: 45.74991751391586, lng: 4.826860427856445},
    
    // Ligne B
    {ligne: 'B', loc: 'Charpennes - Charles Hernu', lat: 45.77021718342828, lng: 4.86393928527832},
    {ligne: 'B', loc: 'Brotteaux', lat: 45.76692422863731, lng: 4.860076904296875},
    {ligne: 'B', loc: 'Part-Dieu - Vivier Merle', lat: 45.761655096613836, lng: 4.857416152954102},
    {ligne: 'B', loc: 'Place Guichard - Bourse du Travail', lat: 45.758541284673115, lng: 4.846601486206055},
    {ligne: 'B', loc: 'Saxe-Gambetta', lat: 45.75339113741727, lng: 4.846172332763672},
    {ligne: 'B', loc: 'Jean Macé', lat: 45.74596450695352, lng: 4.842138290405273},
    {ligne: 'B', loc: 'Place Jean Jaurès', lat: 45.73919582992084, lng: 4.838705062866211},
    {ligne: 'B', loc: 'Debourg', lat: 45.731168193601526, lng: 4.83372688293457},
    {ligne: 'B', loc: 'Stade de Gerland', lat: 45.72745352362198, lng: 4.83123779296875}, 
    
    // Ligne C
    {ligne: 'C', loc: 'Cuire', lat: 45.7850630013786, lng: 4.8332977294921875},
    {ligne: 'C', loc: 'Henon', lat: 45.77907726002176, lng: 4.827632904052734},
    {ligne: 'C', loc: 'Croix-Rousse', lat: 45.774108606638094, lng: 4.8319244384765625},
    {ligne: 'C', loc: 'Croix-Paquet', lat: 45.77021718342828, lng: 4.836645126342773},
    {ligne: 'C', loc: 'Hôtel de ville - Louis Pradel', lat: 45.76704397585394, lng: 4.835958480834961},
    
    // Ligne D      
    {ligne: 'D', loc: 'Gare de Vaise', lat: 45.77955614297965, lng: 4.804630279541016},
    {ligne: 'D', loc: 'Valmy', lat: 45.77464739768229, lng: 4.806003570556641},
    {ligne: 'D', loc: 'Gorge de loup', lat: 45.76626561435079, lng: 4.805917739868164},
    {ligne: 'D', loc: 'Vieux Lyon - Cathédrale Saint Jean', lat: 45.75955928077279, lng: 4.826602935791016},
    {ligne: 'D', loc: 'Bellecour', lat: 45.757643037396626, lng: 4.83372688293457},
    {ligne: 'D', loc: 'Guillotière', lat: 45.75524764063347, lng: 4.843254089355469},
    {ligne: 'D', loc: 'Saxe-Gambetta', lat: 45.75363068968973, lng: 4.846687316894531},
    {ligne: 'D', loc: 'Garibaldi', lat: 45.75111533954443, lng: 4.854669570922852},
    {ligne: 'D', loc: 'Sans-souci', lat: 45.74740199642105, lng: 4.865655899047852},
    {ligne: 'D', loc: 'Montplaisir-lumière', lat: 45.74602440308707, lng: 4.87269401550293},
    {ligne: 'D', loc: 'Grange Blanche', lat: 45.74267012063783, lng: 4.879560470581055}, 
    {ligne: 'D', loc: 'Laënnec', lat: 45.73799774851087, lng: 4.886941909790039},
    {ligne: 'D', loc: 'Mermoz Pinel', lat: 45.72961045884861, lng: 4.887714385986328},
    {ligne: 'D', loc: 'Parilly', lat: 45.71966389740984, lng: 4.8882293701171875},
    {ligne: 'D', loc: 'Gare de Vénissieux', lat: 45.70557989372282, lng: 4.888143539428711}
]; // stationsMetro



