// JavaScript Document

//<![CDATA[
           var WINDOW_HTML = '<div><strong>Camping des Chaumières **<\/strong><br />24 Hameau de Kérascoët<br />29920 NEVEZ<br /> Finistère / Bretagne Sud<\/div>';


            function placeMarker(map, myLatlng, titre,contenu) {
                var marker = new google.maps.Marker({
                    position: myLatlng,
                    map: map,
                    title:titre
                });

                var infowindow = new google.maps.InfoWindow({
                    content: contenu
                });

                google.maps.event.addListener(marker, 'click', function() {
                    infowindow.open(map,marker);
                });

                infowindow.open(map, marker);
            }

        var directionDisplay;
        var directionsService = new google.maps.DirectionsService();
        var latlng;

            function initialize() {
                ///map 1
                latlng = new google.maps.LatLng(47.79670,-3.77455);
                var myOptions = {
                    zoom: 11,
                    center: latlng,
                    mapTypeControl:true,
                    mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
                    navigationControl: true,
                    navigationControlOptions: {style: google.maps.NavigationControlStyle.ZOOM_PAN},
                    scaleControl: true,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                };
                //var map = new google.maps.Map(document.getElementById("map"), myOptions);

          directionsDisplay = new google.maps.DirectionsRenderer();

         var mapiti = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
         placeMarker(mapiti, latlng, "Camping des Chaumières, Nevez - Finistère",WINDOW_HTML);
         directionsDisplay.setMap(mapiti);
         directionsDisplay.setPanel(document.getElementById("directionsPanel"));
        }

        function calcRoute() {
         var start = document.getElementById("start").value;
         //var end = document.getElementById("end").value;
         var request = {
          origin:start,
          destination:latlng,
          travelMode: google.maps.DirectionsTravelMode.DRIVING
         };
         directionsService.route(request, function(response, status) {
          if (status == google.maps.DirectionsStatus.OK) {
           directionsDisplay.setDirections(response);
          }
         });
        }

        $("#start").live("keypress", function(e) {
          /* ENTER PRESSED*/
          if (e.keyCode == 13) {
            $("#ok").trigger('click');
          }
        });

            //]]>