var READY_STATE_UNINITIALIZED=0;var READY_STATE_LOADING=1;var READY_STATE_LOADED=2;var READY_STATE_INTERACTIVE=3;var READY_STATE_COMPLETE=4;var peticion_http;function cargaContenido(a,b,c){peticion_http=inicializa_xhr();if(peticion_http){peticion_http.onreadystatechange=c;peticion_http.open(b,a,true);peticion_http.send(null)}}function inicializa_xhr(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else{if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}}}var MAXNUM_NOCHES=14;var MAXNUM_HABS=3;var MAXNUM_ADULTOS=6;var MAXNUM_NENS=3;var MAXNUM_POBSHOWED=5;var MAXNUM_FLTPREU=6;var CX_NOM_SELECTED=-1;var CX_NOM_FIRST_CLICK=0;var poblacionesLayer=null;var arrayPobShowed=null;var destinoEscrito=null;var destinoBuscar=null;var destinoMostrado=null;var tipoDestino=null;var idiomaCalendar="es";var arrayIdiomasCalendar=["es","es","en-GB","fr","de","it","pt-BR"];var preuMin=null;var preuMax=null;var shabitaciones1;var shabitaciones2;var shabitaciones3;var socupacion1;var socupacion2;var socupacion3;var socupacion4;var mMarcaInit;var iniValSliderPrecio=-1;var nombrePoblacionSeleccionada=null;var indexPoblacionSeleccionada=-1;var keydown=false;var overItems=false;var CX_NOM_INITIAL=true;function inicializaMotorEstatico(){fillNumNochesOptions();fillNumHabOptions();fillNumNens();fillNumAdultos();addEvents();loadParameters();mMarcaInit=mMarca;$("#adultos1").change(onchangeAdultos($("#adultos1"),1));$("#adultos2").change(onchangeAdultos($("#adultos2"),2));$("#adultos3").change(onchangeAdultos($("#adultos3"),3));$("#adultos1").change(onchangeAdultos($("#adultos4"),4));loadOcupacion();try{loadPrecio()}catch(a){}}function cssPobNoSeleccionada(i){eval("$('#itemPob"+i+"').css({'color':'#F44601', 'border':'solid 1px #FFFFFF'});");eval("$('#itemPob"+i+"').hover( function(){$(this).css({'color':'#515151', 'border':'solid 1px #86C3EC'});} )");eval("$('#itemPob"+i+"').mouseout( function(){$(this).css({'color':'#F44601', 'border':'solid 1px #FFFFFF'});} )")}function getNombresLayerNombres(){if(!keydown){CX_NOM_INITIAL=false;$("#cx_noms").val($("#cx_noms").val().toUpperCase());var e=/[Á|À|Â|Ä]/g;var c=/[É|È|Ê|Ë]/g;var b=/[Í|Ì|Î|Ï]/g;var d=/[Ó|Ò|Ô|Ö]/g;var a=/[Ú|Ù|Û|Ü]/g;$("#cx_noms").val($("#cx_noms").val().replace(e,"A"));$("#cx_noms").val($("#cx_noms").val().replace(c,"E"));$("#cx_noms").val($("#cx_noms").val().replace(b,"I"));$("#cx_noms").val($("#cx_noms").val().replace(d,"O"));$("#cx_noms").val($("#cx_noms").val().replace(a,"U"));destinoEscrito=$("#cx_noms").val();if($("#cx_noms").val().length>=3){indexPoblacionSeleccionada=-1;cargaContenido("/servlet/generalcoms.getNomsCercadorHO?idioma="+$("#_top_idioma").val()+"&inicials="+$("#cx_noms").val().substring(0,3),"GET",muestraLayerNombres)}else{$("#pobLayer").css("display","none");showInputs()}}else{keydown=false}}function muestraLayerNombres(){if(peticion_http.readyState==READY_STATE_COMPLETE){if(peticion_http.status==200){eval("poblacionesLayer="+peticion_http.responseText);poblacionesLayer.shift();$("#itemPob0").remove();$("#itemPob1").remove();$("#itemPob2").remove();$("#itemPob3").remove();$("#itemPob4").remove();arrayPobShowed=new Array();var numItem=0;for(var i=0;i<poblacionesLayer.length;i++){if(poblacionesLayer[i].search($("#cx_noms").val())>-1&&numItem<MAXNUM_POBSHOWED){arrayPobShowed[numItem]=i;numItem++}}if(arrayPobShowed.length>=1){for(var i=0;i<arrayPobShowed.length;i++){$("#pobLayer").append("<div class='pobLayerItem' id='itemPob"+i.toString()+"' onmouseover='overItems=true;updateCX_noms("+i+");' onmouseout='setCX_nomsDestinoEscrito();overItems=false;' onclick='setCX_noms("+i+");'>"+poblacionesLayer[arrayPobShowed[i]]+"</div>")}$("#pobLayer").css("display","block")}else{$("#pobLayer").css("display","none");showInputs()}}}}function updateCX_noms(a){if(a==CX_NOM_SELECTED){$("#cx_noms").val(destinoEscrito)}else{$("#cx_noms").val(poblacionesLayer[arrayPobShowed[a]].substring(0,poblacionesLayer[arrayPobShowed[a]].indexOf(" [")))}}function setCX_noms(a){poblacionesLayer[arrayPobShowed[a]]=trim(poblacionesLayer[arrayPobShowed[a]]);destinoEscrito=poblacionesLayer[arrayPobShowed[a]].substring(0,poblacionesLayer[arrayPobShowed[a]].indexOf(" ["));if(poblacionesLayer[arrayPobShowed[a]].search("poblacion")>-1||poblacionesLayer[arrayPobShowed[a]].search("stadt")>-1||poblacionesLayer[arrayPobShowed[a]].search("citta")>-1||poblacionesLayer[arrayPobShowed[a]].search("city")>-1||poblacionesLayer[arrayPobShowed[a]].search("ville")>-1){tipoDestino="P"}if(poblacionesLayer[arrayPobShowed[a]].search("region")>-1||poblacionesLayer[arrayPobShowed[a]].search("gegend")>-1||poblacionesLayer[arrayPobShowed[a]].search("regione")>-1){tipoDestino="R"}if(poblacionesLayer[arrayPobShowed[a]].search("interes")>-1){tipoDestino="I"}if(poblacionesLayer[arrayPobShowed[a]].search("hotel")>-1){tipoDestino="H";var b;b=poblacionesLayer[arrayPobShowed[a]].substr(poblacionesLayer[arrayPobShowed[a]].indexOf("[")+1,poblacionesLayer[arrayPobShowed[a]].length-poblacionesLayer[arrayPobShowed[a]].indexOf("[")-10);$("#nompobhotrep").val(b.toUpperCase())}$("#cx_noms").val(destinoEscrito);$("#pobLayer").css("display","none");showInputs()}function setCX_nomsDestinoEscrito(){$("#cx_noms").val(destinoEscrito)}function addEvents(){$("#numHabitaciones").change(function(){onchangeNumHabs(this)});$("#adultos1").change(function(){onchangeAdultos(this,1)});$("#adultos2").change(function(){onchangeAdultos(this,2)});$("#adultos3").change(function(){onchangeAdultos(this,3)});$("#adultos4").change(function(){onchangeAdultos(this,4)});$("#calendar").click(function(){$("#datepickerEntrada").trigger("focus")});$("#calendar").click(function(){$("#datepickerEntrada").trigger("focus")});$("#calendar2").click(function(){$("#datepickerSalida").trigger("focus")});idiomaCalendar=arrayIdiomasCalendar[mIdioma];$.datepicker.setDefaults($.datepicker.regional[idiomaCalendar]);$("#datepickerEntrada").datepicker({onSelect:function(date){var date2=$("#datepickerEntrada").datepicker("getDate","+1d");date2.setDate(date2.getDate()+1);$("#datepickerSalida").datepicker("setDate",date2);$("#numNoches").val(days_between($("#datepickerEntrada").datepicker("getDate","+1d"),$("#datepickerSalida").datepicker("getDate","+1d")))},numberOfMonths:2,minDate:0,showButtonPanel:true});$("#datepickerSalida").datepicker({beforeShow:function(){var startDate=$("#datepickerEntrada").datepicker("getDate");var _dateIn=new Date(startDate.getFullYear(),startDate.getMonth(),startDate.getDate()+1);if(startDate!=null){$(this).datepicker("option","minDate",_dateIn)}},onSelect:function(date){var difference=difference_between($("#datepickerSalida").datepicker("getDate","+1d"),$("#datepickerEntrada").datepicker("getDate","+1d"));if(difference<=0){openDialogMessage(titleAlertFechaIncorrecta[mIdioma],msgFechas2[mIdioma]);var date2=$("#datepickerEntrada").datepicker("getDate","+1d");date2.setDate(date2.getDate()+1);$("#datepickerSalida").datepicker("setDate",date2);$("#numNoches").val(days_between($("#datepickerEntrada").datepicker("getDate","+1d"),$("#datepickerSalida").datepicker("getDate","+1d")))}else{if(difference>MAXNUM_NOCHES){var date2=$("#datepickerEntrada").datepicker("getDate","+1d");date2.setDate(date2.getDate()+1);$("#datepickerSalida").datepicker("disable").datepicker("setDate",date2).datepicker("enable");$("#dialog").html("");$("#dialog").attr("title",titleAlertNumNoches[mIdioma]);$("#dialog").append(msgFechas3[mIdioma]);$("#dialog").dialog()}}$("#numNoches").val(days_between($("#datepickerEntrada").datepicker("getDate","+1d"),$("#datepickerSalida").datepicker("getDate","+1d")))},numberOfMonths:2,showButtonPanel:true});if(($("#marca").val()!="PL")&&($("#marca").val()!="EN")&&($("#marca").val()!="SQ")){$("#cx_noms").keydown(function(event){if((event.keyCode==40||event.keyCode==38)&&$("#cx_noms").val().length>=3&&arrayPobShowed.length>=1){keydown=true;if(indexPoblacionSeleccionada==CX_NOM_SELECTED){if(event.keyCode==40){indexPoblacionSeleccionada=0}if(event.keyCode==38){indexPoblacionSeleccionada=arrayPobShowed.length-1}}else{if(event.keyCode==40){if(indexPoblacionSeleccionada==(arrayPobShowed.length-1)){indexPoblacionSeleccionada=CX_NOM_SELECTED}else{if(indexPoblacionSeleccionada<(arrayPobShowed.length)){indexPoblacionSeleccionada++}}}if(event.keyCode==38){if(indexPoblacionSeleccionada==0){indexPoblacionSeleccionada=CX_NOM_SELECTED}if(indexPoblacionSeleccionada>0){indexPoblacionSeleccionada--}}}for(var i=0;i<arrayPobShowed.length;i++){if(i==indexPoblacionSeleccionada){eval("$('#itemPob"+i+"').css({'color':'#515151', 'border':'solid 1px #86C3EC'});")}else{cssPobNoSeleccionada(i)}}updateCX_noms(indexPoblacionSeleccionada)}else{if(event.keyCode==13&&$("#cx_noms").val().length>=3){keydown=true;if(arrayPobShowed.length>0&&indexPoblacionSeleccionada==-1){setCX_noms(0)}else{setCX_noms(indexPoblacionSeleccionada)}}}});$("#cx_noms").focusout(function(){if(!overItems){$("#pobLayer").css("display","none");showInputs()}});$("#cx_noms").click(function(){if(CX_NOM_FIRST_CLICK==0){CX_NOM_FIRST_CLICK=1;$("#cx_noms").val("")}})}$("#numNoches").change(function(){var date2=$("#datepickerEntrada").datepicker("getDate","+1d");if(date2!=null){date2.setDate(date2.getDate()+parseInt($("#numNoches :selected").text()));$("#datepickerSalida").datepicker("setDate",date2)}else{$("#dialog").html("");$("#dialog").attr("title","Fecha de entrada no encontrada");$("#dialog").append("Debes definir una fecha de entrada.");$("#dialog").dialog()}});$("#botonBuscar").click(function(){sendSearch()})}function loadPrecio(){var stepstat=1;preuMin=mfltpre.substr(0,mfltpre.indexOf("-"));preuMax=mfltpre.substr(mfltpre.indexOf("-")+1);if(mfltpredin!=""){var preuMinDin=mfltpredin.substr(0,mfltpredin.indexOf("-"));var preuMaxDin=mfltpredin.substr(mfltpredin.indexOf("-")+1)}else{var preuMinDin=preuMin;var preuMaxDin=preuMax}if(preuMin==preuMax){$("#sliderPrecio").slider({disabled:true});$("#preciomin").html(preuMin+"&euro;")}else{if(eval(preuMin)>=0&&eval(preuMax)>eval(preuMin)){try{$("#sliderPrecio").slider({range:true,values:[eval(preuMinDin),eval(preuMaxDin)],min:eval(preuMin),max:eval(preuMax),step:stepstat,slide:function(){$("#preciomin").html($("#sliderPrecio").slider("values",0)+"&euro;");$("#preciomax").html($("#sliderPrecio").slider("values",1)+"&euro;")},stop:function(){$("#preciomin").html($("#sliderPrecio").slider("values",0)+"&euro;");$("#preciomax").html($("#sliderPrecio").slider("values",1)+"&euro;");setFilters(-1,1,-1,-1,-1)}});$("#preciomin").html($("#sliderPrecio").slider("values",0)+"&euro;");$("#preciomax").html($("#sliderPrecio").slider("values",1)+"&euro;")}catch(errno){}}}}function onchangeNumHabs(a){loadNumHabs($(a).val())}function onchangeAdultos(e,c){var b=$("#nens"+c).attr("options");if($(e).val()==1||$(e).val()==2){b.length=0;var a=0;for(var d=0;d<=MAXNUM_NENS;d++){b[a]=new Option(d,d,false,false);a++}$("select#nens"+c+" option[value='0']").attr("selected","selected")}else{if($(e).val()==3){b.length=0;var a=0;b[a]=new Option(0,0,false,false);a++;b[a]=new Option(1,1,false,false);$("select#nens"+c+" option[value='0']").attr("selected","selected")}else{b.length=0;b[0]=new Option(0,0,false,false)}}}function fillNumNochesOptions(){var b=$("#numNoches").attr("options");var a=0;for(var c=1;c<=MAXNUM_NOCHES;c++){b[a]=new Option(c,c,false,false);a++}$("select#numNoches option[value='1']").attr("selected","selected")}function fillNumHabOptions(){var b=$("#numHabitaciones").attr("options");var a=0;for(var c=1;c<=MAXNUM_HABS;c++){b[a]=new Option(c,c,false,false);a++}$("select#numHabitaciones option[value='1']").attr("selected","selected")}function fillNumAdultos(){var f=$("#adultos1").attr("options");var e=$("#adultos2").attr("options");var d=$("#adultos3").attr("options");var c=$("#adultos4").attr("options");var a=0;for(var b=1;b<=MAXNUM_ADULTOS;b++){f[a]=new Option(b,b,false,false);e[a]=new Option(b,b,false,false);d[a]=new Option(b,b,false,false);c[a]=new Option(b,b,false,false);a++}$("select#adultos1 option[value='2']").attr("selected","selected");$("select#adultos2 option[value='1']").attr("selected","selected");$("select#adultos3 option[value='1']").attr("selected","selected");$("select#adultos4 option[value='1']").attr("selected","selected")}function fillNumNens(){var f=$("#nens1").attr("options");var e=$("#nens2").attr("options");var d=$("#nens3").attr("options");var c=$("#nens4").attr("options");var a=0;for(var b=0;b<=MAXNUM_NENS;b++){f[a]=new Option(b,b,false,false);e[a]=new Option(b,b,false,false);d[a]=new Option(b,b,false,false);c[a]=new Option(b,b,false,false);a++}$("select#adultos1 option[value='0']").attr("selected","selected");$("select#adultos2 option[value='0']").attr("selected","selected");$("select#adultos3 option[value='0']").attr("selected","selected");$("select#adultos4 option[value='0']").attr("selected","selected")}function hideInputs(a){if($("#pobLayer").width()>328){$("#divImgDatePickerSalida").css("display","none")}$("#divDatePickerEntrada").css("display","none");$("#divLabelSalida").css("display","none");$("#divInputDatePickerSalida").css("display","none");if(a>=2){$("#numHabitaciones").css("display","none");$("#tituloAdultos1").css("display","none");$("#tituloNens1").css("display","none");$("#labelHab1").css("display","block");$("#adultos1").css("display","block");$("#nens1").css("display","block");$("#labelHab3").css("display","block");$("#adultos3").css("display","block");$("#nens3").css("display","block");if(a>=3){$("#labelHab1").css("display","none");$("#adultos1").css("display","none");$("#nens1").css("display","none");$("#labelHab3").css("display","block");$("#adultos3").css("display","block");$("#nens3").css("display","block");if(a>3){$("#labelHab3").css("display","none");$("#adultos3").css("display","none");$("#nens3").css("display","none")}}}else{$("#numHabitaciones").css("display","block");$("#tituloAdultos1").css("display","block");$("#tituloNens1").css("display","block");$("#labelHab1").css("display","block");$("#adultos1").css("display","block");$("#nens1").css("display","block");$("#labelHab3").css("display","block");$("#adultos3").css("display","block");$("#nens3").css("display","block")}}function showInputs(){$("#divImgDatePickerSalida").css("display","block");$("#divDatePickerEntrada").css("display","block");$("#divLabelSalida").css("display","block");$("#divInputDatePickerSalida").css("display","block");$("#numHabitaciones").css("display","block");$("#tituloAdultos1").css("display","block");$("#tituloNens1").css("display","block");$("#labelHab1").css("display","block");$("#adultos1").css("display","bmuestraLayerlock");$("#nens1").css("display","block");$("#labelHab3").css("display","block");$("#adultos3").css("display","block");$("#nens3").css("display","block")}function trim(a){for(i=0;i<a.length;){if(a.charAt(i)==" "){a=a.substring(i+1,a.length)}else{break}}for(i=a.length-1;i>=0;i=a.length-1){if(a.charAt(i)==" "){a=a.substring(0,i)}else{break}}return a}function days_between(e,d){var f=1000*60*60*24;var c=e.getTime();var b=d.getTime();var a=Math.abs(c-b);return Math.round(a/f)}function difference_between(c,b){var a=1000*60*60*24;return Math.ceil((c.getTime()-b.getTime())/(a))}function sendSearch(){if(validaDestino()){if(validaFechas()){$("#secacc").val(mSecacc);$("#_top_idioma").val(mIdioma);var b="0"+$("#datepickerEntrada").datepicker("getDate").getDate();var a="0"+$("#datepickerSalida").datepicker("getDate").getDate();var d="0"+($("#datepickerEntrada").datepicker("getDate").getMonth()+1);var c="0"+($("#datepickerSalida").datepicker("getDate").getMonth()+1);$("#fent_dia").val(b.substring(b.length-2,b.length));$("#fent_mes").val(d.substring(d.length-2,d.length));$("#fent_any").val($("#datepickerEntrada").datepicker("getDate").getFullYear());$("#fsal_dia").val(a.substring(a.length-2,a.length));$("#fsal_mes").val(c.substring(c.length-2,c.length));$("#fsal_any").val($("#datepickerSalida").datepicker("getDate").getFullYear());$("#desti").val($("#cx_noms").val());if(tipoDestino==null){if(mTipoDestino==""){openDialogMessage(titleAlertDestino[mIdioma],msgDestino[mIdioma]);exit}else{$("#tipus_desti").val(mTipoDestino)}}else{$("#tipus_desti").val(tipoDestino)}$("#nits").val(parseInt($("#numNoches :selected").text()));if(validaOcupacion()){setSelesp();if(navigator.vendor=="Apple Computer, Inc."){setLoading();setTimeout("document.frm1.submit()",50)}if(navigator.vendor!="Apple Computer, Inc."){$('form[name$="frm1"]').submit();setLoading()}}else{openDialogMessage(titleAlertOcup[mIdioma],msgOcup[mIdioma])}}else{openDialogMessage(titleAlertFechaIncorrecta[mIdioma],msgFechas1[mIdioma])}}else{openDialogMessage(titleAlertDestino[mIdioma],msgDestino[mIdioma])}}function setLoading(){var a='<div id="loading_sombra" style="background:black;opacity:0.5;filter:alpha(opacity=50);top:0; left:0; position:absolute; padding: 0px; margin: 0px; visibility:hidden;width: 100%; height: 100%;z-index:2;" align="left" ></div><div id="loading_image" style="width:100%;background:transparent;margin-left: auto; margin-right: auto;left:0px; position: absolute; visibility:hidden; z-index:2; margin-top: 0px; padding: 0px;top:300px"><table width="100%" bgcolor="transparent" align="center"><tr><td><center style="font-family:verdana;font-weight:bolder;font-size:54px;color:white">'+Buscando+'...</center></td></tr><tr><td colspan="2"><center><img width="32px" style="z-index:2" src="/generalcoms/img/loading_animation.gif" alt="loading"/></center></td></tr></table></div>';$("#motorhome2").html($("#motorhome2").html()+""+a);$("body").css("overflow-y","hidden");$("#loading_sombra").css("height","100%");$("#loading_sombra").css("width","100%");$("#loading_sombra").css("position","fixed");$("#loading_image").css("position","fixed");$("#loading_sombra").css("display","block");$("#loading_image").css("display","block");$("#loading_sombra").css("visibility","visible");$("#loading_image").css("visibility","visible");$(window).unload(function(){$("#loading_sombra").css("display","none");$("#loading_image").css("display","none")})}function setSelesp(){if(mMarcaInit=="PL"){if($("#cx_noms").val()=="--Toda la provincia--"){$("#desti").val($("#select_provincia :selected").text());$("#tipus_desti").val("R")}else{$("#tipus_desti").val("P")}}if(mMarcaInit=="SQ"||mMarcaInit=="EN"){if($("#cx_noms").val()=="--Todas las poblaciones--"){$("#desti").val($("#select_pais :selected").text());$("#tipus_desti").val("R")}else{$("#tipus_desti").val("P")}}}function scroll_top(){if(window.pageYOffset){return window.pageYOffset}else{return Math.max(document.body.scrollTop,document.documentElement.scrollTop)}}function validaFechas(){var b=$("#datepickerEntrada").datepicker("getDate","+1d");var a=$("#datepickerSalida").datepicker("getDate","+1d");return !(b==null||a==null)}function validaDestino(){return !((mDestino==mDestinoDefault&&$("#cx_noms").val().search(mDestino)>-1)||$("#cx_noms").val()==""||$("#cx_noms").val()==null)}function validaOcupacion(){var f=parseInt($("#numHabitaciones :selected").text());shabitaciones1=null;shabitaciones2=null;shabitaciones3=null;var a=[parseInt($("#adultos1 :selected").text())+"-"+parseInt($("#nens1 :selected").text()),parseInt($("#adultos2 :selected").text())+"-"+parseInt($("#nens2 :selected").text()),parseInt($("#adultos3 :selected").text())+"-"+parseInt($("#nens3 :selected").text()),parseInt($("#adultos4 :selected").text())+"-"+parseInt($("#nens4 :selected").text())];var e=[parseInt($("#adultos1 :selected").text())+"-"+parseInt($("#nens1 :selected").text()),parseInt($("#adultos2 :selected").text())+"-"+parseInt($("#nens2 :selected").text()),parseInt($("#adultos3 :selected").text())+"-"+parseInt($("#nens3 :selected").text()),parseInt($("#adultos4 :selected").text())+"-"+parseInt($("#nens4 :selected").text())];var g=false;if(f==1){shabitaciones1=1;socupacion1=a[0]}else{if(f==2){if(a[0]==a[1]){shabitaciones1=2;socupacion1=a[0]}else{shabitaciones1=1;shabitaciones2=1;socupacion1=a[0];socupacion2=a[1]}}else{if(f==3||f==4){shabitaciones1=null;shabitaciones2=null;shabitaciones3=null;socupacion1=null;socupacion2=null;socupacion3=null;var h=0;var d=0;for(var c=0;c<f&&!g;c++){if(e[c]!=null){h=0;for(var b=(c+1);b<f&&!g;b++){d++;if(e[b]!=null&&e[c]==a[b]){e[b]=null;h++;if(h>2){g=true}}}if(!g){if(shabitaciones1==null&&shabitaciones2==null&shabitaciones3==null){shabitaciones1=h+1;socupacion1=a[c]}else{if(shabitaciones1!=null&&shabitaciones2==null&shabitaciones3==null){shabitaciones2=h+1;socupacion2=a[c]}else{if(shabitaciones1!=null&&shabitaciones2!=null&shabitaciones3==null){shabitaciones3=h+1;socupacion3=a[c]}}}}}}}}}if(g){return false}else{if(socupacion2==null){shabitaciones2=0;socupacion2="1-0"}if(socupacion3==null){shabitaciones3=0;socupacion3="1-0"}$("#shabitaciones").val(shabitaciones1);$("#shabitaciones2").val(shabitaciones2);$("#shabitaciones3").val(shabitaciones3);$("#socupacion").val(socupacion1);$("#socupacion2").val(socupacion2);$("#socupacion3").val(socupacion3)}return true}function enviaCercaPerServei(_codserv){var res="";for(var compt=0;compt<=9;compt++){if(document.getElementById("checkboxB"+compt).checked==true){res=res+document.getElementById("checkboxB"+compt).value}}document.getElementById("fltserv").value=res.substring(0,res.length-1);for(var compt=1;compt<=7;compt++){if(document.getElementById("checkbox"+compt).checked==true){document.getElementById("marca").value=document.getElementById("checkbox"+compt).value}}$("#fltpre").val(parseInt($("#sliderPrecio").slider("values",0))+"-"+parseInt($("#sliderPrecio").slider("values",1)));res="";for(var compt=0;compt<=7;compt++){if(document.getElementById("checkboxD"+compt).checked==true){res=res+document.getElementById("checkboxD"+compt).value}}document.getElementById("fltctg").value=res;for(var comptP=0;comptP<=2;comptP++){var objP=eval("document.checkpago.checkboxE"+comptP);if(objP.checked){document.getElementById("fltpago").value=objP.value}}for(var comptR=0;comptR<=4;comptR++){var objR=eval("document.checkregim.checkboxF"+comptR);if(objR.checked){document.getElementById("fltrgm").value=objR.value}}document.getElementById("fltnmht").value=document.getElementById("filtre_hotname").value;sendSearch()}function enviaCercaPerPreu(){var res="";for(var compt=0;compt<=9;compt++){if(document.getElementById("checkboxB"+compt).checked==true){res=res+document.getElementById("checkboxB"+compt).value}}document.getElementById("fltserv").value=res.substring(0,res.length-1);for(var compt=1;compt<=7;compt++){if(document.getElementById("checkbox"+compt).checked==true){document.getElementById("marca").value=document.getElementById("checkbox"+compt).value}}res="";for(var compt=0;compt<=7;compt++){if(document.getElementById("checkboxD"+compt).checked==true){res=res+document.getElementById("checkboxD"+compt).value}}document.getElementById("fltctg").value=res;for(var comptP=0;comptP<=2;comptP++){var objP=eval("document.checkpago.checkboxE"+comptP);if(objP.checked){document.getElementById("fltpago").value=objP.value}}$("#fltpre").val(parseInt($("#sliderPrecio").slider("values",0))+"-"+parseInt($("#sliderPrecio").slider("values",1)));for(var comptR=0;comptR<=4;comptR++){var objR=eval("document.checkregim.checkboxF"+comptR);if(objR.checked){document.getElementById("fltrgm").value=objR.value}}document.getElementById("fltnmht").value=document.getElementById("filtre_hotname").value}function enviaCercaPerMarca(_marca){var res="";for(var compt=0;compt<=9;compt++){if(document.getElementById("checkboxB"+compt).checked==true){res=res+document.getElementById("checkboxB"+compt).value}}document.getElementById("fltserv").value=res.substring(0,res.length-1);document.getElementById("marca").value=_marca;$("#fltpre").val("");res="";for(var compt=0;compt<=7;compt++){if(document.getElementById("checkboxD"+compt).checked==true){res=res+document.getElementById("checkboxD"+compt).value}}document.getElementById("fltctg").value=res;for(var comptP=0;comptP<=2;comptP++){var objP=eval("document.checkpago.checkboxE"+comptP);if(objP.checked){document.getElementById("fltpago").value=objP.value}}for(var comptR=0;comptR<=4;comptR++){var objR=eval("document.checkregim.checkboxF"+comptR);if(objR.checked){document.getElementById("fltrgm").value=objR.value}}document.getElementById("fltnmht").value=document.getElementById("filtre_hotname").value;sendSearch()}function enviaCercaPerCateg(_codctg){var res="";if(_codctg=="0"){for(var compt=1;compt<=7;compt++){document.getElementById("checkboxD"+compt).checked=false}res="0"}else{for(var compt=1;compt<=7;compt++){if(document.getElementById("checkboxD"+compt).checked==true){res=res+document.getElementById("checkboxD"+compt).value}}if(res==""){res="0"}}document.getElementById("fltctg").value=res;res="";for(var compt=0;compt<=9;compt++){if(document.getElementById("checkboxB"+compt).checked==true){res=res+document.getElementById("checkboxB"+compt).value}}document.getElementById("fltserv").value=res.substring(0,res.length-1);for(var compt=1;compt<=7;compt++){if(document.getElementById("checkbox"+compt).checked==true){document.getElementById("marca").value=document.getElementById("checkbox"+compt).value}}$("#fltpre").val(parseInt($("#sliderPrecio").slider("values",0))+"-"+parseInt($("#sliderPrecio").slider("values",1)));for(var comptP=0;comptP<=2;comptP++){var objP=eval("document.checkpago.checkboxE"+comptP);if(objP.checked){document.getElementById("fltpago").value=objP.value}}for(var comptR=0;comptR<=4;comptR++){var objR=eval("document.checkregim.checkboxF"+comptR);if(objR.checked){document.getElementById("fltrgm").value=objR.value}}document.getElementById("fltnmht").value=document.getElementById("filtre_hotname").value;sendSearch()}function enviaCercaPerPago(_codpg){document.getElementById("fltpago").value=_codpg;var res="";for(var compt=0;compt<=9;compt++){if(document.getElementById("checkboxB"+compt).checked==true){res=res+document.getElementById("checkboxB"+compt).value}}document.getElementById("fltserv").value=res.substring(0,res.length-1);for(var compt=1;compt<=7;compt++){if(document.getElementById("checkbox"+compt).checked==true){document.getElementById("marca").value=document.getElementById("checkbox"+compt).value}}res="";for(var compt=0;compt<=7;compt++){if(document.getElementById("checkboxD"+compt).checked==true){res=res+document.getElementById("checkboxD"+compt).value}}document.getElementById("fltctg").value=res;$("#fltpre").val(parseInt($("#sliderPrecio").slider("values",0))+"-"+parseInt($("#sliderPrecio").slider("values",1)));for(var comptR=0;comptR<=4;comptR++){var objR=eval("document.checkregim.checkboxF"+comptR);if(objR.checked){document.getElementById("fltrgm").value=objR.value}}document.getElementById("fltnmht").value=document.getElementById("filtre_hotname").value;sendSearch()}function enviaCercaPerRegim(_codrgm){document.getElementById("fltrgm").value=_codrgm;var res="";for(var compt=0;compt<=9;compt++){if(document.getElementById("checkboxB"+compt).checked==true){res=res+document.getElementById("checkboxB"+compt).value}}document.getElementById("fltserv").value=res.substring(0,res.length-1);for(var compt=1;compt<=7;compt++){if(document.getElementById("checkbox"+compt).checked==true){document.getElementById("marca").value=document.getElementById("checkbox"+compt).value}}res="";for(var compt=0;compt<=7;compt++){if(document.getElementById("checkboxD"+compt).checked==true){res=res+document.getElementById("checkboxD"+compt).value}}document.getElementById("fltctg").value=res;$("#fltpre").val(parseInt($("#sliderPrecio").slider("values",0))+"-"+parseInt($("#sliderPrecio").slider("values",1)));for(var comptP=0;comptP<=2;comptP++){var objP=eval("document.checkpago.checkboxE"+comptP);if(objP.checked){document.getElementById("fltpago").value=objP.value}}document.getElementById("fltnmht").value=document.getElementById("filtre_hotname").value;sendSearch()}function enviaCercaPerNomHotel(){var res="";res="";for(var compt=0;compt<=7;compt++){if(document.getElementById("checkboxD"+compt).checked==true){res=res+document.getElementById("checkboxD"+compt).value}}document.getElementById("fltctg").value=res;res="";for(var compt=0;compt<=9;compt++){if(document.getElementById("checkboxB"+compt).checked==true){res=res+document.getElementById("checkboxB"+compt).value}}document.getElementById("fltserv").value=res.substring(0,res.length-1);for(var compt=1;compt<=7;compt++){if(document.getElementById("checkbox"+compt).checked==true){document.getElementById("marca").value=document.getElementById("checkbox"+compt).value}}$("#fltpre").val(parseInt($("#sliderPrecio").slider("values",0))+"-"+parseInt($("#sliderPrecio").slider("values",1)));for(var comptP=0;comptP<=2;comptP++){var objP=eval("document.checkpago.checkboxE"+comptP);if(objP.checked){document.getElementById("fltpago").value=objP.value}}for(var comptR=0;comptR<=4;comptR++){var objR=eval("document.checkregim.checkboxF"+comptR);if(objR.checked){document.getElementById("fltrgm").value=objR.value}}document.getElementById("fltnmht").value=document.getElementById("filtre_hotname").value;sendSearch()}function deselectCategoria(b){if(b!=0){document.getElementById("checkboxD0").checked=false;$("label[for=checkboxD0]").addClass("checkbox_unchecked")}else{for(var a=1;a<=7;a++){document.getElementById("checkboxD"+a).checked=false;$("label[for=checkboxD"+a+"]").addClass("checkbox_unchecked")}}getValoresFiltros()}function deselectPrecios(b){for(var a=1;a<=6;a++){if($("#preu"+a).val()=="checked"&&a!=b){$("#preu"+a).val("")}}getValoresFiltros()}function deselectMarcas(a){for(var b=1;b<=7;b++){if($("#checkbox"+b).is(":checked")==true&&b!=a){document.getElementById("checkbox"+b).checked=false;$("label[for=checkbox"+b+"]").addClass("checkbox_unchecked")}}getValoresFiltros()}function cercaPerNomHotel(){$("#fltnmht").val($("#filtre_hotname").val());setFilters(-1,-1,-1,-1,1)}function selectPrecio(b,c){if($("#preu"+c).val()=="checked"){mfltpre=parseInt($("#sliderPrecio").slider("values",1))-parseInt($("#sliderPrecio").slider("values",0));$("#preu"+c).val("checked")}else{for(var a=1;a<=6;a++){if(a!=c){$("#preu"+c).val("")}}mfltpre=b}setFilters(-1,1,-1,-1,-1)}function selectMarca(a,c){if(document.getElementById("checkbox"+c).checked==true){mMarca=document.getElementById("checkbox1").value;document.getElementById("checkbox1").checked=true;$('label[for="checkbox1"]').css("background","url(/generalcoms/img/tick.png) no-repeat");if(c!=1){$("label[for=checkbox"+c+"]").css("background","url(/generalcoms/img/cross.png) no-repeat")}}else{$("label[for=checkbox"+c+"]").css("background","url(/generalcoms/img/tick.png) no-repeat");for(var b=1;b<=7;b++){if(b!=c){document.getElementById("checkbox"+b).checked=false;$("label[for=checkbox"+b+"]").css("background","url(/generalcoms/img/cross.png) no-repeat")}}mMarca=a}setFilters(-1,-1,1,-1,-1)}function selectCategoria(c,d){mfltctg="";if(d==0){document.getElementById("checkboxD0").checked=true;$('label[for="checkboxD0"]').css("background","url(/generalcoms/img/tick.png) no-repeat");mfltctg=document.getElementById("checkboxD0").value;for(var a=1;a<=7;a++){document.getElementById("checkboxD"+a).checked=false;$("label[for=checkboxD"+a+"]").css("background","url(/generalcoms/img/cross.png) no-repeat")}}else{document.getElementById("checkboxD0").checked=false;$("label[for=checkboxD0]").css("background","url(/generalcoms/img/cross.png) no-repeat");if(document.getElementById("checkboxD"+d).checked==true){var b=0;for(var a=1;a<=7;a++){if($("#checkboxD"+a).is(":checked")==true&&a!=d){b++;mfltctg=mfltctg+document.getElementById("checkboxD"+a).value}else{$("label[for=checkboxD"+a+"]").css("background","url(/generalcoms/img/cross.png) no-repeat")}}if(b==0){document.getElementById("checkboxD0").checked=true;$('label[for="checkboxD0"]').css("background","url(/generalcoms/img/tick.png) no-repeat");mfltctg=document.getElementById("checkboxD0").value}}else{for(var a=1;a<=7;a++){if($("#checkboxD"+a).is(":checked")==true||a==d){if(a==d){$('label[for="checkboxD'+a+'"]').css("background","url(/generalcoms/img/tick.png) no-repeat")}mfltctg=mfltctg+document.getElementById("checkboxD"+a).value}}}}setFilters(1,-1,-1,-1,-1)}function selectServicio(a,d){mfltserv="";if($("#checkboxB"+d).is(":checked")){var c=0;for(var b=0;b<=9;b++){if($("#checkboxB"+b).is(":checked")&&b!=d){mfltserv=mfltserv+document.getElementById("checkboxB"+b).value;c++}else{$("label[for=checkboxB"+b+"]").css("background","url(/generalcoms/img/cross.png) no-repeat")}}if(c==0){mfltserv=""}}else{for(var b=0;b<=9;b++){if($("#checkboxB"+b).is(":checked")||b==d){mfltserv=mfltserv+document.getElementById("checkboxB"+b).value;if(b==d){$('label[for="checkboxB'+b+'"]').css("background","url(/generalcoms/img/tick.png) no-repeat")}}}}mfltserv=mfltserv.substring(0,(mfltserv.length-1));setFilters(-1,-1,-1,1,-1)}function setFilters(d,e,c,b,a){if(a!=-1){setFCategoria();setSliderPrecio();setFMarca();setFServicio()}else{if(d!=-1){$("#fltctg").val(mfltctg);setSliderPrecio();setFMarca();setFServicio()}else{if(e!=-1){setSliderPrecio();setFCategoria();setFMarca();setFServicio()}else{if(c!=-1){$("#marca").val(mMarca);setFCategoria();setSliderPrecio();setFServicio()}else{if(b!=-1){$("#fltserv").val(mfltserv);setFCategoria();setSliderPrecio();setFMarca()}}}}}sendSearch()}function setFCategoria(){mfltctg="";for(var a=1;a<=7;a++){if($("#checkboxD"+a).is(":checked")){mfltctg=mfltctg+document.getElementById("checkboxD"+a).value}}$("#fltctg").val(mfltctg)}function setSliderPrecio(){$("#fltpre").val(parseInt($("#sliderPrecio").slider("values",0)+"-"+$("#sliderPrecio").slider("values",1)));document.getElementById("fltnmht").value=document.getElementById("filtre_hotname").value;enviaCercaPerPreu()}function setFMarca(){if(mMarca=="ES"||mMarca=="EN"||mMarca=="PL"){$("#marca").val(mMarca)}else{mMarca="";for(var a=1;a<=7;a++){if($("#checkbox"+a).is(":checked")){mMarca=document.getElementById("checkbox"+a).value}}$("#marca").val(mMarca)}}function setFServicio(){mfltserv="";for(var a=0;a<=9;a++){if($("#checkboxB"+a).is(":checked")){mfltserv=mfltserv+document.getElementById("checkboxB"+a).value}}$("#fltserv").val(mfltserv)}function openDialogMessage(b,a){$("#dialog").html("");$("#dialog").attr("title",b);$("#dialog").append(a);$("#dialog").dialog()}function loadParameters(){$("#_top_idioma").val(mIdioma);if(mMarca!="PL"&&mMarca!="SQ"&&mMarca!="EN"){$("#cx_noms").val(mDestino)}var a=mHab1+mHab2+mHab3;$("select#numHabitaciones option[value='"+a+"']").attr("selected","selected");loadNumHabs(a);loadOcupacion();loadFechas();loadSliderPrecio()}function loadNumHabs(a){if(a==1){$("#divCamposHabitaciones_fo2").css("display","none");$("#linea1TablaOcup2").css("display","none");$("#linea2TablaOcup1").css("display","none");$("#linea2TablaOcup2").css("display","none")}else{if(a==2){$("#divCamposHabitaciones_fo2").css("display","block");$("#linea1TablaOcup2").css("display","block");$("#linea2TablaOcup1").css("display","none");$("#linea2TablaOcup2").css("display","none")}else{if(a==3){$("#divCamposHabitaciones_fo2").css("display","block");$("#linea1TablaOcup2").css("display","block");$("#linea2TablaOcup1").css("display","block");$("#linea2TablaOcup2").css("display","none")}else{if(a==4){$("#divCamposHabitaciones_fo2").css("display","block");$("#linea1TablaOcup2").css("display","block");$("#linea2TablaOcup1").css("display","block");$("#linea2TablaOcup2").css("display","block")}}}}}function loadOcupacion(){var a=1;if(mHab1>=1){var d=mOcup1.substring(0,1);var c=mOcup1.substring(2);for(var b=0;b<mHab1;b++){$("select#adultos"+a+" option[value='"+parseInt(d)+"']").attr("selected","selected");$("select#nens"+a+" option[value='"+parseInt(c)+"']").attr("selected","selected");a=a+1}}if(mHab2>=1){var d=mOcup2.substring(0,1);var c=mOcup2.substring(2);for(var b=0;b<mHab2;b++){$("select#adultos"+a+" option[value='"+parseInt(d)+"']").attr("selected","selected");$("select#nens"+a+" option[value='"+parseInt(c)+"']").attr("selected","selected");a=a+1}}if(mHab3>=1){var d=mOcup3.substring(0,1);var c=mOcup3.substring(2);for(var b=0;b<mHab3;b++){$("select#adultos"+a+" option[value='"+parseInt(d)+"']").attr("selected","selected");$("select#nens"+a+" option[value='"+parseInt(c)+"']").attr("selected","selected");a=a+1}}}function loadFechas(){if(mFechaEntrada==null||mFechaSalida==null){var a=new Date();$("#datepickerEntrada").datepicker("setDate",a);a.setDate(a.getDate()+1);$("#datepickerSalida").datepicker("setDate",a)}else{$("#datepickerEntrada").val(mFechaEntrada);$("#datepickerSalida").val(mFechaSalida)}$("#numNoches").val(days_between($("#datepickerEntrada").datepicker("getDate","+1d"),$("#datepickerSalida").datepicker("getDate","+1d")))}function loadSliderPrecio(){if($("#preu0").length>0){for(var a=0;a<250;a++){if($("#preu"+a).val()=="checked"){iniValSliderPrecio=a}}}}var titleAlertDestino=["Campo sin completar","Campo sin completar","Field missing","Champ vide","Feld leer","Campo non inserito"];var titleAlertFechaIncorrecta=["Fechas incorrectas","Fechas incorrectas","Wrong dates","Erreur sur les dates","Falsche Daten","Date non corrette"];var titleAlertOcup=["Error en datos de ocupación","Error en datos de ocupación","Occupation data error","Erreur dans la profession","Fehler in der Belegungszahl","Errore nei dati di pernottamento"];var titleAlertNumNoches=["Límite de noches excedido","Límite de noches excedido","Booking nights exceeded","Nombre de nuitées dépassé","Sie haben das Übernachtungslimit überschritten","Limite di notti superato"];var msgDestino=["Por favor, vuelve a introducir el destino, debes seleccionar entre una de las opciones del desplegable.","Por favor, vuelve a introducir el destino, debes seleccionar entre una de las opciones del desplegable.","Please type your destination again, you must select an option from the drop-down.","S'il vous plaît re-entrer votre destination, vous devez sélectionner les options à partir d'un menu déroulant.","Bitte wiederholen Sie Ihr Ziel, müssen Sie aus einer Drop-Down-Optionen auszuwählen.","Per favore, introduci nuovamente la tua destinazione, scegliendo tra una delle opzioni del menú."];var msgFechas1=["Por favor, revisa las fechas de entrada y salida.","Por favor, revisa las fechas de entrada y salida.","Please verify checkin and checkout dates.","S'il vous plaît vérifier les dates d'entrée et de sortie.","Bitte überprüfen Sie ob das An- und Abreisedatum korrekt sind.","Per favore, controlla le date di arrivo e partenza."];var msgFechas2=["La fecha de salida debe ser posterior a la fecha de entrada.","La fecha de salida debe ser posterior a la fecha de entrada.","Checkout date must be later then checkin date.","Date de départ doit être postérieure à la date d'entrée.","Das Abreisedatum muss nach dem Anreisetag erfolgen.","La data di partenza deve essere posteriore alla data di arrivo."];var msgFechas3=["Límite de noches excedido. Lo sentimos, pero el número máximo de noches que se pueden reservar a través de nuestra página web es de 14, por favor llame a nuestro teléfono de atención al cliente para formalizar una reserva de más noches","Límite de noches excedido. Lo sentimos, pero el número máximo de noches que se pueden reservar a través de nuestra página web es de 14, por favor llame a nuestro teléfono de atención al cliente para formalizar una reserva de más noches.","We apologize, but the maximum number of bookable nights is 14.","Nous sommes au regret de vous annoncer que le nombre maximum de nuitées réservables est de 14 nuits.","Bitte beachten Sie, dass maximal 14 Übernachtungen gebucht werden können.","Siamo spiacenti, pero il numero massimo di notti che si possono prenotare é 14."];var msgOcup=["Sólo pueden seleccionarse como máximo 3 habitaciones del mismo tipo.","Sólo pueden seleccionarse como máximo 3 habitaciones del mismo tipo.","You can only select a maximum of 3 rooms of the same type.","Vous ne pouvez sélectionner un maximum de 3 pièces du même type.","Es können max 3 Zimmer von der gleichen Kategorie ausgewählt werden.","É possibile selezionare al massimo 3 stanze dello stesso tipo."];var labelPrecio0=["Todos los precios","Menos de 50 euros","Entre 50 y 100 euros","Entre 101 y 150 euros","Entre 151 y 200 euros","Desde 200 euros"];var labelPrecio1=["Todos los precios","Menos de 50 euros","Entre 50 y 100 euros","Entre 101 y 150 euros","Entre 151 y 200 euros","Desde 200 euros"];var labelPrecio2=["All prices","Less than 50 and 100 euros","Between 50 and 100 euros","Between 101 and 150 euros","Between 151 and 200 euros","From 200 euros"];var labelPrecio3=["Tous les prix","Moins de 50 euros","Entre 50 y 100 euros","Entre 101 y 150 euros","Entre 151 y 200 euros","Depuis 200 euros"];var labelPrecio4=["Alle Preise","Weniger als 50 euros","Von 50 y 100 euros","Von 101 y 150 euros","Von 151 y 200 euros","Mehr als 200 euros"];var labelPrecio5=["Tutti i prezzi","Meno di 50 euros","Tra 50 y 100 euros","Tra 101 y 150 euros","Tra 151 y 200 euros","Più di 200 euros"];var labelPrecio6=["Todos los precios","Menos de 50 euros","Entre 50 y 100 euros","Entre 101 y 150 euros","Entre 151 y 200 euros","Desde 200 euros"];var valPrecio=["0-90000","0-49","49-100","100-150","150-200","200-90000"];
