PageSourceSearch

https://hotelcatharinaparaguacu.com.br/js/functions.js

js hotelcatharinaparaguacu.com.br collected 2026-10-07 04:08:23 UTC 17,270 bytes, 545 lines download raw bytes

1var  url1 = "https://book.omnibees.com/hotelresults?c=1030&q=1117&hotel_folder=";
2var  url2 = "&group_code=&Code=&loyalty_code=&lang=pt-BR&currencyId=16&version=4";
3var qtd = 0;
4
5
6function VerificaReserva(){
7
8    var adultos = '';
9    var criancas = '';
10    var idades = '';
11    var erro = 0;
12
13    if ($('input[name=lingua]').val() == 'en') {
14        lg = 'en';
15    }else{
16        lg = 'pt';
17    }
18
19	if ($("#check_in").val() == ""){
20        if (lg=='pt'){
21		    alert("Informe a data inicial da reserva");
22        }else{
23            alert("Please inform check-in date");
24        }
25		return false;
26	}
27	if ($("#check_out").val() == ""){
28        if (lg=='pt'){
29		    alert("Informe a data final da reserva");
30        }else{
31            alert("Please inform check-out date");
32        }		
33		return false;
34	}
35
36	if ($("#NRooms").val() == ""){
37        if (lg=='pt'){
38		    alert("Informe a quantidade de apartamentos");
39        }else{
40            alert("Please inform the number of rooms");
41        }		
42		return false;
43	}
44
45	var check_in = $("#check_in").val().split('/').join("");
46	var check_out = $("#check_out").val().split('/').join("");
47
48    // Percorre a quantidade de quartos
49    for (var i = 1; i <= $("#NRooms").val(); i++) {
50        // Apresenta mensagem caso o quarto não tenha nenhum adulto ou nenhuma criança
51        if ($('#ad_ap_'+i).val() == 0 && $('#ch_ap_'+i).val() == 0){
52            if (lg=='pt'){
53                alert('O apartamento '+ i + ' está sem a informação da quantidade de hóspedes');
54            }else{
55                alert('Please inform the number of guests for room '+ i );
56            }	
57            
58            return false;
59        }
60        // Captura a quantidade de adultos e crianças
61        adultos = adultos + $('#ad_ap_'+i).val() + '%2C';
62        criancas = criancas + $('#ch_ap_'+i).val() + '%2C';
63
64        // Caso informado qtd de crianças, captura a diade de cada uma delas
65        if ($('#ch_ap_'+i).val() == 0){
66            idades = idades + '%2C';
67        }else{
68            for ( var j = 1; j <= $('#ch_ap_'+i).val(); j++){
69                idades = idades + $('#ap_'+i+'_idade-chd-'+j).val() + '%3B';
70            }
71            idades = idades + '%2C';
72        }
73    };
74    adultos = adultos.slice(0,-3);
75    criancas = criancas.slice(0,-3);
76    idades = idades.slice(0,-3);
77
78    $('.crianca').each(function(){
79        if ($(this).val() == '-') {
80            if (lg=='pt'){
81                alert('Existem crianças sem informação de idade');
82            }else{
83                alert('Please inform the child age');
84            }
85            erro = 1;
86            return false;	
87        }
88    });
89    
90    if ( erro == 1) return false;
91    
92    if (idades != ''){
93        idades = idades.slice(0, -3);
94        idades = idades.replace('%3B%2C', '%2C');
95        idades = '&ag='+idades+'&child_age_input='+idades;
96    }
97
98    urlfinal = url1 + "&NRooms="+$("#NRooms").val() +
99        "&CheckIn="+check_in +
100        "&CheckOut="+check_out+
101        "&ad="+adultos+
102        "&ch="+criancas+
103        idades + url2;
104    //console.log(urlfinal);
105	window.open(urlfinal , "", "");
106	return false;
107}
108
109function VerificaReservaEn(){
110
111    idades = '';
112	if ($("#check_in").val() == ""){
113		alert("Enter the start date of the reservation");
114		return false;
115	}
116	if ($("#check_out").val() == ""){
117		alert("Enter the final reservation date");
118		return false;
119	}
120	if ($("#ad").val() == ""){
121		alert("Enter the number of adults");
122		return false;
123	}
124	if ($("#NRooms").val() == ""){
125		alert("Enter the number of apartments");
126		return false;
127	}
128	var check_in = $("#check_in").val().split('/').join("");
129	var check_out = $("#check_out").val().split('/').join("");
130
131    $('.crianca').each(function(){
132        if ($(this).val() == '-') {
133            alert('Existem crianças')
134        }
135        idades = idades + $(this).val() + '%3B'
136    });
137    
138    if (idades != ''){
139        idades = idades.slice(0, -3);
140        idades = '&ag='+idades+'&child_age_input='+idades;
141    }
142
143    url = url + check_in +
144        "&CheckOut="+check_out+
145        "&ad="+$("#ad").val()+
146        "&ch="+$("#ch").val()+
147        "&NRooms="+$("#NRooms").val() + idades;
148	window.open(url , "", "");
149	return false;
150}
151
152function guardaValor(ap, tipo){
153    if (ap == 0){
154        qtd = $('#NRooms').val();
155    }else{
156        qtd = $('#'+tipo+'_ap_'+ap).val()
157    }
158}
159
160function verificaPessoasAp(ap, tipo){
161
162    if ($('input[name=lingua]').val() == 'en') {
163        txtQtdExcedida = "Number of people exceeded in the apartment ";
164        txtApExcedida = "We only allow 3 people per room";
165    }else{
166        txtQtdExcedida = "Quantidade de pessoa excedida no apartamento ";
167        txtApExcedida = "Só permitimos 3 pessoas por quarto";
168    }
169
170    if ($('#ad_ap_'+ap).val() == '') $('#ad_ap_'+ap).val('0');
171    if ($('#ch_ap_'+ap).val() == '') $('#ch_ap_'+ap).val('0');
172
173    if (parseInt($('#ad_ap_'+ap).val()) + parseInt($('#ch_ap_'+ap).val()) > 3){
174        alert(txtQtdExcedida + ap + " \n" + txtApExcedida);
175        $('#'+tipo+'_ap_'+ap).val(qtd);
176        return false;
177    }
178    return true;
179
180}
181
182function verificaApartamentos(){
183  
184    if ($('input[name=lingua]').val() == 'en') {
185        txtCriancas = "Children";
186        txtApartamento = "Room ";
187        txtAdultos = "Adults";
188        txtQtdExcedida = "We only allow the booking of up to 5 apartments";
189    }else{
190        txtCriancas = "Crianças ";
191        txtApartamento = "Apartamento ";
192        txtAdultos = "Adultos";
193        txtQtdExcedida = "Só permitimos a reserva de até 5 apartamentos";
194    }
195
196    feito = false;
197    i = 1;
198    qtdApartamentos = $('#NRooms').val();
199
200    if (qtdApartamentos < 1) {
201        $('#detalhes').html('');
202    }else if (qtdApartamentos > 5) {
203        alert(txtQtdExcedida);
204        $('#NRooms').val(qtd);  
205    }  
206
207    $('.linhaAP').addClass('remove');
208
209    while ( feito == false){
210
211        // Adiciona
212        if (( i <= qtdApartamentos ) && ( $('#row_ap_' +  i).length == 0)) {
213
214            $('#detalhes').append('<div class="group_4 linhaAP" id="row_ap_' + i + '">'+
215                '   <div class="container_title"><h4>' + txtApartamento +  i + ':</h4></div>'+
216                '   <div class="container_3">'+
217                '      <label>'+txtAdultos+'</label>'+
218                '       <div class="qty-buttons">'+
219                '           <input type="button" value="1" class="qtyminus" name="ad_ap_' + i + '" data-apartamento="' + i + '">'+
220                '           <input type="text" min="0"  max="4" name="ad_ap_' + i + '" id="ad_ap_' + i + '" data-apartamento="' + i + '" value="0" class="qty form-control" placeholder="0" onkeydown="guardaValor('+i+',\'ad\')" onkeyup="verificaPessoasAp('+i+',\'ad\')">'+
221                '           <input type="button" value="1" class="qtyplus" name="ad_ap_' + i + '" data-apartamento="' + i + '">'+
222                '       </div>'+
223                '   </div>'+
224                '   <div class="container_4">'+
225                '       <label>'+txtCriancas+'</label>'+
226                '       <div class="qty-buttons">'+
227                '           <input type="button" value="1" class="qtyminus" name="ch_ap_' + i + '" data-apartamento="' + i + '">'+
228                '           <input type="text" min="0" max="4" name="ch_ap_' + i + '" id="ch_ap_' + i + '" data-apartamento="' + i + '" value="0" class="qty form-control" placeholder="0" onkeydown="guardaValor(' + i + ',\'ch\')" onkeyup="verificaCriancas('+i+')">'+
229                '           <input type="button" value="1" class="qtyplus" name="ch_ap_' + i + '" data-apartamento="' + i + '">'+
230                '       </div>'+
231                '   </div>'+
232                '   <span id="col_ch_ap_' + i + '"></span>'+
233                '</div>');
234
235        }else{
236            $('#row_ap_' +  i).removeClass('remove')    
237        }
238        
239        if (i >= qtdApartamentos ){
240            $('.remove').remove();
241            feito = true;
242        }
243        i++; 
244    }
245    ajustabotoes();
246
247}
248
249function verificaCriancas(ap){
250
251    if ($('input[name=lingua]').val() == 'en') {
252        txtIdadeCrianca = "Child age ";
253        txtIdade = "Age";
254        txtAnos = "Years old";
255    }else{
256        txtIdadeCrianca = "Idade criança ";
257        txtIdade = "Idade";
258        txtAnos = "Anos";
259    }
260    
261    if (verificaPessoasAp(ap, 'ch') == false) return false;
262
263    feito = false;
264    i = 1;
265    qtdCriancas = $('#ch_ap_' + ap).val();
266    
267
268    $('.ap_'+ap).addClass('remove');
269
270    while ( feito == false){
271
272        // Adiciona
273        if (( i <= qtdCriancas ) && ( $('#ap_'+ap+'_idadecrianca_' +  i).length == 0)) {
274
275            $('#col_ch_ap_'+ap).append('<div class="container_4 ap_'+ap+'" id="ap_'+ap+'_idadecrianca_'+ i + '">'+
276							'<label>' + txtIdadeCrianca + i + 
277                            '</label>' +
278                            '<span class="input-icon-seta"><i class="icon-down-open"></i></span>' +
279                            '<select class="form-control crianca" name="ap_'+ap+'_idade-chd-' + i + '" id="ap_'+ap+'_idade-chd-' + i + '">'+
280                                '<option value="-">'+ txtIdade +'</option>'+
281                                '<option value="0">0 ' + txtAnos + '</option>'+
282                                '<option value="1">1 ' + txtAnos + '</option>'+
283                                '<option value="2">2 ' + txtAnos + '</option>'+
284                                '<option value="3">3 ' + txtAnos + '</option>'+
285                                '<option value="4">4 ' + txtAnos + '</option>'+
286                                '<option value="5">5 ' + txtAnos + '</option>'+
287                                '<option value="6">6 ' + txtAnos + '</option>'+
288                                '<option value="7">7 ' + txtAnos + '</option>'+
289                                '<option value="8">8 ' + txtAnos + '</option>'+
290                                '<option value="9">9 ' + txtAnos + '</option>'+
291                                '<option value="10">10 ' + txtAnos + '</option>'+
292                                '<option value="11">11 ' + txtAnos + '</option>'+
293                                '<option value="12">12 ' + txtAnos + '</option>'+
294                                '<option value="13">13 ' + txtAnos + '</option>'+
295                                '<option value="14">14 ' + txtAnos + '</option>'+
296                                '<option value="15">15 ' + txtAnos + '</option>'+
297                                '<option value="16">16 ' + txtAnos + '</option>'+
298                                '<option value="17">17 ' + txtAnos + '</option>'+
299                            '</select>'+
300						'</div>'
301            );
302
303        }else{
304            $('#ap_'+ap+'_idadecrianca_' +  i).removeClass('remove')    
305        }
306        
307        if (i >= qtdCriancas ){
308            $('.remove').remove();
309            feito = true;
310        }
311        i++; 
312    }
313}
314
315/* ==============================================
316Preload
317=============================================== */
318$(window).load(function() { // makes sure the whole site is loaded
319'use strict';
320    $('[data-loader="circle-side"]').fadeOut(); // will first fade out the loading animation
321    $('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website.
322    $('body').delay(350).css({'overflow':'visible'});
323    $(window).scroll();
324});
325
326/* ==============================================
327Sticky nav
328=============================================== */
329$(window).scroll(function(){
330'use strict';
331    if($(this).scrollTop() > 1){
332        $('header').addClass("sticky");
333    }
334    else{
335        $('header').removeClass("sticky");
336    }
337});
338
339/* ==============================================
340Menu
341=============================================== */
342$('a.open_close').on("click",function() {
343	'use strict';
344	$('.main-menu').toggleClass('show');
345	$('.layer').toggleClass('layer-is-visible');
346});
347$('a.show-submenu').on("click",function() {
348	'use strict';
349	$(this).next().toggleClass("show_normal");
350});
351$('a.show-submenu-mega').on("click",function() {
352	'use strict';
353	$(this).next().toggleClass("show_mega");
354});
355if($(window).width() <= 480){
356	$('a.open_close').on("click",function() {
357	'use strict';
358	$('.cmn-toggle-switch').removeClass('active');
359});
360}
361
362/* ==============================================
363Common
364=============================================== */
365/* Tooltip*/
366$('.tooltip-1').tooltip({html:true});
367
368/* Accordion*/
369function toggleChevron(e) {
370	'use strict';
371    $(e.target)
372        .prev('.panel-heading')
373        .find("i.indicator")
374        .toggleClass('icon_set_1_icon-11 icon_set_1_icon-10');
375}
376$('.panel-group').on('hidden.bs.collapse shown.bs.collapse', toggleChevron);
377
378
379function ajustabotoes(){
380
381    $('.qtyplus').off("click");
382    /* Quantity input*/
383    // This button will increment the value
384    $('.qtyplus').on("click",function(e) {
385        // Stop acting like a button
386        e.preventDefault();
387        // Get the field name
388        fieldName = $(this).attr('name');
389        // Get its current value
390        //var currentVal = parseInt($('input[name='+fieldName+']').val(),10);
391        var currentVal = parseInt($('#'+fieldName).val(),10);
392        
393        ap = $('#'+fieldName).attr('data-apartamento');
394        tipo = fieldName.slice(0,2);
395        guardaValor(ap, tipo);
396        
397        // If is not undefined
398        if (!isNaN(currentVal)) {
399            // Increment
400           // $('input[name='+fieldName+']').val(currentVal + 1);
401           $('#'+fieldName).val(currentVal + 1);
402        } else {
403            // Otherwise put a 0 there
404            //$('input[name='+fieldName+']').val(1);
405            $('#'+fieldName).val(1);    
406        }
407               
408        if (tipo == 'ch') {
409            verificaCriancas(ap )
410            //verificaPessoasAp(ap, 'ch');
411        }else if (tipo == 'ad') {
412            verificaPessoasAp(ap, 'ad');
413        }else if (fieldName == 'NRooms') {
414            verificaApartamentos()
415            verificaPessoasAp(ap, 'ad');
416        }
417
418    });
419    $('.qtyminus').off("click");
420    // This button will decrement the value till 0
421    $(".qtyminus").on("click",function(e) {
422        // Stop acting like a button
423        e.preventDefault();
424        // Get the field name
425        fieldName = $(this).attr('name');
426        // Get its current value
427        //var currentVal = parseInt($('input[name='+fieldName+']').val(),10);
428        var currentVal = parseInt($('#'+fieldName).val(),10);
429
430        ap = $('#'+fieldName).attr('data-apartamento');
431        tipo = fieldName.slice(0,2);
432        guardaValor(ap, tipo);
433
434        // If it isn't undefined or its greater than 0
435        if (!isNaN(currentVal) && currentVal > 0) {
436            // Decrement one
437            //$('input[name='+fieldName+']').val(currentVal - 1);
438            $('#'+fieldName).val(currentVal - 1);
439        } else {
440            // Otherwise put a 0 there
441            //$('input[name='+fieldName+']').val(0);
442            $('#'+fieldName).val(0);
443        }
444
445        if (tipo == 'ch') {
446            verificaCriancas(ap )
447            verificaPessoasAp(ap, 'ch');
448        }else if (tipo == 'ad') {
449            verificaPessoasAp(ap, 'ad');
450        }else if (fieldName == 'NRooms') {
451            verificaApartamentos()
452            //verificaPessoasAp(ap, 'ad');
453        }
454    });
455    
456
457}
458
459
460
461/* Animation on scroll */
462new WOW().init();
463
464/* ==============================================
465Video modal dialog + Parallax + Scroll to top + Incrementer
466=============================================== */
467$(function () {
468'use strict';
469
470
471    $('.video').magnificPopup({type:'iframe'});	/* video modal*/
472    $('.parallax-window').parallax({}); /* Parallax modal*/
473
474    // Image popups
475    $('.magnific-gallery').each(function() {
476        'use strict';
477        $(this).magnificPopup({
478            delegate: 'a',
479            type: 'image',
480            gallery:{enabled:true}
481        });
482    });
483
484    /* Hamburger icon*/
485    var toggles = document.querySelectorAll(".cmn-toggle-switch");
486    for (var i = toggles.length - 1; i >= 0; i--) {
487        var toggle = toggles[i];
488        toggleHandler(toggle);
489    };
490
491    function toggleHandler(toggle) {
492        toggle.addEventListener( "click", function(e) {
493            e.preventDefault();
494            (this.classList.contains("active") === true) ? this.classList.remove("active") : this.classList.add("active");
495        });
496    };
497
498    /* Scroll to top*/
499    $(window).scroll(function() {
500		if($(this).scrollTop() != 0) {
501			$('#toTop').fadeIn();
502		} else {
503			$('#toTop').fadeOut();
504		}
505	});
506
507	$('#toTop').on("click",function() {
508		$('body,html').animate({scrollTop:0},500);
509	});
510
511});
512
513ajustabotoes(); 
514
515
516/* Cat nav onclick active */
517$('ul#cat_nav li a').on('click', function(){
518	'use strict';
519    $('ul#cat_nav li a.active').removeClass('active');
520    $(this).addClass('active');
521});
522
523/* ==============================================
524Carousel
525=============================================== */
526  $('.carousel_testimonials').owlCarousel({
527    items:1,
528    loop:true,
529	 autoplay:false,
530    animateIn: 'flipInX',
531	 margin:30,
532    stagePadding:30,
533    smartSpeed:450,
534	responsiveClass:true,
535    responsive:{
536        600:{
537            items:1
538        },
539		 1000:{
540            items:1,
541			nav:false
542        }
543    }
544});
545

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.