//Cuando se pulsa en ver todas las opiniones ocultamos la capa de la info del hotel y mostramos la de las opiniones $('#ClickVerTodas').click(function() { var Contenido=$('#ClickVerTodas').html(); if (Contenido==' Ver todas') { $('#ClickVerTodas').html(' fechar opiniões'); //Pintamos las valoraciones pintaValoraciones('f'); $('#infoOpiniones').show(); $('#infoHotel').hide(); $("body,html").stop(true,true).animate({ scrollTop: $('#infoOpiniones').offset().top - 15 },800); } else { $('#ClickVerTodas').html(' Ver todas'); $('#infoOpiniones').hide(); $('#infoHotel').show(); } }); if(isShowMap == true) { $("#AbrirMapa").click(function() { if (IDMinorista=='12' || IDMinorista=='23'){ $("#AreaMapaOSM").show("slow"); $("#AbrirMapa").hide(); // Inicializamos el mapa muestraCapaMapaOSM(); } else { $("#VerMapaGoogle").click(); } }); $("#AbrirMapaGrande").click(function() { $("#AreaMapaGrande").show("slow"); $("#mapGrande").height($(window).height()); $(window).scrollTop($("#AreaMapaGrande").offset().top); $("html").css("overflow","hidden"); $("#AbrirMapaGrande").hide(); // Inicializamos el mapa //if (cargaInicial) { GoogleMaps.init(latitudCM,longitudCM,'mapGrande'); //cargaInicial=false; //} }); $("#ACerrarMapa").click(function() { $("#AreaMapa").hide("slow"); $("#AbrirMapa").show(); // Ocultamos capa mapaOSM ocultaCapaMapaOSM(); }); $("#ACerrarMapaGrande").click(function() { $("html").css("overflow",""); $("#AreaMapaGrande").hide("slow"); $("#AbrirMapaGrande").show(); }); $("#ACerrarMapaOSM").click(function() { $("#AreaMapaOSM").hide("slow"); $("#AbrirMapa").show(); // Inicializamos el mapa ocultaCapaMapaOSM(); }); $("#VerMapaGoogle").click(function() { $("#AreaMapaOSM").hide(); // ocultamos la capa OSM ocultaCapaMapaOSM(); if (IDMinorista=='12' || IDMinorista=='23'){ $("#AreaMapa").show(); } else { $("#AbrirMapa").hide(); $("#AreaMapa").show("slow"); } GoogleMaps.init(latitudCM,longitudCM,'map'); }); } $("#chkPrecioAgencia").click(function(e) { e.stopPropagation(); var verPrecios = $(this).is(":checked")?'1':''; Cookies.set('VerPrecio', verPrecios); if( verPrecios )$(".DivPriceAgency").show(); else $(".DivPriceAgency").hide(); }); function SwapImg(i) { var imgG=$('#imgG').attr('src'); var imgT=$('#imgT'+i).attr('src'); $('#imgG').attr('src',imgT); $('#imgT'+i).attr('src',imgG); } //Cuando se pulsa el botón reservar entra aquí y nos manda al formulario de reserva function reservarDetallesDispo(obj, datos){ $("a[id^=butReservar]") .html("Seleccionar") .removeClass('hotelSeleccionado_VH'); var vDatos = datos.split('H'); var hotelSeleccionado = null; var idHotel = vDatos[0]; $.each(arrayDatosHoteles, function(iHot, el){ if( el.ID==idHotel ){ $.each(el.habitaciones, function(iHab, hab){ $.each(hab.alojamientos, function(iAlo, alo){ if(alo.datos==datos){ hotelSeleccionado = JSON.parse( JSON.stringify(el) ); hotelSeleccionado.habitaciones = []; hotelSeleccionado.habitaciones.push( JSON.parse( JSON.stringify(hab)) ); hotelSeleccionado.habitaciones[0].alojamientos = []; hotelSeleccionado.habitaciones[0].alojamientos.push(alo); } }); }); } }); if( hotelSeleccionado ){ HOTEL_SELECCIONADO = hotelSeleccionado; $('#butReservar_'+datos) .html('Seleccionado') .addClass('hotelSeleccionado_VH'); mostrarDatosSeleccionados(); if( $('#hotelSeleccionado').length ){ $('#hotelSeleccionado').val( JSON.stringify(hotelSeleccionado) ); } } } function botonReservarResumenLateral(){ var datos = HOTEL_SELECCIONADO.habitaciones[0].alojamientos[0].DATOS; var obj = objDatosBusqueda; var url='/formularioReserva.php'; var lastURL = url.substring(url.length-4); if( lastURL==".php" ) url += "?obj="+ obj; else url += "&obj="+ obj; url+='&DATOS='+datos; if(isAmenityTrain == true) { url+='&DepartureStation='+ getTren + '&hayAmenityTren=1'; } url = anadirURLTokensTren( url ); // Mostramos el div de "buscando" mostrarCapaBuscando(); if( $('#formReservarHV').length && ( ($('#vueloSeleccionado').length && $('#vueloSeleccionado').val()) || ($('#trenSeleccionado').length && $('#trenSeleccionado').val()) ) ){ $('#formReservarHV').attr("action", url); $('#formReservarHV').submit(); }else{ location.href = url; } } function pintaValoraciones(orden){ var datosValoraciones=arrayValoraciones; //Ordenamos las valoraciones por fecha o valoracion if (!orden || orden=="f"){ var tipoOrden=$("#ordenf").val(); if ($("#espopup").val()==1){ //Este campo controla si es el popup de comentarios en la dispo para que siempre salgan ordenados por fecha de mayor a menor tipoOrden=1; } $('#comV').removeClass('active'); $('#comF').addClass('active'); $("#fclass").removeClass(); if (tipoOrden==1){ datosValoraciones.sort(function(a, b){ return new Date(b.fechaOriginal) - new Date(a.fechaOriginal); }) $("#fclass").addClass("fa fa-caret-up fa-md fa-fw") $("#ordenf").val('-1'); } else{ datosValoraciones.sort(function(a, b){ return new Date(a.fechaOriginal) - new Date(b.fechaOriginal); }) $("#fclass").addClass("fa fa-caret-down fa-md fa-fw") $("#ordenf").val('1'); } } else{ var tipoOrden=$("#ordenv").val(); $('#comF').removeClass('active'); $('#comV').addClass('active'); $("#vclass").removeClass(); if (tipoOrden==1){ datosValoraciones.sort(function(a, b){ return b.valoracion-a.valoracion }) $("#vclass").addClass("fa fa-caret-up fa-md fa-fw") $("#ordenv").val('-1'); } else{ datosValoraciones.sort(function(a, b){ return a.valoracion-b.valoracion }) $("#vclass").addClass("fa fa-caret-down fa-md fa-fw") $("#ordenv").val('1'); } } var html=''; html='
'; for (i=0;i' +'' +'

