!function(e){if("function"==typeof define&&define.amd)define(e);else if("object"==typeof exports)module.exports=e();else{var n=window.Cookies,o=window.Cookies=e();o.noConflict=function(){return window.Cookies=n,o}}}(function(){function l(){for(var e=0,n={};e 1){ var dec = new String(sec[1]); dec = String(parseFloat(sec[1])/Math.pow(10,(dec.length - decimals))); dec = String( parseInt( Math.pow(10,decimals)*(whole + Math.round(parseFloat(dec))/Math.pow(10,decimals)))/Math.pow(10,decimals) ); var dot = dec.indexOf('.'); if(dot == -1){ dec += '.'; dot = dec.indexOf('.'); } while(dec.length <= dot + decimals) { dec += '0'; } result = dec; } else{ var dot; var dec = new String(whole); dec += '.'; dot = dec.indexOf('.'); while(dec.length <= dot + decimals) { dec += '0'; } result = dec; } return result; } var CACHE_NORMALIZE = {}; function normalize_2(str){ if( typeof(str)=='undefined' || !str)return ''; if( CACHE_NORMALIZE[str] )return CACHE_NORMALIZE[str]; var from = "ÃÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛãàáäâèéëêìíïîòóöôùúüûÇç", to = "AAAAAEEEEIIIIOOOOUUUUaaaaaeeeeiiiioooouuuucc", mapping = {}; for(var i=0, j=from.length; i127)return false; } return true; } function ucfirst(str) { str += ''; var f = str.charAt(0).toUpperCase(); return f + str.substr(1); } function addslashes(str) { return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0'); } function array_unique(list) { var result = []; $.each(list, function(i, e) { if ($.inArray(e, result) == -1) result.push(e); }); return result; } function mostrarCapaBuscando(){ if( div=document.getElementById("divEstamosFlash") ){ div.style.display = "block"; } //Mostramos el div de "buscando" if(div=document.getElementById('imagenBuscando')){ div.style.display = "block"; div.style.zIndex = "30000"; } // Ocultamos la cabecera (se ven los enlaces de "hoteles", "cruceros", "vuelos",... if(header=document.getElementById("header")){ header.style.display="none"; } // Ocultamos el cuerpo if( body=document.getElementsByTagName('body')[0] ){ body.style.height = window.innerHeight +"px"; body.style.overflow = "hidden"; body.scrollTop = 0; } // Ponemos el scroll arriba (firefox) if( body=document.getElementsByTagName('html')[0] ){ body.scrollTop = 0; } } function ocultarCapaBuscando(){ if( div=document.getElementById("divEstamosFlash") ){ div.style.display = "none"; } } //Función que devuelve el precio en la moneda dada function devuelvePrecioMoneda(precio,cambioMoneda,moneda,posicionMoneda,simboloMoneda,IDMinorista,monedaMayorista,factorDivisaMayorista){ var cadenaDevuelta=""; if (monedaMayorista==moneda){ cambioMoneda=factorDivisaMayorista; } if (cambioMoneda) { precio=String(precio); /*precio = precio.replace( ".", "");*/ precio = precio.replace ( ",", "."); if (IDMinorista == 17) { // para clickvoyage el calculo hay que hacerlo en base al precio en euros redondeado que es el que se muestra en pantalla precio=parseFloat(precio).toFixed(0) } var precioFinal = (parseFloat(precio) * parseFloat(cambioMoneda)).toFixed(2); if (moneda == 'CNY') { precioFinal = number_format ( precioFinal, 2, ".", "," ); } else { if (IDMinorista == 17) { // ara clickvoyage quieren que los precios salgan redondeados precioFinal = number_format (precioFinal, 0, ",", "." ); precioFinal = precioFinal.replace( ".", " "); } else { precioFinal = number_format ( precioFinal, 2, ",", "." ); } } if (posicionMoneda == 1) { cadenaDevuelta = simboloMoneda+" "+precioFinal; }else if (posicionMoneda == 2) { cadenaDevuelta = precioFinal+" "+simboloMoneda; } } return cadenaDevuelta; } function formatearNumero(number, decimals, dec_point, thousands_sep){ return number_format(number, decimals, dec_point, thousands_sep); } function number_format(number, decimals, dec_point, thousands_sep) { if( IDMinorista==17 ){ number = Math.ceil(number); decimals = 0; } // example 1: number_format(1234.56); // returns 1: '1,235' // example 2: number_format(1234.56, 2, ',', ' '); // returns 2: '1 234,56' // example 3: number_format(1234.5678, 2, '.', ''); // returns 3: '1234.57' // example 4: number_format(67, 2, ',', '.'); // returns 4: '67,00' // example 5: number_format(1000); // returns 5: '1,000' // example 6: number_format(67.311, 2); // returns 6: '67.31' // example 7: number_format(1000.55, 1); // returns 7: '1,000.6' // example 8: number_format(67000, 5, ',', '.'); // returns 8: '67.000,00000' // example 9: number_format(0.9, 0); // returns 9: '1' // example 10: number_format('1.20', 2); // returns 10: '1.20' // example 11: number_format('1.20', 4); // returns 11: '1.2000' // example 12: number_format('1.2000', 3); // returns 12: '1.200' // example 13: number_format('1 000,50', 2, '.', ' '); // returns 13: '100 050.00' // example 14: number_format(1e-8, 8, '.', ''); // returns 14: '0.00000001' number = (number + '') .replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function(n, prec) { var k = Math.pow(10, prec); return '' + (Math.round(n * k) / k) .toFixed(prec); }; // Fix for IE parseFloat(0.55).toFixed(0) = 0; s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)) .split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '') .length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1) .join('0'); } // clickvoyage no quiere decimales if( IDMinorista==17 && s[1] && s[1]=="00" )return s[0]; return s.join(dec); } function in_array(needle, haystack) { for(var i in haystack) { if(haystack[i] == needle) return true; } return false; } /** ALERT **/ function showAlert(txt, tipo){ $("#divAlert").remove(); var html = ''; html += '
\ \
'; $('body').append(html); } /** fin ALERT **/ /** CARGANDO **/ function mostrarCapaCargando(titulo, subtitulo, posScroll){ if( typeof(subtitulo)=='undefined' )subtitulo=''; if( typeof(posScroll)=='undefined' )posScroll=false; if( $('#cargandoBackground').length )return false; var html = ''; html += '
' + '' + '
'; $("html").append(html); if( posScroll ){ posScroll = Math.round( ( posScroll && $(posScroll).length)?$(posScroll).offset().top-20:0 ); $("body,html").stop(true,true).animate({ scrollTop: posScroll },800); } } function ocultarCapaCargando(){ $('#cargandoBackground').remove(); $('#cargandoContent').remove(); } function getLengthObject(obj){ if( !obj || typeof(obj)=="undefined" )return 0; var length = 0; if( obj ){ for(var i in obj){ var dat = obj[i]; length++; } } return length; } function emptyObject(obj){ var empty = true; if( !obj || typeof(obj)=="undefined" ){ empty = true; } if( obj ){ for(var i in obj){ empty = false; break; } } return empty; } function getExtremosObject(obj, field){ var min=null, max=null; if( obj ){ for(var i in obj){ var data = obj[i]; if( data[field] ){ if(min==null || data[field]max)max = data[field]; } } } return {'min':min, 'max':max}; } function getKeysObject(obj){ var keys=[]; for(var key in obj){ if( obj.hasOwnProperty(key) )keys.push(key); } return keys; } function sortObject(obj, ord){ if( ord==undefined )ord = 1; var keys=[], sorted_obj={}; for(var key in obj){ if( obj.hasOwnProperty(key) )keys.push(key); } keys.sort(); if(ord==-1)keys.reverse(); // create new array based on Sorted Keys for(var i in keys){ var key = keys[i]; sorted_obj[key] = obj[key]; } return sorted_obj; }; /** * 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 validarTarjeta(numero) //Función obsoleta. Se usa EsTarjetaValida pasada por Eugenio. FRON-2619 { //var expReg = /\W/gi; //var numero = numero.replace(expReg, ""); //Chequeamos que el numero entrado tenga formato numérico... if (isNaN(numero)) { alert("El número de la tarjeta de crédito no tiene formato numérico."); return false; } if (numero == "1111111111111117") { return true; } //Chequeamos que el numero tenga 16 o 18 dígitos... if (numero.length < 13 || numero.length > 19) { alert("El número de dígitos en la tarjeta de crédito es incorrecto."); return false; } var suma = 0; for (i = numero.length; i > 0; i--) { //Si la posición es impar if (i % 2 == 1) { var doble = "" + (parseInt(numero.substring(i - 1, i)) * 2); //Si el doble tiene más dos cifras (o sea es mayor que 9) if (doble.length == 2) { doble = parseInt(doble.substring(0,1)) + parseInt(doble.substring(1,2)); } suma += parseInt(doble); } //Si la posición es par else { suma += parseInt(numero.substring(i - 1, i)); } } } // Cmprueba si una tarjeta bancaria o de debito o de credito es valida.Nueva función pasada por Eugenio. FRON-2619 function EsTarjetaValida(numtarjeta) { //Comprobamos primero que el numero de tarjeta es valido if (isNaN(numtarjeta)) { alert("El número de la tarjeta de crédito no tiene formato numérico."); return false; } if (numtarjeta == "1111111111111117") { return true; } //Comprobamos si el numero de la tarjeta es correcto //Paso 1: Comprobamos el peso para el primer digito: Si el numero de digitos es par, el peso es 2 si no es 1 var peso = 2 - (numtarjeta.length % 2); var numeros =numtarjeta.split(""); var total = 0; for (var i = 0; i < numeros.length; i++) { var suma = peso * numeros[i]; if (suma > 9){ suma = suma -9; } total += suma; if (peso == 2){ peso = 1; } else{ peso = 2; } } if (total % 10 != 0){ return false; } else{ return true; } } function nif(dni) { var numero = dni.substr(0,dni.length-1); var letraDNI = dni.substr(dni.length-1,1); var numero = numero % 23; var letras = 'TRWAGMYFPDXBNJZSQVHLCKET'; var letraCorrecta = letras.substring(numero,numero+1); return letraDNI==letraCorrecta; } function decompressJson(json,keys,values){ var datos = []; for(var i=0, n=json.length; i\
'; if( titulo ){ html += '

\ \ '+ titulo +'\

'; } html += '
\
\ \
\
'; html += '
\ '; return html ; } function iniciarRangeSlider(campo, tipo, minValue, maxValue, iniValue, finValue){ if( typeof(iniValue)=="undefined" )iniValue = null; if( typeof(finValue)=="undefined" )finValue = null; if( minValue==maxValue ){ var divEl = $('.filter_'+campo); var divPrev = divEl.prev(); if( divPrev.is("hr") )divPrev.remove(); divEl.remove(); } var valores = []; switch(tipo){ case 'hora': var mins = ['00','15','30','45']; valores.push(minValue); for(var i=0;i<24;i++){ hora = i<10?'0'+i:i; for(var j=0, n=mins.length; jminValue )valores.push( horaActual ); if( maxValue && horaActual>maxValue)break; } if( maxValue && horaActual>maxValue)break; } maxValue?valores.push(maxValue):valores.push( "23:59"); var valoresRangeSlider = { 'values':valores, 'type':'double', /* 'onChange': */ 'onFinish': function(obj) { $('#valorInicial_'+campo).val( (obj.from==obj.min && obj.to==obj.max)?'true':'false' ); $("#inicio_"+campo).val( obj.from_value ); $("#fin_"+campo).val( obj.to_value ); $('input[id^=chk]').first().trigger('change'); //$("#inicio_"+campo).trigger('change'); } }; if( iniValue && valores.indexOf(iniValue)!=-1 )valoresRangeSlider.from = valores.indexOf(iniValue); if( finValue && valores.indexOf(finValue)!=-1 )valoresRangeSlider.to = valores.indexOf(finValue); $("#filtro_"+campo).ionRangeSlider(valoresRangeSlider); var html = '\ \ '; $('#divFiltro_'+campo).append( html ); break; case 'precio': minValue = Math.floor(minValue); maxValue = Math.ceil(maxValue); var paso = 10; var nPasos = Math.round((maxValue-minValue)/50); if(nPasos<100)nPasos=100; var minPrecioAux = CLASE_PRECIO.getImportePrincipal(minValue); minPrecioAux = Math.floor(obtenerPrecio(minPrecioAux)); minValue = parseFloat( minPrecioAux ); var maxPrecioAux = CLASE_PRECIO.getImportePrincipal(maxValue); maxPrecioAux = Math.ceil(obtenerPrecio(maxPrecioAux)); maxValue = parseFloat( maxPrecioAux ); if( maxValue!=undefined && minValue!=undefined )paso = Math.round( (maxValue-minValue)/nPasos ); if( paso<1 )paso=1; var valorMaximo = minValue + paso * nPasos; for(var valor=minValue; valor36)$('.irs-to').css('margin-left', (-1) * ($('.irs-to').width()-36)/2 ); var html = '
\
\ mín: '+ CLASE_PRECIO.monedaPrincipal.simbolo +'\
\
\ max: '+ CLASE_PRECIO.monedaPrincipal.simbolo +'\
\ \
'; if( $('#resumen_'+campo).length ){ if( typeof(TOTAL_PASAJEROS)=="undefined" )TOTAL_PASAJEROS = 1; $('#resumen_'+campo).html( Math.round((iniValue?iniValue:minValue)/TOTAL_PASAJEROS) + CLASE_PRECIO.monedaPrincipal.simbolo +' - '+ Math.round((finValue?finValue:maxValue)/TOTAL_PASAJEROS) + CLASE_PRECIO.monedaPrincipal.simbolo); } $('#inicio_'+campo).parent().parent().remove(); $('#divFiltro_'+campo).append( html ); $('#inicio_'+campo +', #fin_'+campo).on("keydown", function(e){ if( [8,9,27,46,96,97,98,99,100,101,102,103,104,105].indexOf(e.keyCode)==-1 && (e.keyCode<48 || e.keyCode>57) ) e.preventDefault(); }); $('#inicio_'+campo +', #fin_'+campo).on("keyup", function(){ var id = $(this).attr("id").split("_").pop(); var minInput = $("#inicio_"+ id); var valorMin = parseInt(minInput.val(),10); var maxInput = $("#fin_"+ id); var valorMax = parseInt(maxInput.val(),10); var slider = $('#filtro_'+id).data("ionRangeSlider"); if( ( valorMin>=parseInt(minInput.attr("min-value"),10) && valorMin<=parseInt(minInput.attr("max-value"),10) ) && ( valorMax>=parseInt(maxInput.attr("min-value"),10) && valorMax<=parseInt(maxInput.attr("max-value"),10) ) && ( valorMinparseInt(minInput.attr("max-value"),10) ){ alertPopUp("El valor mínimo ha de estar entre "+ minInput.attr("min-value") +" y "+ minInput.attr("max-value")); minInput.val( parseInt(minInput.attr("min-value"),10) ); minInput.focus(); return false; } var maxInput = $("#fin_"+ id); var valorMax = parseInt(maxInput.val(),10); if( valorMaxparseInt(maxInput.attr("max-value"),10) ){ alertPopUp("El valor máximo ha de estar entre "+ maxInput.attr("min-value") +"y "+ maxInput.attr("max-value")); maxInput.val( parseInt(maxInput.attr("max-value"),10) ); maxInput.focus(); return false; } if( valorMin>=valorMax ){ alertPopUp("El valor mínimo ha de ser menor que el valor máximo"); minInput.val( parseInt(minInput.attr("min-value"),10) ); maxInput.val( parseInt(maxInput.attr("max-value"),10) ); minInput.focus(); return false; } $('input[id^=chk]').first().trigger('change'); //$("#inicio_"+campo).trigger('change'); }); break; } if( $('.irs-to').width()>36)$('.irs-to').css('margin-left', (-1) * ($('.irs-to').width()-36)/2 ); } function cambioMonedaPrecioFormateado(precio, cambio){ if( !precio )return -1; if( !cambio )cambio = 1; precio = precio.toString(); if( (new RegExp(/[0-9]+\,[0-9]{2}$/)).exec(precio) ){ precio = precio.replace('.',''); precio = precio.replace(',','.'); }else if( (new RegExp(/[0-9]+\.[0-9]{2}$/)).exec(precio) ){ precio = precio.replace(',',''); } precio = parseFloat(precio)/cambio; return parseFloat(precio.toFixed(2)); } function reiniciarSlider(campo){ if( $("#filtro_"+campo).length ){ var slider = $("#filtro_"+campo).data("ionRangeSlider"); $('#valorInicial_'+campo).val( 'true' ); $("#inicio_"+campo).val(slider.options.values[0]); $("#fin_"+campo).val(slider.options.values[slider.options.values.length-1]); slider.reset(); } } function countdown(capa) { var seconds; var temp; seconds = document.getElementById(capa).innerHTML; seconds = parseInt(seconds, 10); if (seconds == 1) { $('#popupMesaje').remove(); return; } seconds--; temp = document.getElementById(capa); temp.innerHTML = seconds; setTimeout(function(){ countdown(capa); }, 1000); } function popUpMesaje(title, htmlPopup, botonCerrar, styleBody, clasesModal, eventoCerrar){ if( typeof(title)=="undefined" ) title = ' '; if( typeof(htmlPopup)=="undefined" ) htmlPopup = ' '; if( typeof(botonCerrar)=="undefined" )botonCerrar = true; if( typeof(styleBody)=="undefined" )styleBody = ''; if( typeof(clasesModal)=="undefined" )clasesModal = 'modal-avisos'; if( typeof(eventoCerrar)=="undefined" )eventoCerrar = ''; if( typeof(classBody)=="undefined" )classBody = 'text-center'; $('div[id^=popupMesaje]:hidden').remove(); var id = ''; while( $('#popupMesaje'+id).length ){ id===''?id=0:id++; }; var maxZindex = 0; var divsBody = $("body > *"); for(var i=0; i\ \ \ "; $("body").append(htmlModal); } function alertPopUp(texto) { var popUpTitle = ""+texto+""; var popUpHtml = "
\ Aceptar\
"; popUpMesaje(popUpTitle, popUpHtml, false); } function aceptarPopUp(texto) { var popUpTitle = ""; var popUpHtml = "

" + texto + "

\
\ Aceptar\
"; popUpMesaje(popUpTitle, popUpHtml, false); } function alertPopUpFocus(texto, inputId) { if( inputId.indexOf("#") ){ inputId = "#" + inputId; } focusInput = inputId; var popUpTitle = "Aviso"; var popUpHtml = ""; popUpHtml += ""; popUpMesaje(popUpTitle, popUpHtml, false); } function alertPopUpConfirm(texto,campo,form,boton1,boton2) { var popUpTitle = ""+texto+""; var popUpHtml = "
\ "+boton1+"\ "+boton2+"\
"; popUpMesaje(popUpTitle, popUpHtml, false); } function alertPopUpPublicidad(imagen,segundos) { var popUpTitle = "La ventana se cerrará en "+segundos+" segundos"; var divElement = document.createElement("div"); divElement.className = "media"; var imgElement = document.createElement("img"); imgElement.className = "img-responsive"; imgElement.src = imagen; // Asegúrate de que "imagen" contenga la URL correcta divElement.appendChild(imgElement); var containerElement = document.createElement("div"); containerElement.appendChild(divElement); var popUpHtml = containerElement.innerHTML; popUpMesaje(popUpTitle, popUpHtml, true,"width: 40%;"); countdown('countdown'); } function alertPopUpConfirmFunction(texto,funcion1,funcion2,boton1,boton2,botonCerrar) { var popUpTitle = "Aviso"; var popUpHtml = ""; popUpHtml += ""; if (botonCerrar == undefined) { botonCerrar=false; } popUpMesaje(popUpTitle, popUpHtml, botonCerrar); } function alertPopUpImagen(imagen) { var popUpTitle = "Imágen"; var popUpHtml = "
"; popUpMesaje(popUpTitle, popUpHtml, true,"width: 25%;"); } function campoIncorrecto(msg, campo){ if( typeof(campo)=="undefined" ){ alertPopUp(msg); }else{ if( campo.indexOf('#')!=0 ){ campo = "#" + campo; } alertPopUpFocus(msg, campo); $(campo).addClass('inputError').focus(); } $(".cmdReserva").removeAttr("disabled"); return false; } function estableceValorCampo(campo,valor,form){ $("#"+campo).val(valor); if (valor==1 && form){ $("#"+form).submit(); } } function mostrarPopUpDivPadre(e, parent){ e.stopPropagation(); var div = $(e.target).closest(parent).find('div.alert').first(); if( div.length ){ if( div.is(':visible') )div.hide(); else div.show(); } } $(window).bind('keydown', function(e){ if( [13,38,40].indexOf(e.keyCode)!=-1 ){ e.preventDefault(); if( $(".ui-autocomplete:visible").length==1 ){ var divAuto = $(".ui-autocomplete"); if( divAuto.find('.ui-state-hover').length==0 ){ $(".ui-autocomplete:visible").find('li').first().addClass('ui-state-hover'); }else{ switch(e.keyCode){ case 13: if( TIPO_CABECERA_AGENCIA!="Vuelos" && TIPO_CABECERA_AGENCIA!="Vuelo+Hotel"){ $('.ui-state-hover span').trigger('click'); } break; case 38: if( TIPO_CABECERA_AGENCIA!="Vuelos" && TIPO_CABECERA_AGENCIA!="Vuelo+Hotel"){ var elemActual = $('.ui-state-hover'); elemActual.removeClass('ui-state-hover'); if( elemActual.prev().length )elemActual.prev().addClass('ui-state-hover'); else $(".ui-autocomplete:visible").find('li').last().addClass('ui-state-hover'); } break; case 40: if( TIPO_CABECERA_AGENCIA!="Vuelos" && TIPO_CABECERA_AGENCIA!="Vuelo+Hotel"){ var elemActual = $('.ui-state-hover'); elemActual.removeClass('ui-state-hover'); if( elemActual.next().length ) elemActual.next().addClass('ui-state-hover'); else $(".ui-autocomplete:visible").find('li').first().addClass('ui-state-hover'); } break; } } } } }); function isValidEmail(mail){ return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/.test(mail); } var GUARDAR_PRESUPUESTO = true; function presupuesto(option, tipoPresupuesto){ var datosPasajero1 = false; tipoPresupuesto = tipoPresupuesto || null; var emailEnviar = tipoPresupuesto=='avisoPagoNoReembolsableClickVoyage' ? 'booking@clickvoyage.ru' : null; if( option=='enviar' ){ if( !emailEnviar ){ var emailEnviar = prompt("Introduza el email al que desea enviar el presupuesto"); } if (emailEnviar!=null){ if( !isValidEmail(emailEnviar) ){ alertPopUp("El email introducido no es correcto."); return false; } }else{ return false; } } var htmlForm = ''; var inputs = $(".container, #frmReseva").find("input, select"); if( inputs.length ){ htmlForm += ''; } if( htmlForm ){ $('body').append(htmlForm); $('#formPresupuesto').submit(); $('#formPresupuesto').remove(); } if( GUARDAR_PRESUPUESTO ){ saveBudget('hoteles', false); GUARDAR_PRESUPUESTO = false; } } var PESTANA_MOSTRADA = null; function mostrarPestana(pestana, moverScroll){ if( pestana=="Hoteles" ){ $(".idBotonReservarVH").text( "Continuar" ); var liPasosProcesoReserva = $("#pasosProcesoReserva li"); $(liPasosProcesoReserva.get(0)).removeClass("p_checked").addClass("p_actived"); $(liPasosProcesoReserva.get(1)).removeClass("p_actived").addClass("p_disabled"); }else{ $(".idBotonReservarVH").text( "Reservar" ); var liPasosProcesoReserva = $("#pasosProcesoReserva li"); $(liPasosProcesoReserva.get(0)).removeClass("p_actived").addClass("p_checked"); $(liPasosProcesoReserva.get(1)).removeClass("p_disabled").addClass("p_actived"); } switch(pestana){ case 'Hoteles': $("#pasosProcsoReservaVolver").hide(); $("#cabeceraHotel").show(); $("#cabeceraVuelo").hide(); $("#cabeceraTren").hide(); break; case 'Vuelos': $("#pasosProcsoReservaVolver").css("display", ""); $("#cabeceraHotel").hide(); $("#cabeceraVuelo").show(); $("#cabeceraTren").hide(); break; } if( typeof(moverScroll)=="undefined" )moverScroll=false; if( PESTANA_MOSTRADA==pestana){ if( (typeof(VOLVER_SOLO_HOTEL)=="undefined" || !VOLVER_SOLO_HOTEL) && pestana=='Hoteles'){ if( location.href.indexOf('detallesConDispo.php') ==-1 ){ funVolverDispo(); } }else{ return false; } } PESTANA_MOSTRADA=pestana; if( moverScroll ){ $("body,html").stop(true,true).animate({ scrollTop: $(".sec_pasos").offset().top - ($(".sec_pasos").outerHeight() + $("#resumenBusquedaEscritorio").outerHeight()) },800); } $('#pestanasListados').find('li').removeClass('active'); $('#pestanasListados'+pestana).addClass('active'); $("div[id^=divPestana]").hide(); $("div[id^=divFiltros]").hide(); $("#dispoVuelos").hide(); $("#BuscarTambienEn").hide(); $("#divPestana"+pestana).show(); $("#divFiltros"+pestana).show(); var pestanas = ['Hoteles','Vuelos','Trenes']; setLoadSession(true); if(pestana=='Hoteles'){ $('#divFiltrosTrenes').html(''); $("#BuscarTambienEn").show(); if( GESTOR_TRENES ){ GESTOR_TRENES.mostrarSeleccionado('#datosTrenSeleccionado'); } if( location.href.indexOf('detallesConDispo.php')==-1 ){ Paginar(1,"normal",1,1); }else{ sumarSuplementoPrecios(); } var ancho = $( $('#colDerecha').children()[0] ).width(); if( !ancho )ancho = 848; $('#AreaMapa').width( ancho ); $('#map').width( ancho ); }else if(pestana=='Vuelos'){ $("#dispoVuelos").show(); }else if(pestana=='Trenes' && GESTOR_TRENES){ $('#divFiltrosHotelesJS').html(''); var tini = new Date(); var tren = TREN_SELECCIONADO; if( $('#trenSeleccionado').val()!='' )var tren = JSON.parse($('#trenSeleccionado').val()); GESTOR_TRENES.aplicarFiltros(); GESTOR_TRENES.setSeleccionado(tren); GESTOR_TRENES.mostrarSeleccionado('#datosTrenSeleccionado'); aplicarFiltrosTrenes(); if( getSession('filtrosTrenes') )aplicarFiltrosTrenes(); if( location.href.indexOf('detallesConDispo.php')!=-1 ){ sumarSuplementoPrecios(); } } setLoadSession(false); } function simpleJSON2string(obj){ var str = ''; for(var i in obj){ str += (str==''?'{':',') + "'"+ i +"':'"+ obj[i] +"'"; } str += '}'; return str; } function harvestine(lat1, long1, lat2, long2, decimales){ var km = 111.302; var degtorad = 0.01745329; var radtodeg = 57.29577951; if( decimales==undefined )decimales=1; var cteDecimales = Math.pow(10,decimales); var dlong = (long1 - long2); var dvalue = (Math.sin(lat1*degtorad) * Math.sin(lat2*degtorad)) + (Math.cos(lat1*degtorad) * Math.cos(lat2*degtorad) * Math.cos(dlong*degtorad)); var dd = Math.acos(dvalue) * radtodeg; return Math.round(dd*km*cteDecimales)/cteDecimales; } function hashCode(cad){ var hash = 0, i, chr, len; if (cad.length === 0) return hash; for(i=0, len=cad.length; i2 || !jQuery.isEmptyObject(jsonValor.text) || !jQuery.isEmptyObject(jsonValor.text) ) ? true : false; } for(var i=0; i2 || !jQuery.isEmptyObject(jsonValor.text) || !jQuery.isEmptyObject(jsonValor.text) ) ){ return true; } } } } return false; } function quitarFiltrosBusqueda(){ $('#popupMesaje').remove(); $("#butBorrar").click(); clearSession(); } function selectOrdernarListado(e){ var opciones = ($(e.target).val()).split('|'); ordenarPor(opciones[0],opciones[1]); } function popupActulizarFiltrosBusqueda(){ var title = ""; var html = "

¿Deseas mantener los filtros seleccionados?

\
\ No\ \
"; popUpMesaje(title, html); } function actualizarFiltrosBusqueda(){ $('#popupMesaje').remove(); var variablesCrear = {}; var variablesBorrar = []; for(var i=0; iC: '+ CLASE_PRECIO.getPrecioPrincipal(precioCoste) +'
('+ CLASE_PRECIO.getPrecioSecundario(precioCoste) +')' + '
G: '+ CLASE_PRECIO.getPrecioPrincipal(ganancia) +'
('+ CLASE_PRECIO.getPrecioSecundario(ganancia) +')
' + '
P: '+ porcentaje.toFixed(2) +'%
' ); }else{ $(elPrecios).find(".divPrecioCosteHabitacion").html( '
C: '+ CLASE_PRECIO.getPrecio(precioCoste) +'
' + '
G: '+ CLASE_PRECIO.getPrecio(ganancia) +'
' + '
P: '+ porcentaje.toFixed(2) +'%
' ); } } }); } } function maxLengthPassenger(e){ var input = $(e.target); var iInput = input.attr("id").replace(/\D+/, ''); var maxLength = 57; if( $('#txtDireccionCliente').length==0 ){ var tipoPasajero = $('#tipoPajero'+iInput).val(); var iBebe = 1; switch( tipoPasajero ){ case "adulto": maxLength = 57; break; case "nino": maxLength = 47; break; case "bebe": maxLength = 45 - ( $("#txtNombre"+iBebe).val().length + $("#txtApellidos"+iBebe).val().length ); iBebe++; break; } }else{ maxLength = 30; } var nombreApellidos = $('#txtNombre'+iInput).val() + $('#txtApellidos'+iInput).val(); var caracteresRestantes = maxLength - nombreApellidos.length; input.attr("maxlength", (input.val().length) + caracteresRestantes); $('#caracteresPasajero'+iInput) .html(caracteresRestantes + ' carácteres restantes para el nombre y apellidos') .css("color", caracteresRestantes==0?"red":"") .show(); } function ocultarLengthPassenger(e){ var iInput = $(e.target).attr("id").replace(/\D+/, ''); $('#caracteresPasajero'+iInput).hide(); } function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); } function anadirParametrosAdicionales(e){ var el = $(e.target); var url = el.attr('href'); var IDST = $('#IDSessionTren').val(); if( TIPO_CABECERA_AGENCIA=='Tren+Hotel' && IDST ){ var tb = getParameterByName("tb", url); if( !tb )url += '&tb=t'; var T_I = $('#tokenTrenIda').val(); var T_V = $('#tokenTrenVuelta').val(); var T_In = $('#tokenTrenIdaNino').val(); var T_Vn = $('#tokenTrenVueltaNino').val(); var IDSTorig = getParameterByName('IDST', IDST); if( IDSTorig )url.replace('&IDST='+IDSTorig, '&IDST='+IDST); else url += '&IDST='+ IDST; var T_Iorig = getParameterByName('T_I', url); if( T_Iorig )url.replace('&T_I='+T_Iorig, '&T_I='+T_I); else url += '&T_I='+ T_I; var T_Inorig = getParameterByName('T_In', url); if( T_Inorig )url.replace('&T_In='+T_Inorig, '&T_In='+T_In); else url += '&T_In='+ T_In; var T_Vorig = getParameterByName('T_V', url); if( T_Vorig )url.replace('&T_V='+T_Vorig, '&T_V='+T_V); else url += '&T_V='+ T_V; var T_Vnorig = getParameterByName('T_Vn', url); if( T_Vnorig )url.replace('&T_Vn='+T_Vnorig, '&T_Vn='+T_Vn); else url += '&T_Vn='+ T_Vn; el.attr('href', url); } return true; } function diferenciaFechas(fecha1,fecha2){var diferencia=fecha1.getTime()-fecha2.getTime();var dias=Math.floor(diferencia/(1000*60*60*24));return dias;} function validate_fechaMayorQue(fechaInicial,fechaFinal){ valuesStart=fechaInicial.split("/"); valuesEnd=fechaFinal.split("/"); var dateStart=new Date(valuesStart[2],(valuesStart[1]-1),valuesStart[0]); var dateEnd=new Date(valuesEnd[2],(valuesEnd[1]-1),valuesEnd[0]); if(dateStart>=dateEnd){ return 0; } return 1; } function validarDNI(value,tipo) { var validChars = 'TRWAGMYFPDXBNJZSQVHLCKET'; var nifRexp = /^[0-9]{8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/i; var nieRexp = /^[XYZ]{1}[0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/i; var str = value.toString().toUpperCase(); if (tipo==""){ if (!nifRexp.test(str) && !nieRexp.test(str)) return false; } else if (tipo=="DNI") { if (!nifRexp.test(str)) return false; } else if (tipo=="NIE") { if (!nieRexp.test(str)) return false; } var nie = str .replace(/^[X]/, '0') .replace(/^[Y]/, '1') .replace(/^[Z]/, '2'); var letter = str.substr(-1); var charIndex = parseInt(nie.substr(0, 8)) % 23; if (validChars.charAt(charIndex) === letter) return true; return false; } function crearTicket(IDReserva,localizador,mostrarPopup) { if (mostrarPopup == 1){ mostrarCapaCargando('Creando ticket','',0); } var url = './js/ajax/crearTicket.php?IDReserva='+IDReserva+'&localizador='+localizador; $.ajax({ type: 'POST', url: url, dataType: "html", success: function(data){ ocultarCapaCargando(); var txt=''; if (data=='OK'){ txt='Incidencia creada correctamente'; } else { txt='Error al crear la incidencia'; } if (mostrarPopup == 1){ alertPopUp(txt); } } }); } function cancelarModificacion(f1,f2,detalle,IDReserva,seg){ if (detalle == 1){ window.location ='https://gea.veturis.com/detalleReservas.php?IDReserva='+IDReserva+'&Seg='+seg; } else{ window.location ='https://gea.veturis.com/listaReservas.php?botonEnviar=1&f1='+f1+'&f2='+f2; } } function datos_navegador() { var d = new Date(); var datosNav = { agente_navegador: navigator.userAgent, idioma_navegador: navigator.language, altura_pantalla: screen.height, anchura_pantalla: screen.width, profundidad_color: screen.colorDepth, diferencia_horaria: d.getTimezoneOffset(), } return JSON.stringify(datosNav); } function mostrarDatosAdicionalesHotel(idHotel, nombreHotel, datosAdicionales, comprobarDetallesConDispo,esMovil){ if( typeof(comprobarDetallesConDispo)=="undefined") { comprobarDetallesConDispo = true; } if( typeof(esMovil)=="undefined") { esMovil = 1; } /*if( comprobarDetallesConDispo && location.href.indexOf('detallesConDis')!=-1 ){ return ''; }*/ var urlPeticion = 'detallesConDispo.php?IDE='+ idHotel+'&espopup=1'; mostrarCapaCargando('Buscando los detalles del hotel...', '', null); urlPeticion += '&aj=a'; $.ajax({ type: 'POST', url: urlPeticion, dataType: "html", success: function(data){ $('body').append(''); $('#opinionesHotel').remove(); actualizarDatosAdicionalesHotel(idHotel, nombreHotel, datosAdicionales, esMovil); } }); //}else actualizarDatosAdicionalesHotel(idHotel, nombreHotel, datosAdicionales); } function actualizarDatosAdicionalesHotel(idHotel, nombreHotel, datosAdicionales, esMovil){ if( typeof(esMovil)=="undefined") { esMovil = 1; } switch(datosAdicionales){ case 'comentarios': $('#opinionesHotel').remove(); break; case 'mapa': IDEBuscado = idHotel; var idMapa = (new Date()).getTime(); break; } var html ='' + '
' + '
' + '' + '
' + '
'; $('#popUpDetallesHotelBackground').remove(); $('#popUpDetallesHotel').remove(); $('body').append(html); ocultarCapaCargando(); var altoMenu = $("#menuDetallesHotelPopUp").height(); var altoMaximo = window.innerHeight - 130 - altoMenu + (altoMenu>50?30:0); $("#divContentPopup").css("max-height", altoMaximo); switch(datosAdicionales){ case 'verMas': $(".pop-up-panel h3").css("margin-top", "0px"); break; case 'comentarios': if( typeof(arrayValoraciones)!='undefined' && parseInt(IDMinorista,10)!=17 && parseInt(IDMinorista,10)!=31 )pintaValoraciones('f'); $("#opinionesHotel").height(altoMaximo-$("#divContentPopup").height()) $('#opinionesHotel .panel-body').css("padding-top", "0"); break; case 'imagenes': var carousel = $('#imgHotelCarrouselAux #myCarouselAux'); if( carousel.length){ carousel.attr('id', carousel.attr("id")+ idHotel); } $("#popUpDetallesHotel #myCarouselAux"+idHotel).attr("id", "myCarouselAux"); $("#myCarouselAux").css("margin-top","0px"); $("#menuDetallesHotelPopUp .list-inline li").css("width", "16.666%"); break; case 'mapa': //////$('#divMapPopup').width($('#popUpDetallesHotel').width()); $('#mapaOSM_'+idHotel).width($('#popUpDetallesHotel').width()-30); $('#mapaOSM_'+idHotel).height(altoMaximo-15); if (IDMinorista=='12' || IDMinorista=='23'){ muestraCapaMapaOSMIDE(idHotel); buildDatosMapaOSM(arrayDatosHotelesMapa,idHotel); } else { VerCapaMapaGoogleIDE(idHotel,idMapa); } IDEBuscado = null; break; } } function cerrarInfoGastosCancelacion(){ if( $("#errorInfoGastosCancelacion").val()=="1" ){ $('.divCargando').show(); if( location.href.indexOf("regenerateCache")==-1){ location.href = location.href + "®enerateCache=1"; }else{ location.reload(); } } $( "#popUpDetallesHotelContent,#popUpDetallesHotelBackground" ).remove(); } function getNombreTipoEstablecimiento(idCategoria) { var tiposEstablecimientos = { 1: "Hotel", 2: "Apartamentos", 3: "Hotel", 4: "Apartamentos", 5: "Hotel", 6: "Apartamentos", 7: "Hotel", 8: "Apartamentos", 9: "Hotel", 10: "Apartamentos", 11: "Finca Rústica", 12: "Apartahotel", 13: "Apartahotel", 14: "Apartahotel", 15: "Apartahotel", 16: "Apartahotel", 17: "Camping", 18: "Camping", 19: "Hostal", 20: "Hostal", 21: "Hostal", 22: "Hotel Rural", 23: "Hotel Rural", 24: "Hotel Rural", 25: "Hotel Rural", 26: "Hotel Rural", 27: "Hotel", 28: "Villa", 29: "Viviendas Turísticas Vacacionales", 30: "Hotel", 31: "Hotel", 32: "Hotel", 33: "Hotel", 34: "Hotel", 35: "Hotel", 36: "Albergue", 37: "", 38: "Residencia", 39: "Hotel", 40: "Boutique", 41: "Casa de Huéspedes", 42: "Pousada", 43: "Lodge", 44: "B&B", 45: "Hostal", 46: "Hotel", 47: "Hotel", 48: "Hotel", 49: "Resort", 50: "Apartamentos", 51: "Apartamentos", 52: "Pazo", 53: "Hostal", 54: "Hotel", 55: "Hotel", 56: "Hotel", 57: "Hostal", 58: "Pensión", 59: "Apartamentos", 60: "Hotel Apartamento", 61: "Hotel", 62: "Apartamentos" }; return tiposEstablecimientos[idCategoria] ? tiposEstablecimientos[idCategoria] : ""; } function addMinutesToTime(time, minutesToAdd) { var parts = time.split(':'); var hours = parseInt(parts[0], 10); var minutes = parseInt(parts[1], 10); var date = new Date(); date.setHours(hours, minutes, 0, 0); date.setMinutes(date.getMinutes() + minutesToAdd); var formattedTime = date.toTimeString().slice(0, 5); return formattedTime; }