var latitudCM=0.0; var longitudCM=0.0; var cargaInicial=true; var arrayDatosMapa = new Array(); function buildDatosMapa(arrayDatosHoteles) { if( !arrayDatosHoteles )return false; arrayDatosMapa = new Array(); //Inicializamos la variable para que se construya solo con los datos nuevos del arrayDatosHoteles // Filtramos datos de lat/lng para quitar valores inconsistentes for(var i=0; i= 17 && zoomActual < 21) GoogleMaps.map.setZoom(GoogleMaps.map.getZoom()+1); //////if (zoomActual < 17) GoogleMaps.map.setZoom(17); markerAddress = new google.maps.Marker({ map: GoogleMaps.map, position: results[0].geometry.location, zIndex: google.maps.Marker.MAX_ZINDEX + 1 }) } else { alertPopUp("Geocoding sem êxito devido a: "+ status); } } function getGeocoderZoomMap(c, coordinates) { var dMin=0; // distancia del hotel más cercano al centro var coordinatesMin = null; // Calculamos la coordinate con mínima distancia al centro if (coordinates.length) { var bounds = new google.maps.LatLngBounds(); for (var i = 0; i < coordinates.length; i++) { d = distanceFromLatLng(c.lat(), c.lng(), coordinates[i].lat(), coordinates[i].lng()) if (i == 0 || d < dMin) { dMin = d; coordinatesMin = coordinates[i]; } } // calculamos cordenada opuestas a la minima y centrada en center c var latOdds = 2 * c.lat() - coordinatesMin.lat(); var lngOdds = 2 * c.lng() - coordinatesMin.lng(); var coordinatesOdds = new google.maps.LatLng(latOdds,lngOdds); // ponemos bounds bounds.extend(coordinatesMin); bounds.extend(coordinatesOdds); // ponemos el contorno GoogleMaps.map.fitBounds(bounds); } } /// geocoder ////////////////////////////////// function crearMarca(map,lat,lng,imagen,imagen_hover,imageSelec,titulo,bocadillo,zindex) { var marker = new google.maps.Marker({ map: GoogleMaps.map, position: new google.maps.LatLng(lat,lng), icon: imagen, //title: titulo, zIndex: zindex }); google.maps.event.addListener(marker, 'mouseover', function(event) { this.setIcon(imagen_hover); }); google.maps.event.addListener(marker, 'mouseout', function(event) { var imagenMostrada=this.getIcon().url; if( (new RegExp(/hotel_seleccionado.png/)).exec(imagenMostrada) ){ }else{ this.setIcon(imagen); } }); // 17/09/2012 cambiamos el mouse over por el click google.maps.event.addListener(marker, 'click', function() { GoogleMaps.openInfoBox(marker,bocadillo); this.setIcon(imageSelec); }); return marker; } function crearMarcaLugarCercano(map,lat,lng,imagen,imagen_hover,imageSelec,titulo,bocadillo,zindex) { var marker = new google.maps.Marker({ map: GoogleMaps.map, position: new google.maps.LatLng(lat,lng), icon: imagen, //title: titulo, zIndex: zindex }); google.maps.event.addListener(marker, 'mouseover', function(event) { this.setIcon(imagen_hover); }); google.maps.event.addListener(marker, 'mouseout', function(event) { var imagenMostrada=this.getIcon().url; if( (new RegExp(/hotel_seleccionado.png/)).exec(imagenMostrada) ){ }else{ this.setIcon(imagen); } }); // 17/09/2012 cambiamos el mouse over por el click google.maps.event.addListener(marker, 'click', function() { GoogleMaps.openInfoBox(marker,bocadillo); this.setIcon(imageSelec); }); return marker; } //**************************************** // Nueva Version Google Maps API V3 //**************************************** var GoogleMaps = { map: null, infoWindow: null, infoBox: null}; GoogleMaps.setBoundsAndCenter = function() { // Make an array of the LatLng's of the markers you want to show var LatLngList = array (new google.maps.LatLng (52.537,-2.061), new google.maps.LatLng (52.564,-2.017)); // Create a new viewpoint bound var bounds = new google.maps.LatLngBounds (); // Go through each... for (var i = 0, LtLgLen = LatLngList.length; i < LtLgLen; i++) { // And increase the bounds to take this point bounds.extend (LatLngList[i]); } // Fit these bounds to the map GoogleMaps.map.fitBounds (bounds); }; GoogleMaps.setBoundsAndCenter2 = function(coordinates) { if (coordinates.length > 1 && !IDEBuscado) { //If you have a list of coordinates, you can loop over them and add them to a LatLngBounds object. Here is a example for the V3 API, but the concept in V2 is similar: var bounds = new google.maps.LatLngBounds(); for (var i = 0; i < coordinates.length; i++) { bounds.extend(coordinates[i]); } // After that, you can get the center with: //////bounds.getCenter(); // Or alternatively, you can call map.fitBounds() directly, which will center the map around the center of the bounds and adjust the zoom, so that the whole bounds will fit exactly into the view port. GoogleMaps.map.fitBounds(bounds); } else { if (!IDEBuscado) { GoogleMaps.map.setCenter(coordinates[0]); } GoogleMaps.map.setZoom(12); } }; /** * Called when clicking anywhere on the map and closes the info window. */ GoogleMaps.closeInfoWindow = function() { GoogleMaps.infoWindow.close(); }; /** * Opens the shared info window, anchors it to the specified marker, and * displays the marker's position as its content. */ GoogleMaps.openInfoWindow = function(marker,content) { var markerLatLng = marker.getPosition(); GoogleMaps.infoWindow.setContent(content); GoogleMaps.infoWindow.open(GoogleMaps.map, marker); }; /** * Called when clicking anywhere on the map and closes the info window. */ GoogleMaps.closeInfoBox = function() { GoogleMaps.infoBox.close(); }; /** * Opens the shared info window, anchors it to the specified marker, and * displays the marker's position as its content. */ var coordinatesOpenInfoBox = null; GoogleMaps.openInfoBox = function(marker,content) { // Posicionamos el mapa con respecto al market que hemos pulsado var markerLatLng = marker.getPosition(); GoogleMaps.map.setCenter(markerLatLng); map_recenter(GoogleMaps.map, markerLatLng,0,-150); // Mostramos el cuadro de dialogo GoogleMaps.infoBox.setOptions({pixelOffset: new google.maps.Size(-160, 10)}); GoogleMaps.infoBox.setContent(content); GoogleMaps.infoBox.open(GoogleMaps.map, marker); }; // Función que realiza un desplazamiento en px respecto a la lat/log que indiquemos function map_recenter(map,latlng,offsetx,offsety) { var point1 = map.getProjection().fromLatLngToPoint( (latlng instanceof google.maps.LatLng) ? latlng : map.getCenter() ); var point2 = new google.maps.Point( ( (typeof(offsetx) == 'number' ? offsetx : 0) / Math.pow(2, map.getZoom()) ) || 0, ( (typeof(offsety) == 'number' ? offsety : 0) / Math.pow(2, map.getZoom()) ) || 0 ); map.setCenter(map.getProjection().fromPointToLatLng(new google.maps.Point( point1.x - point2.x, point1.y + point2.y ))); } /** * Called only once on initial page load to initialize the map. */ GoogleMaps.init = function(latitud,longitud,capa_del_mapa) { // Create single instance of a Google Map.latitud,longitud var centerLatLng = new google.maps.LatLng(latitud,longitud); GoogleMaps.map = new google.maps.Map(document.getElementById(capa_del_mapa), { zoom: 14, center: centerLatLng, //mapTypeControl: true, //mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, //navigationControl: true, //navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL }, overviewMapControl: 1, overviewMapControlOptions: { opened: true }, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeId: google.maps.MapTypeId.ROADMAP }); // Creamos una instancia de InfoBox GoogleMaps.infoBox = new InfoBox({ //content: boxText, disableAutoPan: false, maxWidth: 320, pixelOffset: new google.maps.Size(-160, 10), zIndex: 999, closeBoxURL: "", //boxStyle: {opacity: 0.75,width: "320px"}, closeBoxMargin: "0px 0px 0px 0px", closeBoxURL: "/images/rojo/close.gif", infoBoxClearance: new google.maps.Size(1, 1), isHidden: false, pane: "floatPane" //enableEventPropagation: false }); //Funciones del buscador de calles var InitialBounds = new google.maps.LatLngBounds(); var pac_input = document.getElementById('geoaddress'); //var pac_inputGrande = document.getElementById('geoaddressGrande'); Se quita porque el mapa de google ya trae la opción de ampliar el mapa. FRON-1938 var autocompleteGooglePlaces; (function pacSelectFirst(input) { // store the original event binding function var _addEventListener = (input.addEventListener) ? input.addEventListener : input.attachEvent; function addEventListenerWrapper(type, listener) { // Simulate a 'down arrow' keypress on hitting 'return' when no pac suggestion is selected, // and then trigger the original listener. if (type == "keydown") { var orig_listener = listener; listener = function(event) { var suggestion_selected = $(".pac-item-selected").length > 0; if (event.which == 13 && !suggestion_selected) { var simulated_downarrow = $.Event("keydown", { keyCode: 40, which: 40 }); orig_listener.apply(input, [simulated_downarrow]); } orig_listener.apply(input, [event]); }; } _addEventListener.apply(input, [type, listener]); } input.addEventListener = addEventListenerWrapper; input.attachEvent = addEventListenerWrapper; var options = {}; if (typeof countryCode2 !== "undefined" && $.trim(countryCode2)) { // existe la variable countryCode2 y tiene valor var options = { types: ['address'], componentRestrictions: {country: countryCode2} //code 2 of country }; } else { var options = { types: ['address'] }; } input.value = nombreZonaAddress + ', ' + input.value; autocompleteGooglePlaces = new google.maps.places.Autocomplete(input,options); autocompleteGooglePlaces.addListener('place_changed', function() { var address = $.trim($('#geoaddress').val()); if (address!="") { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': address+', '+nombreZonaAddress}, geocodeResult); } }); })(pac_input); (function pacSelectFirst(input) { // store the original event binding function var _addEventListener = (input.addEventListener) ? input.addEventListener : input.attachEvent; function addEventListenerWrapper(type, listener) { // Simulate a 'down arrow' keypress on hitting 'return' when no pac suggestion is selected, // and then trigger the original listener. if (type == "keydown") { var orig_listener = listener; listener = function(event) { var suggestion_selected = $(".pac-item-selected").length > 0; if (event.which == 13 && !suggestion_selected) { var simulated_downarrow = $.Event("keydown", { keyCode: 40, which: 40 }); orig_listener.apply(input, [simulated_downarrow]); } orig_listener.apply(input, [event]); }; } _addEventListener.apply(input, [type, listener]); } input.addEventListener = addEventListenerWrapper; input.attachEvent = addEventListenerWrapper; var options = {}; if (typeof countryCode2 !== "undefined" && $.trim(countryCode2)) { // existe la variable countryCode2 y tiene valor var options = { types: ['address'], componentRestrictions: {country: countryCode2} //code 2 of country }; } else { var options = { types: ['address'] }; } input.value = nombreZonaAddress + ', ' + input.value; autocompleteGooglePlaces = new google.maps.places.Autocomplete(input,options); autocompleteGooglePlaces.addListener('place_changed', function() { var address = $.trim($('#geoaddressGrande').val()); if (address!="") { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': address+', '+nombreZonaAddress}, geocodeResult); } }); })//(pac_inputGrande);Se quita porque el mapa de google ya trae la opción de ampliar el mapa. FRON-1938 pac_input.addEventListener('keydown', setNombreZonaAddress, false); //pac_inputGrande.addEventListener('keydown', setNombreZonaAddress, false);Se quita porque el mapa de google ya trae la opción de ampliar el mapa. FRON-1938 function setNombreZonaAddress() { if (pac_input.value == "") { pac_input.value = nombreZonaAddress + ', '; } /*if (pac_inputGrande.value == "") { Se quita porque el mapa de google ya trae la opción de ampliar el mapa. FRON-1938 / pac_inputGrande.value = nombreZonaAddress + ', '; }*/ } // Fin funciones buscador de calles // Redibuja el mapa cada vez que se abre la capa, si no guarda la vision del mapa con que se cerro GoogleMaps.redibujaMapa = function() { GoogleMaps.map.setMapTypeId(google.maps.MapTypeId.ROADMAP); //GoogleMaps.map.setCenter(new google.maps.LatLng(latitudCM,longitudCM)); //GoogleMaps.map.setZoom(13); // Ponemos la dimensiones y el centro GoogleMaps.setBoundsAndCenter2(coordinates); } // Make the info window close when clicking anywhere on the map. google.maps.event.addListener(GoogleMaps.map, 'click', GoogleMaps.closeInfoBox); google.maps.event.addListener(GoogleMaps.map,'bounds_changed', function() { InitialBounds = GoogleMaps.map.getBounds(); }); // end of listener callbck google.maps.event.addListener(GoogleMaps.map,'tilesloaded', function() { autocompleteGooglePlaces.bindTo('bounds', GoogleMaps.map); autocompleteGooglePlaces.setBounds(GoogleMaps.map.getBounds()); }); // end of listener callbck // First random marker. Icono del hotel seleccionado image = new google.maps.MarkerImage('/images/rojo/hotel_buscado.png', new google.maps.Size(35, 33), new google.maps.Point(0,0), new google.maps.Point(18, 17)); // Icono para los hoteles proximos hover image_hover = new google.maps.MarkerImage('/images/rojo/hotel_buscado_hover.png', new google.maps.Size(35, 33), new google.maps.Point(0,0), new google.maps.Point(18, 17)); // Icono para los hoteles imagep = new google.maps.MarkerImage('/images/rojo/hotel_proximo.png', new google.maps.Size(25, 22), new google.maps.Point(0,0), new google.maps.Point(13, 11)); // Icono para los hoteles proximos hover imagep_hover = new google.maps.MarkerImage('/images/rojo/hotel_proximo_hover.png', new google.maps.Size(25, 22), new google.maps.Point(0,0), new google.maps.Point(13, 11)); // Icono para el hotel seleccionado imageSelec = new google.maps.MarkerImage('/images/rojo/hotel_seleccionado.png', new google.maps.Size(35, 33), new google.maps.Point(0,0), new google.maps.Point(18, 17)); imageLugarCercano = new google.maps.MarkerImage('/images/rojo//cercanos.png', new google.maps.Size(35, 33), new google.maps.Point(0,0), new google.maps.Point(18, 17)); imageLugarCercano_hover = new google.maps.MarkerImage('/images/rojo//cercanos.png', new google.maps.Size(35, 33), new google.maps.Point(0,0), new google.maps.Point(18, 17)); imageLugarCercano_select = new google.maps.MarkerImage('/images/rojo//cercanos.png', new google.maps.Size(35, 33), new google.maps.Point(0,0), new google.maps.Point(18, 17)); var bocadillo="pepito"; if (arrayDatosMapa.length) { for(var i=0; i'+ lugar.nombre +'', 9999 ); }); } } if( typeof(TREN_SELECCIONADO)!="undefined" && TREN_SELECCIONADO && TREN_SELECCIONADO[0].latitudIda && TREN_SELECCIONADO[0].longitudIda){ imagen_tren = new google.maps.MarkerImage( '/images/rojo/train.png', new google.maps.Size(35, 33), new google.maps.Point(0,0), new google.maps.Point(18, 17) ); new google.maps.Marker({ map: GoogleMaps.map, position: new google.maps.LatLng(TREN_SELECCIONADO[0].latitudIda, TREN_SELECCIONADO[0].longitudIda), icon: imagen_tren }); } // Ponemos la dimensiones y el centro GoogleMaps.setBoundsAndCenter2(coordinates); } //***********************************************************************************************************************************/ // Funcion pintarBocadillo, construye el html que se muestra dentro de los bocadillos de los googleMaps. / // PRERREQUISITOS: El array pasado debe contener como mínimo los siguientes indices definidos / // $a["nombre"] = contiene el nombre del hotel que vamos a crear. / // $a["estrellas"] = texto o imagen que clasifica hotel (***, o 3 llaves, etc..) / // $a["claseNombre"] = el estilo que usará el nombre. / // $a["imagenHotel"] = contendrá el enlace y el img que se ponga como imagen de ese hotel / // $a["descripcion"] = texto que va como la descripción / // $a["claseDescripcion"] = el estilo que se le pondrá a la letra de la descripción. / // $a["url"] = enlace al que debe ir si pulsa en el nombre del hotel o en la foto / // Variables: campos tipo array. / // Retorno: Devuelve el html que va dentro del bocadillo. / //***********************************************************************************************************************************/ function pintarBocadilloV3(iHotel, campos) { var contenidoBocadillo = ""; var VerMasDatos = ""; if (campos) { contenidoBocadillo+='
\
\
\ \ \ \
\ '; if (campos.habitaciones.length) { var contadorPixelsAlojamientosHabitaciones=140; if( !urlFormularioReserva ){ urlFormularioReserva="/vuelo-hotel/formularioReserva.php"; } contenidoBocadillo += '
\ \ \
'; for(var i=0, nHab=campos.habitaciones.length; i\ \ \ Por pessoa \ \ \ '; var campoPrecio=""; if (UserAgencia==1 && mostrarPVP=="0") { campoPrecio="precioAgencia"; }else if(IDMinorista==12 || IDMinorista==23){ campoPrecio="precio"; }else{ campoPrecio="precio"; } for(var j=0, nAloj=datosAlojamientos.length; j\ ' + datosAlojamientos[j].nombreAlojamiento + '\ \ \ ' var precioHab = parseFloat( obtenerPrecio(datosAlojamientos[j][campoPrecio]) ); contenidoBocadillo+= CLASE_PRECIO.getPrecio(precioHab+SUPLEMENTOS_HOTEL); contenidoBocadillo += '\ '; } }else{ break; } contenidoBocadillo += '\ '; } contenidoBocadillo += '\ '; } contenidoBocadillo += '
\
\
'; if(campos.notaImportante) { marginTop=2; if(bw.ieg || bw.opera5) { marginTop=0; } contenidoBocadillo += '
\ \ ' + campos.notaImportante + '\ \
'; } } return contenidoBocadillo; } function muestraPrecioEuros(precio){ if( TIPO_CABECERA_AGENCIA=='Vuelo+Hotel' || TIPO_CABECERA_AGENCIA=='Tren+Hotel' )precio = precio/(ADULTOS+NINOS+BEBES); return number_format(precio, 2, ",","."); } /** * Función que obtiene el precio independientemente del formato: ',' o '.' */ function obtenerPrecio(precio){ precio = precio.toString(); precio = precio.replace(/[^0-9\.\,]/,''); precio = precio.split(" ").join(""); if( (new RegExp(/.*(\,|\.)[0-9]{1}$/)).test(precio) )precio += '0'; else if( !((new RegExp(/.*(\,|\.)[0-9]{2}$/)).test(precio)) )precio += '.00'; if( (new RegExp(/[0-9]+\,[0-9]{2}$/)).test(precio) ){ precio = precio.replace('.',''); precio = precio.replace(',','.'); }else if( (new RegExp(/(\.|\,|[0-9])+\.[0-9]{2}$/)).test(precio) ){ precio = precio.replace(',',''); if( (precio.split('.')).length>2 ){ precio = precio.replace('.',''); } } return Math.round(precio*100)/100; } function muestraCambioMoneda(precio) { if( typeof(SUPLEMENTOS_HOTEL)=="undefined" )SUPLEMENTOS_HOTEL = 0; if( TIPO_CABECERA_AGENCIA=='Vuelo+Hotel' || TIPO_CABECERA_AGENCIA=='Tren+Hotel' )precio = precio/(ADULTOS+NINOS+BEBES); var cambioMoneda = ""; cambioMoneda=parseFloat(cambioMoneda); var posicion="2"; var simbolo="€"; var cadenaDevuelta=""; if (cambioMoneda){ var precioFinal=precio*cambioMoneda; precioFinal=Math.round(precioFinal*100)/100; precioFinal=String(precioFinal); precioFinal=precioFinal.replace(",", "."); if (posicion==1){ cadenaDevuelta="("+simbolo+" "+precioFinal+")"; }else if(posicion==2){ cadenaDevuelta="("+precioFinal+" "+simbolo+")"; } } return cadenaDevuelta; } function roundNumber(rnum, rlength) { // Arguments: number to round, number of decimal places var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength); return parseFloat(newnumber); } /** * Función para realizar una reserva desde */ function reservarDesdeMapa(iHotel){ if( location.href.indexOf('detallesConDispo.php')!=-1 || (TIPO_CABECERA_AGENCIA!='Vuelo+Hotel' && TIPO_CABECERA_AGENCIA!='Tren+Hotel') ){ var url='/vuelo-hotel/formularioReserva.php'; url += (url.indexOf('?')==-1?'?':'&') +'obj=' + $('[name=obj]').val(); url += '&DATOS='+ $('[name=DATOS]:checked').val(); url += '&checkP='+ $('[name=encryptP'+ $('[name=DATOS]:checked').val().split('/').join('\\\/') +']').val(); var tren_id=''; if( hayAmenityTren ){ url += '&DepartureStation='+ $('#txtTren_id').val() +'&hayAmenityTren=1'; } var corporate = getParameterByName("corporate", location.href); if( corporate && url.indexOf('corporate')==-1 )url += '&corporate='+corporate; // Mostramos el div de "buscando" mostrarCapaBuscando(); if( $('#formReservarHV').length && ( ($('#vueloSeleccionado').length && $('#vueloSeleccionado').val()) || ($('#trenSeleccionado').length && $('#trenSeleccionado').val()) ) ){ var tb = ''; switch(TIPO_CABECERA_AGENCIA){ case 'Vuelo+Hotel': tb='v'; break; case 'Tren+Hotel': tb='t'; break; } $('#formReservarHV').attr("action", url+'&tb='+tb); $('#formReservarHV').submit(); }else location.href = url; }else{ var datos = $('[name=DATOS]:checked').val(); var habitaciones = DATOS_HOTELES[iHotel].habitaciones; for(var iHab=0; iHab buscamos en todos los hoteles for(var iHotel=0; iHotel