

function initializeMapaMarker(capa,latitud,longitud,zoom)
{

    var latlng = new google.maps.LatLng(latitud, longitud);
    var myOptions = {
        scrollwheel: false,
        navigationControl: true,
        mapTypeControl: false,
        scaleControl: false,
        draggable: true,
        zoom: zoom,
        center: latlng,
        mapTypeControlOptions: {
            mapTypeIds: [google.maps.MapTypeId.ROADMAP]
        },
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    var mapa = new google.maps.Map(document.getElementById(capa),myOptions);

    var nuevoMarcador = new google.maps.Marker({
         position: latlng,
         map: mapa,
         draggable: false,
         icon:'/img/icon-hotel.png'
    });
}



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

function initialize(latitud,longitud) 
{
    directionsDisplay = new google.maps.DirectionsRenderer();
    var latlng = new google.maps.LatLng(latitud, longitud);
    var myOptions = {
        zoom:7,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        center: latlng
    }
    map = new google.maps.Map(document.getElementById("mapa"), myOptions);
    directionsDisplay.setMap(map);
    directionsDisplay.setPanel(document.getElementById("direcciones"));
}

function calcRoute(start_latitud, start_longitud, end_latitud, end_longitud) 
{
    if (start_latitud==undefined)
    { 
        start_latitud = "36.68054915750742";
        start_longitud = "-4.494141923828124";
    }
    if (end_latitud==undefined)
    {    
        end_latitud = "36.4952825265313";
        end_longitud = "-4.772919985412578";
    }
    var request = {
        origin:new google.maps.LatLng(start_latitud, start_longitud), 
        destination:new google.maps.LatLng(end_latitud, end_longitud),
        travelMode: google.maps.DirectionsTravelMode.DRIVING,
        language: "español",
        region: "ES"
    };
    directionsService.route(request, function(response, status) {
        if (status == google.maps.DirectionsStatus.OK) {
            directionsDisplay.setDirections(response);
        }
    });
}
