var i, a; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("title") == "jsenabled") { a.disabled = true; a.disabled = false; } } var ie6 = false; if ( navigator.appName=="Microsoft Internet Explorer" && !(window.XMLHttpRequest) ) { ie6 = true; document.getElementsByClassName = function(cl) { var retnode = []; var myclass = new RegExp('\\b'+cl+'\\b'); var elem = this.getElementsByTagName('*'); for (var i = 0; i < elem.length; i++) { var classes = elem[i].className; if (myclass.test(classes)) retnode.push(elem[i]); } return retnode; }; } function init_header(){ $('.close').click(function(){ $(this.parentNode).hide('fast'); return false; }); $('.button').mouseover(function() {$(this).addClass("butOver");}).mouseout(function() {$(this).removeClass("butOver");}); $('.button2').mouseover(function() {$(this).addClass("butOver2");}).mouseout(function() {$(this).removeClass("butOver2");}); } function init_calendar(){ $('.date-pick').datePicker(); $('#date1').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#date2').dpSetStartDate(d.addDays(1).asString()); } } ); $('#date2').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#date1').dpSetEndDate(d.addDays(-1).asString()); } } ); $('#linkTodosDestinos').click(function(){ $('#llistaPaisos').bgiframe().fadeIn('fast'); return false; }); } function init_compartir(){ if (ie6) { linkCompartir.onclick = function(){capaCompartir.style.display="block"; return false;} ; } else { $('#linkCompartir').click(function(){ $('#capaCompartir').fadeIn('fast'); return false; }); $('.close').click(function(){ $(this.parentNode).hide('fast'); return false; }); } } function init_calendar_inline(){ $('.date-pick').datePicker(); $('#date1').bind( 'dateSelected', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#date2').dpSetStartDate(d.addDays(1).asString()); } } ); $('#date2').bind( 'dateSelected', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#date1').dpSetEndDate(d.addDays(-1).asString()); } } ); $('.marco') .datePicker({inline:true}); $('#calendar1') .bind('dateSelected', function(e, selectedDate, $td) { $('#date1').css('display', 'block'); $('#date1').val(selectedDate.asString()); }); $('#calendar2').bind( 'dateSelected', function(e, selectedDate, $td){ $('#date2').css('display', 'block'); $('#date2').val(selectedDate.asString()); }); $('#linkTodosDestinos').click(function(){ $('#llistaPaisos').bgiframe().fadeIn('fast'); return false; }); } function init_buscador(){ var formPlegat = $('#formBuscPlegat'); var formDesplegat = $('#formBuscDesplegat'); formPlegat.find('div.titol a').click(function(){ formPlegat.hide(); formDesplegat.fadeIn('fast'); return false; }); formDesplegat.find('div.titol a').click(function(){ formDesplegat.hide(); formPlegat.fadeIn('fast'); return false; }); } var newHab; var newNino; function init_habitaciones(){ $("#formNoJs").remove(); $("select","div.ninos").change(function () { var objHab = this.parentNode.parentNode; var totNinos = this[this.selectedIndex].value; if (totNinos>0){ creaFormNinos(totNinos,objHab.id); } else{ $(objHab).find('div.edadNinos').hide().remove(); } }); newHab = $("#habitacion").clone(true); newNino = $("div#edadNinos").clone(true); var totHab = $("select#habitaciones option:selected").val(); creaForm(totHab); $("select#habitaciones").change(function () { var totHab = $("select#habitaciones option:selected").val(); if (totHab>0){ creaForm(totHab);} }); } function creaForm(totHab){ $("div.habitacion","#divHuespedes").remove(); for (i=0;i0){ creaFormNinos(totNinos,objHab.id); } else{ $(objHab).find('div.edadNinos').hide().remove(); } }); } if (totHab<2) { $('#divHuespedes').removeClass('on'); } else {$('#divHuespedes').addClass('on');} } function creaFormNinos(totN,idHab){ var divHab = $('#'+idHab); $("div.edadNinos","#habitacion").remove(); divHab.find("div.edadNinos").remove(); for (j=0;j'+arrayTitols[c]+'
'; } document.getElementById('videogran').innerHTML=html; } function mycarousel_initCallback(carousel) { var botoPause=$('#mycarousel-stop'); var botoPlay=$('#mycarousel-auto'); var fotosPetites = $('.jcarousel-control a'); fotosPetites.bind('click', function() { carousel.startAuto(0);// Disable autoscrolling fotosPetites.removeClass('on'); $(this).addClass('on'); carousel.scroll(jQuery.jcarousel.intval($(this).attr('title'))); botoPlay.removeClass('on'); botoPause.addClass('on'); return false; }); botoPlay.bind('click', function() { carousel.startAuto(2); //Enable autoscrolling 2 sec $(this).addClass('on'); botoPause.removeClass('on'); return false; }); botoPause.bind('click', function() { carousel.startAuto(0);// Disable autoscrolling $(this).addClass('on'); botoPlay.removeClass('on'); return false; }); $('#mycarousel-next') .bind('click', function() { carousel.next(); carousel.startAuto(0);// Disable autoscrolling botoPlay.removeClass('on'); botoPause.addClass('on'); return false; }) .mousedown(function(){$(this).addClass('on');}) .mouseup(function(){$(this).removeClass('on');}); $('#mycarousel-prev') .bind('click', function() { carousel.prev(); carousel.startAuto(0);// Disable autoscrolling botoPlay.removeClass('on'); botoPause.addClass('on'); return false; }) .mousedown(function(){$(this).addClass('on');}) .mouseup(function(){$(this).removeClass('on');}); // Pause autoscrolling if the user moves with the cursor over the clip. carousel.clip.hover(function() { carousel.stopAuto(); }, function() { carousel.startAuto(); }); //$('#fotografias .controls div').mouseover(function() {$(this).addClass("on");}).mouseout(function() {$(this).removeClass("on");}); } /* flash videos */ function playVideo(flashVideo){ $('#videogran').html('').flash({src: flashVideo,width: 422,height: 285},{version: 8}); return false; } function init_videos(){ var fotosPetites = $('.otrosVideos a'); fotosPetites.bind('click', function() { fotosPetites.removeClass('on'); $(this).addClass('on'); return false; }); } function init_submenuDetalle(){ var linkSubmenu = $('.linkSubmenu'); var submenu = $('#submenuDetalle'); var seccions = $('div.secVariable'); linkSubmenu.each(function(){ $(this).bind ('click',function(){ var seccio = $(this).attr('class').substring(12); var linkMenu=$(this); submenu.find('li').removeClass('on'); var seccioOn=$('#'+seccio); var pestanyaOn=$('#li'+seccio); pestanyaOn.addClass('on'); seccions.hide(); seccioOn.show(); }); }); } function init_ajuste_busqueda(){ $('#ajuste div.ui-slider').slider({ min:minRange, max:maxRange, steps: maxRange-maxRange, range: true, change: function(e,ui) { var wichHandle=$(ui.handle).attr('id'); if(wichHandle=="handle-left") $('#handle-left-value span').html(ui.value) else $('#handle-right-value span').html(ui.value); }/*, slide: function(e, ui){ alert(ui.value); } */ }); $('#handle-left-value span').html(minRange); $('#handle-right-value span').html(maxRange); } function init_detalle_reserva(){ $("#linkDesgloseTarifa").click(function(){ $("#desgloseTarifa").toggle(); return false; }); } //guia destinos function carousel_guia_videos_initCallback(carousel) { $('#carousel_guia_videos-next') .bind('click', function() { carousel.next(); return false; }); $('#carousel_guia_videos-prev') .bind('click', function() { carousel.prev(); return false; }); } function carousel_guia_fotos_initCallback(carousel) { $('#carousel_guia_fotos-next') .bind('click', function() { carousel.next(); return false; }); $('#carousel_guia_fotos-prev') .bind('click', function() { carousel.prev(); return false; }); } /*visita virtual*/ function init_visita_virtual(){ var fotos = $('#tiraFotosVirtuales li'); fotos.bind('click',function(){ fotos.removeClass('on'); $(this).addClass('on'); var virtual = $('#fotovirtual'); var srcImg = $(this).find('img').attr("src"); var srcImg2 = srcImg.split('.'); var srcVisita = srcImg2[0] + '_gran.'+srcImg2[1]; var text = $(this).find('p').text(); virtual.find('img').attr('src',srcVisita); virtual.find('div.text').html(text); }); fotos .mouseover(function() { $(this).addClass("over"); }) .mouseout(function() { $(this).removeClass("over"); }); } /*guia destinos*/ function init_guia_destinos(){ $('#linkPaises').click(function(){ $('div.popInfo').hide(); $('#infoPaisos').fadeIn('fast'); return false; }); $('#linkDestinos').click(function(){ $('div.popInfo').hide(); $('#infoDestins').fadeIn('fast'); return false; }); $('.close').click(function(){ $(this.parentNode).hide('fast'); return false; }); } /** * Aquesta funció amaga controla le opcions de cerca de la * caixa de cerca de la portada * @date 5.9.08 */ function init_opciones_busqueda() { $('.divHotel').hide(); $('.divCodiPromocional').hide(); $('.divCategoria').hide(); $('.formReserva form').after('

Más opciones de búsqueda:

'); //$('.formReserva form').after('

Más opciones de búsqueda:

'); // Mostrem les opcions que calgui $('.masOpc a').click(function() { var $li = $(this).parent('li'); $('.' + $li.attr('id')).show(); $li.html($(this).text()); // Aquest és un patch per amagar els combos de país i destí if ($li.attr('id') == "divHotel") { $('.divPais').hide(); $('.divDestino').hide(); } return false; }); } /** * Aquesta funció amaga controla le opcions de cerca de la * caixa de cerca de les planes de reserva. * @date 5.9.08 */ function init_opciones_busqueda_reserva() { $('.pHotel').hide(); $('.pCodiPromocional').hide(); $('.pCategoria').hide(); $('#pBusqueda .macro form').append('

Más opciones de búsqueda:

'); // Mostrem les opcions que calgui $('.masOpc a').click(function() { var $li = $(this).parent('li'); $('.' + $li.attr('id')).show(); $li.html($(this).text()); // Aquest és un patch per amagar els combos de país i destí if ($li.attr('id') == "pHotel") { $('.pPais').hide(); $('.pDestino').hide(); } return false; }); } /** * Inicialitza tots els efectes de la taula de reserves * @date 18.10.08 */ function init_table_effects () { if (ie6) { $('.resultats-reserves tr').hover( function() {for(var i=0;i<$(this.childNodes).length;i++) $(this.childNodes[i]).addClass('over');}, function() {for(var i=0;i<$(this.childNodes).length;i++) $(this.childNodes[i]).removeClass('over');}); } else { $('.resultats-reserves tr').hover(function() { $(this).addClass('over'); }, function() { $(this).removeClass('over'); }); } var desplegableObert = null; $('.resultats-reserves .eines .imprimir').click(function() { if (desplegableObert == this) { amagarDesplegable(); } else { // amaguem algun que ja estigui obert amagarDesplegable(); $(this).find('img').attr('src', 'img/boto-imprimir-reserva-desplegat.gif'); $(this).find('.desplegable-imprimir').show(); desplegableObert = this; $(document.body).click(amagarDesplegable); return false; } function amagarDesplegable() { if (desplegableObert != null) { $(desplegableObert).find('img').attr('src', 'img/boto-imprimir-reserva.gif'); $(desplegableObert).find('.desplegable-imprimir').hide(); desplegableObert = null; } } }); } function init_modificar_reserva() { // tractament del formulari dinàmic $('.modificar-reserva .nens p').hide(); $('.modificar-reserva .num-nens') .each(function () { mostra_form_edat_nens(this); }) .change(function () { mostra_form_edat_nens(this); }); function mostra_form_edat_nens (elem) { var numNens = $(elem).find('option:selected').val(); var $nens = $(elem).parents('.afegir-ocupants:first').find('.nens'); $nens.find('p').hide(); for (var i = 0; i < numNens; i++) { $nens.find('p:eq(' + i + ')').show(); } } // control de visualització de les opcions de modificació $('.modificar-reserva #ocupantes-promocode, .modificar-reserva #quitar-habitaciones, .modificar-reserva #nombres-huespedes').hide(); $('.modificar-reserva .modificar-reserva li a').click(function() { $('.modificar-reserva ' + $(this).attr('href')).toggle(); return false; }); } /** * Inicialitza dos calendaris per a que es vegin en línia * @date 11.10.08 */ function init_calendar_inline_home(){ $('.calendar').datePicker({inline:true}); $('#calendar1') .bind('dateSelected', function(e, selectedDate, $td) { $('#date1').css('display', 'block'); $('#date1').val(selectedDate.asString()); }); $('#calendar2').bind( 'dateSelected', function(e, selectedDate, $td){ $('#date2').css('display', 'block'); $('#date2').val(selectedDate.asString()); }); }