/* J_Inc_Map.jsp */ var infowindow; var map; var coordinatesHotel = null; var selectedHotel = ""; var sourcePage = "SearchAvailability"; var CoordinatesHotelClass = function(hotelLatitude, hotelLongitude){ this.hotelLatitude = hotelLatitude; this.hotelLongitude = hotelLongitude; } function googleMapInitialize(idSolRes, currentOnly) { var zoomValue = ""; if (idSolRes!="") selectedHotel=idSolRes; else selectedHotel = ""; if (currentOnly=="true" && zoomValue!="" ) { var mapOptions = {zoom: zoomValue}; } else if (currentOnly=="true") { var mapOptions = {zoom: 16}; } else { var mapOptions = {}; } map = new google.maps.Map(document.getElementById('googlemap'), mapOptions); infowindow = new google.maps.InfoWindow(); var bounds = new google.maps.LatLngBounds(); var iconAvailable = "https://maps.google.com/mapfiles/marker.png"; var iconUnavailable = "https://maps.google.com/mapfiles/marker_grey.png"; var iconCurrent = "https://maps.google.com/mapfiles/marker_green.png"; var icon; var selectedHotelLatLng; var selectedHotelMarker; var zIndex; // Directions var directionsService = new google.maps.DirectionsService(); var directionsDisplay = new google.maps.DirectionsRenderer(); directionsDisplay.setMap(map); // Autocompleta la direccion DESDE var input = document.getElementById('fromAddress'); if (input != null) { var inputClass = input.className; var autocomplete = new google.maps.places.Autocomplete(input); autocomplete.bindTo('bounds', map); google.maps.event.addListener(autocomplete, 'place_changed', function() { input.className = inputClass; var place = autocomplete.getPlace(); if (!place.geometry) { return; } }); } if (coordinatesHotel != null) { $i("#directions-instructions").append('
'); $i('#directions-panel').hide(); var directions_panel = $i('#directions-panel'); if ($i(directions_panel).length > 0) { var start = $i('div.directions input#fromAddress').val(); var end = coordinatesHotel.hotelLatitude + ',' + coordinatesHotel.hotelLongitude; calculateRoute(start, end); directionsDisplay.setPanel(document.getElementById('directions-panel')); map.fitBounds(bounds); } } else { if ($i('body').attr("id")=="booking_zone" || $i('body').attr("id")=="booking_rates" || $i('body').attr("id")=="booking_extras" || $i('body').attr("id")=="booking_step1" || $i('body').attr("id")=="booking_step2" || $i('body').attr("id")=="vouchers_zone" || $i('body').attr("id")=="vouchers_rates" || $i('body').attr("id")=="vouchers_step1" || $i('body').attr("id")=="vouchers_step2") { sourcePage="SearchAvailability"; if (currentOnly!="true") { if (!resultsFiltered) { } } addMarker('6200080', '37.093317', '-8.1841080000', iconAvailable, null); } if ($i('body').attr("id")=="userbookings") { sourcePage="UserBookings"; if ('6200082'==idSolRes) { addMarker('6200082', '37.094717', '-8.189759', iconAvailable, null); } if ('6200081'==idSolRes) { addMarker('6200081', '37.093317', '-8.184108000000', iconAvailable, null); } if ('6200083'==idSolRes) { addMarker('6200083', '37.087208', '-8.226383', iconAvailable, null); } if ('6200080'==idSolRes) { addMarker('6200080', '37.093317', '-8.1841080000', iconAvailable, null); } } if ($i('body').attr("id")=="standalonemap") { sourcePage="StandAloneHotelMap"; addMarker('', '', '', null); coordinatesHotel = new CoordinatesHotelClass('', ''); $i('div.directions input#toAddress').val(''); } if ($i('body').attr("id")=="manage_booking") { sourcePage="CancelBooking"; addMarker('', '', '', iconAvailable, null); } if ($i('body').attr("id")=="home" || $i('body').attr("id")=="usernewbooking" || $i('#idiso-be-search-widget').length > 0) { sourcePage="SearchHome"; for (var i=0; i"+data+""); infowindow.open(map, marker); $i('#currency-filter').trigger("change"); callMagnificPopUp(); } }); } function setFromAddress() { if ($i('div.directions input#fromAddress').val() == null || $i('div.directions input#fromAddress').val() == '') { $i('div.directions input#fromAddress').parent().addClass("error"); $i('div.directions input#fromAddress').parent().css('width', '278px'); $i('div.directions input#fromAddress').css('font-size', '13px'); return; } // Borramos las anteriores busquedas de itinerario $i('div#directions-panel').remove(); // Repintamos mapa googleMapInitialize(); } function callMagnificPopUp(){ $i('.googleMapsMagnificPopup').magnificPopup({ type: 'ajax' }); } $i(function() { $i('div.directions input#fromAddress').on("focus",function() { $i(this).parent("div").removeClass("error"); $i(this).parent("div").css('width', '280px'); $i(this).css('font-size', '14px'); }); }) /* / J_Inc_Map.jsp */