﻿function ErrorReadPosition() {
    alert("Erreur sur l'api.");
}
function initialisation() {
    geocoder = new google.maps.Geocoder();
    latlng = new google.maps.LatLng(46.75984, 1.738281);
    var opt = {
        zoom: 6,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map"), opt);
    ReadPosition();
    //navigator.geolocation.getCurrentPosition(ReadPosition, ErrorReadPosition);
}

function initialisationPostCode(address) {
    geocoder = new google.maps.Geocoder();
    var opt = {
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map"), opt);
    geocoder.geocode({ 'address': address }, function (results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            map.setCenter(results[0].geometry.location);
        }
    });
    ReadPosition();
}
