/**
 * @author Pascal MARTIN
 * 
 * Copyright (c) 2007-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 initMap = function ()
{
  var map = new google.maps.Map2(document.getElementById('map_canvas'));   
  var adresse = document.forms["postale"].elements["adresse"].value;
  var res = document.forms["postale"].elements["residence"].value;

    // Recherche des coordonnées d'un point dont on connait l'adresse :
    var geocoder = new google.maps.ClientGeocoder();
    geocoder.getLatLng(adresse, function (coord) {
            // Et centrage de la map sur les coordonnées renvoyées par Google :
            map.setCenter(coord, 10);
			var myIcon = new GIcon();
myIcon.image = "http://www-dev.catalogue-liins.com/wp-content/themes/corporate/images/picto/marker.png";
myIcon.iconSize = new GSize(30, 30);
myIcon.iconAnchor = new GPoint(1, 5);
myIcon.infoWindowAnchor = new GPoint(1, 4);
var markerOptions = {
    icon: myIcon};
var marker = new GMarker(coord, markerOptions);  // Création d'un marqueur localisé sur ce point
		

    marker.openInfoWindowHtml(
            '<strong>'+res+'</strong><br />'+adresse
      );
 var window = function() {
    marker.openInfoWindowHtml(
             '<strong>'+res+'</strong><br />'+adresse
      );};
 
map.addOverlay(marker);GEvent.addListener(marker, "click", window);
map.addControl(new GLargeMapControl());

        });
}; // initMap