'+datosValoraciones[i].valoracion+'

' +''+datosValoraciones[i].cliente+'

'+datosValoraciones[i].ciudad+' '+datosValoraciones[i].fecha+'

' +'' +''; if (datosValoraciones[i].valoracionPositiva){ html+='' +''+datosValoraciones[i].valoracionPositiva+''; } html+='' +''; if(datosValoraciones[i].valoracionNegativa){ html+='' +''+datosValoraciones[i].valoracionNegativa+''; } html+='' +'' +'' +'
'; } html+='
'; document.getElementById('opinionesHotel').innerHTML=html; } //Funciones de los popup de la info de la habitación var pophab_activo=0; function MuestraHabitacion(idx_hab) { if (pophab_activo && (pophab_activo == idx_hab)) { return; } var pophab_activoTop; var pophab_activoHeight; // Obtenemos posicion de la capa info habitacion ext var offsetTop = $("#ancla-pop-hab"+idx_hab).offset().top; // Si hay popup activo obtenemos posicion y altura exterior total real if (pophab_activo && $("#ancla-pop-hab"+pophab_activo).length) { pophab_activoTop = $("#ancla-pop-hab"+pophab_activo).offset().top; pophab_activoHeight = $("#pop-hab"+pophab_activo).outerHeight(true); } // Si hay popup activo desplegado y de posicion anterior al solicitado if (pophab_activoTop && (pophab_activoTop < offsetTop)) { // Scroll vertical a la posicion de la capa info habitacion ext window.scrollTo(0,$(window).scrollTop() - pophab_activoHeight); } else { // Scroll vertical a la posicion de la capa info habitacion ext window.scrollTo(0,$(window).scrollTop()); } // Ocultamos el popup activo, si lo hay if (pophab_activo && $("#ancla-pop-hab"+pophab_activo).length) { $("#pop-hab"+pophab_activo).hide(); } // Mostramos el popup solicitado $("#pop-hab"+idx_hab).show("slow"); // Ponemo el popup solicitado como popup activo pophab_activo=idx_hab; } function OcultaHabitacion(idx_hab) { $("#pop-hab"+idx_hab).hide("slow"); pophab_activo=0; } function setImgPantHab(idpopup,id,w,h,factor) { var imgDest=document.getElementById("img_"+idpopup+"_pant"); var imgOrig=document.getElementById("img_"+idpopup+"_"+id); if (h>w || h>190) { imgDest.width=parseInt(w*(190/h)); imgDest.height=190; if (imgDest.width>250) { imgDest.width=parseInt(w * factor); imgDest.height=parseInt(h * factor); } } else if (w>250) { imgDest.width=parseInt(w * factor); imgDest.height=parseInt(h * factor); } else { imgDest.width=w; imgDest.height=h; } imgDest.src=imgOrig.src; } /** * Función para mostrar los datos de cancelación en un pop-up (realiza la petición ajax para obtener los datos) */ function mostrarDatosGastosHotel(idHotel,nombreHotel,obj, DATOS){ var urlPeticion = 'infoGastosCancelacion.php?obj='+ obj+'&DATOS='+DATOS; mostrarCapaCargando('A pesquisar detalhes do hotel...', '', null); $.ajax({ type: 'POST', url: urlPeticion, dataType: "html", success: function(data){ $('body').append(''); var html ='' + '
' + '
' + '' + '
' + '
' + ''; $('#popUpDetallesHotelBackground').remove(); $('#popUpDetallesHotel').remove(); $('body').append(html); ocultarCapaCargando(); // Ajustamos el alto de la ventana var altoMenu = $("#menuDetallesHotelPopUp").height(); var altoMaximo = $(window).height() - 130 - altoMenu + (altoMenu>50?30:0); $("#divContentPopup").css("max-height", altoMaximo); $('#InfoCancellationAux'+ idHotel).remove(); if( $('#opcionesMultirates input[type=radio]').first() ){ $('#opcionesMultirates input[type=radio]').first().click(); } } }); } //Cuando se hace click en la lupa del mapa $('#geosearch').click(function() { var address = $.trim($('#geoaddress').val()); if (address!="") { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': address+', '+nombreZonaAddress}, geocodeResult); } }); $('#geoaddress').on("keydown",function(event) { if(event.which == 13) { var address = $.trim($('#geoaddress').val()); if (address!="") { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': address+', '+nombreZonaAddress}, geocodeResult); } } }); $('#geosearchGrande').click(function() { var address = $.trim($('#geoaddressGrande').val()); if (address!="") { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': address+', '+nombreZonaAddress}, geocodeResult); } }); $('#geoaddressGrande').on("keydown",function(event) { if(event.which == 13) { var address = $.trim($('#geoaddressGrande').val()); if (address!="") { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': address+', '+nombreZonaAddress}, geocodeResult); } } });