var componentVerifyCycle = 0;
var bottom_of_window = jQuery(window).scrollTop() + jQuery(window).height();
var lingua_corrente = cmsPageParams['lang'] ;
/*var bLazy = new Blazy({
offset: 100,
selector: 'img' // all images
});
*/
var bLazy;
bLazy = new Blazy({
offset: 5000,
loadInvisible: false,
selector: '.b-lazy', // all images
breakpoints: [{
width: 767 // max-width
, src: 'data-src-small'
}, {
width: 2000 // max-width
, src: 'data-src'
}]
});
var siteApp = {
params : {
homepage:{
images:[],
images_mobile:[]
},
},
init : function(){
if(siteApp.allComponentIsLoaded()){
siteApp.startApplication();
}else{
componentVerifyCycle++;
if(componentVerifyCycle<200){
setTimeout(function(){siteApp.init();}, 100);
}else{
console.warn('Init Application Error! waiting for: '+siteApp.params.tmp);
return false;
}
}
},
allComponentIsLoaded: function() {
var loaded = true;
var msg = '';
if (typeof jQuery == 'undefined'){loaded = false; msg += '-jQuery';}
if (typeof hs == 'undefined') {loaded = false; msg += '-hs';}
if (typeof jQuery().slick == 'undefined') {loaded = false; msg += '-slick';}
if (typeof jQuery().imageLightbox == 'undefined') {loaded = false; msg += '-imagelightbox';}
if (typeof cms == 'undefined') {loaded = false; msg += 'cms';}
if (typeof jQuery().datepicker == 'undefined') {loaded = false; msg += 'datepicker';}
if(!loaded){
//console.info('waiting for: '+msg);
siteApp.params.tmp = msg;
return false;
}else{
return true;
}
},
startApplication: function() {
siteApp.openMenuMobile();
siteApp.openLanguage();
siteApp.openSubMenu();
siteApp.scrollAnimation();
siteApp.fadeInHeader(jQuery('.barra-desktop'));
siteApp.accordionTab();
siteApp.loadGoogleFont("https://fonts.googleapis.com/css?family=Bowlby+One+SC|Coiny|Poppins:400,600,700");
jQuery(".comments_clear").remove();
/*jQuery('.fumetto-box').wrapInner( "
" );*/
jQuery('.testo.table-box').wrapInner( "" );
//jQuery('#button_email_min').val('');
//aggiungo una freccia a qualunque voce abbia un sottomenu
jQuery(".level1 > li:has('.level2')").addClass('submenu');
jQuery("li.submenu > a").removeAttr("href")
//calendari booking
//codice per installare le libreri del calendario
var forms = document.querySelectorAll('form.form-booking');
for(var i=0;i 767) {
setTimeout(function() {siteApp.hresize('.box-servizi-add');}, 2000);
setTimeout(function() {siteApp.hresize('.tit-blocco-3');}, 2000);
setTimeout(function() {siteApp.hresize('.blocco-3-top');}, 2000);
setTimeout(function() {siteApp.hresize('.item-sostenibilita');}, 2000);
/*siteApp.hresize('.txt-slider-cont');*/
}
if (window.innerWidth > 991) {
setTimeout(function() {siteApp.hresize('.txt-slider-animazione');}, 2000);
}
if (cmsPageParams.type == 3) { //controllo di essere solo in homepage
var height_img_top = jQuery('.slider-dx-top img').height();
jQuery('#blk_70701, .slide-sx-top, .slider-dx-top').css('height', height_img_top).css('overflow', 'hidden');
if (window.innerWidth < 768) {
jQuery('.item-slider-mobi.slick-slide').css('height', height_img_top);
}
if (window.innerWidth > 767) {
jQuery('.slider-sx-top').slick({
dots: false,
//vertical: true,
slidesToShow: 1,
slidesToScroll: 1,
fade:true,
cssEase:'linear',
//verticalSwiping: true,
infinite:true,
autoplay:true,
arrows:false,
autoplaySpeed:4000,
speed:1200,
pauseOnHover:false
});
jQuery('.slider-sx-top').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
jQuery('.slider-dx-top').slick({
dots: false,
//vertical: true,
slidesToShow: 1,
slidesToScroll: 1,
//verticalSwiping: true,
infinite:true,
autoplay:true,
fade:true,
cssEase:'linear',
//rtl:false,
arrows:false,
autoplaySpeed:4800,
speed:1200,
pauseOnHover:false
});
jQuery('.slider-dx-top').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
jQuery('.slider-sx-top').on('afterChange', function(event, slick, currentSlide, nextSlide){
bLazy.revalidate();
});
jQuery('.slider-dx-top').on('afterChange', function(event, slick, currentSlide, nextSlide){
bLazy.revalidate();
});
var height_img_top = jQuery('.slider-dx-top img').height();
jQuery('.item-slider-top.slick-slide, .slider-sx-top, .slider-dx-top').css('height', height_img_top);
if (window.innerWidth < 768) {
jQuery('.item-slider-mobi.slick-slide').css('height', height_img_top);
}
} else {
jQuery('.slider-mobi-top').slick({
dots: false,
slidesToShow: 1,
slidesToScroll: 1,
infinite:true,
autoplay:true,
arrows:false,
fade:true,
cssEase:'linear',
autoplaySpeed:3500,
pauseOnHover:false,
slide: '.item-slider-mobi'
});
jQuery('.slider-mobi-top').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
if (window.innerWidth < 768) {
jQuery('#blk_73686').addClass('slider-home');
jQuery('.slider-home').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 1,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
slide:'.item-slider-home'
});
jQuery('.slider-home').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
if (window.innerWidth < 992) {
jQuery('#blk_73694').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 2,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
slide:'.blocco-commento',
responsive: [{
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('#blk_73694').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
jQuery('.slider-servizi-home').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 5,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
slide:'.item-servizi-home',
responsive: [{
breakpoint: 992,
settings: {
slidesToShow: 3
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.slider-servizi-home').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
jQuery('.slider-evidenza').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 1,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
pauseOnHover:false,
slide:'.item-evidenza'
});
jQuery('.slider-evidenza').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
jQuery('.slider-territorio').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 2,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
//slide:'.item-servizi-home',
responsive: [{
breakpoint: 1200,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.slider-territorio').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
// apertura sottomenu mobile //
siteApp.openSecondLevel();
/* verifico lingua della pagina */
var lang_page = cmsPageParams.lang
/* ************************ */
switch(lang_page) {
case "it":
break;
default:
}
/* switch per pagine */
switch(cmsPageParams.relation_code) {
case "1559220945":
case "1559304535":
case "1559308087":
case "1559292254":
case "1559298226":
case "1609255940":
var galleries = [
'.foto-1 a.image_lightbox',
'.foto-2 a.image_lightbox',
'.foto-3 a.image_lightbox',
'.foto-4 a.image_lightbox',
'.foto-5 a.image_lightbox',
'.foto-6 a.image_lightbox',
'.foto-7 a.image_lightbox',
'.foto-8 a.image_lightbox'];
var instance=[];
jQuery.each(galleries, function(i) {
var selector = galleries[i];
instance[i]=jQuery(selector).imageLightbox ({
onStart: function(){ overlayOn(); arrowsOn( instance[i], selector ); closeButtonOn( instance[i] ); },
onEnd: function(){ overlayOff(); closeButtonOff(); arrowsOff(); activityIndicatorOff(); },
onLoadStart: function(){ activityIndicatorOn(); },
onLoadEnd: function(){ jQuery( '.imagelightbox-arrow' ).css( 'display', 'block' ); activityIndicatorOff(); }
});
});
break;
default:
startImageLightBox();
}
setTimeout(function() {
siteApp.hresize('.box-esperienze h3');
}, 2000);
switch(cmsPageParams.relation_code) {
case "1573054793":
if(window.innerWidth > 767){
siteApp.hresize('.txt-slider-cont');
}
break;
case "1552483026":
if(window.innerWidth > 767){
siteApp.hresize('.blk-struttura .txt');
}
break;
//dettaglio news
case "1559045462":
console.log("dettaglio news");
if(jQuery("#no_veditutte").length){
console.log("no_veditutte= ",jQuery("#no_veditutte").length);
jQuery("#pulsante_vedi_tutte").hide();
}
break;
//crockyworld
case "1608113323":
jQuery(".slider-gallery-crocky > div").slick(
{
dots: false,
infinite: true,
speed: 600,
slidesToShow: 5,
slidesToScroll: 1,
arrows: false,
autoplay: true,
accessibility: false,
autoplaySpeed: 6000,
slide:'.imagegroup_item',
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 3,
}
},
{
breakpoint: 992,
settings: {
slidesToShow: 2,
}
},
{
breakpoint: 768,
settings: {
slidesToShow: 1,
}
}
]
});
jQuery('.next-crocky').click(function(){
jQuery('.slider-gallery-crocky > div').slick('slickNext');
})
jQuery('.prev-crocky').click(function(){
jQuery('.slider-gallery-crocky > div').slick('slickPrev');
})
break;
case "1559311726":
jQuery('.slider-villaggio.uno, .slider-villaggio.due, .slider-villaggio.tre, .slider-villaggio.quattro').slick({
arrows:false,
dots: false,
speed: 600,
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
slide:'.item-villaggio',
responsive: [{
breakpoint: 1199,
settings: {
slidesToShow: 2
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.next-uno').click(function(){
jQuery('.slider-villaggio.uno').slick('slickNext');
})
jQuery('.prev-uno').click(function(){
jQuery('.slider-villaggio.uno').slick('slickPrev');
})
if (window.innerWidth > 1199) {
if (jQuery('.slider-villaggio.uno .slick-slide').length <= 3 ) {
jQuery('.frecce .next-uno, .frecce .prev-uno').hide();
}
}
jQuery('.next-due').click(function(){
jQuery('.slider-villaggio.due').slick('slickNext');
})
jQuery('.prev-due').click(function(){
jQuery('.slider-villaggio.due').slick('slickPrev');
})
if (window.innerWidth > 1199) {
if (jQuery('.slider-villaggio.due .slick-slide').length <= 3) {
jQuery('.frecce .next-due, .frecce .prev-due').hide();
}
}
jQuery('.next-tre').click(function(){
jQuery('.slider-villaggio.tre').slick('slickNext');
})
jQuery('.prev-tre').click(function(){
jQuery('.slider-villaggio.tre').slick('slickPrev');
})
if (window.innerWidth > 1199) {
if (jQuery('.slider-villaggio.tre .slick-slide').length <= 3){
jQuery('.frecce .next-tre, .frecce .prev-tre').hide();
}
}
jQuery('.next-quattro').click(function(){
jQuery('.slider-villaggio.quattro').slick('slickNext');
})
jQuery('.prev-quattro').click(function(){
jQuery('.slider-villaggio.quattro').slick('slickPrev');
})
if (window.innerWidth > 1199) {
if (jQuery('.slider-villaggio.quattro .slick-slide').length <= 3) {
jQuery('.frecce .next-quattro, .frecce .prev-quattro').hide();
}
}
jQuery('.slider-villaggio.uno, .slider-villaggio.due, .slider-villaggio.tre, .slider-villaggio.quattro').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
break;
case '1559119416':
jQuery('.slider-access').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 4,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
slide:'.item-access',
responsive: [{
breakpoint: 1199,
settings: {
slidesToShow: 3
}
}, {
breakpoint: 992,
settings: {
slidesToShow: 2
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.slider-access').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
break;
case '1559135998':
if(window.innerWidth > 767){
siteApp.hresize('.height-pacchetti');
}
break;
case '1594307388':
if(window.innerWidth > 991){
siteApp.hresize('.box-esperienze .text-wrapper');
}
break;
default:
break;
}
if (jQuery('.eventi-scorrevoli')[0]) {
jQuery('.eventi-scorrevoli').slick({
arrows:false,
dots: false,
speed: 600,
slidesToShow: 1,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true
})
jQuery('.next-eventi').click(function(){
jQuery('.eventi-scorrevoli').slick('slickNext');
})
jQuery('.prev-eventi').click(function(){
jQuery('.eventi-scorrevoli').slick('slickPrev');
})
if (window.innerWidth > 991) {
if (jQuery('.eventi-scorrevoli .slick-slide').length <= 2) {
jQuery('.arrows-eventi .next-eventi, .arrows-eventi .prev-eventi').hide();
}
}
jQuery('.eventi-scorrevoli').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
if (jQuery('.slider-dw')[0]) {
jQuery('.slider-dw').slick({
arrows:false,
dots: false,
speed: 600,
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
slide:'.item-slider-dw',
responsive: [{
breakpoint: 992,
settings: {
slidesToShow: 2,
centerMode: true,
variableWidth: true
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1,
centerMode: true,
variableWidth: true
}
}]
});
jQuery('.slider-dw').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
if (jQuery('.slider-dw-frecce')[0]) {
jQuery('.slider-dw-frecce').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
slide:'.item-slider-dw',
responsive: [{
breakpoint: 992,
settings: {
slidesToShow: 2
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.slider-dw-frecce').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
if (jQuery('.slider-strutture')[0]) {
jQuery('.slider-strutture').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 1,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:false,
slide:'a'
});
jQuery('.slider-strutture').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
/* slider offerte */
if (jQuery('.offerte-scorrevoli')[0]) {
jQuery('.offerte-scorrevoli').slick({
arrows:false,
dots: false,
speed: 600,
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
responsive: [{
breakpoint: 992,
settings: {
slidesToShow: 2,
arrows:false
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.next').click(function(){
jQuery('.offerte-scorrevoli-new').slick('slickNext');
})
jQuery('.prev').click(function(){
jQuery('.offerte-scorrevoli-new').slick('slickPrev');
})
if (window.innerWidth > 991) {
if (jQuery('.offerte-scorrevoli-new .slick-slide').length <= 2) {
jQuery('.arrows .next, .arrows .prev').hide();
}
}
jQuery('.offerte-scorrevoli-new').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
/* slider offerte */
if (jQuery('.offerte-scorrevoli-new')[0]) {
jQuery('.offerte-scorrevoli-new > div').slick({
arrows:false,
dots: false,
speed: 600,
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
responsive: [{
breakpoint: 992,
settings: {
slidesToShow: 2,
arrows:false
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.next').click(function(){
jQuery('.offerte-scorrevoli-new > div').slick('slickNext');
})
jQuery('.prev').click(function(){
jQuery('.offerte-scorrevoli-new > div').slick('slickPrev');
})
if (window.innerWidth > 991) {
if (jQuery('.offerte-scorrevoli-new > div .slick-slide').length <= 2) {
jQuery('.arrows .next, .arrows .prev').hide();
}
}
jQuery('.offerte-scorrevoli-new > div').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
/*********************************/
/* slider dw */
if (jQuery('.slider-loghi')[0]) {
jQuery('.slider-loghi').slick({
arrows:true,
dots: false,
speed: 600,
slidesToShow: 5,
autoplay: true,
autoplaySpeed: 6000,
accessibility:false,
infinite:true,
slide:'a',
responsive: [{
breakpoint: 1300,
settings: {
slidesToShow: 4,
}
}, {
breakpoint: 992,
settings: {
slidesToShow: 3,
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1,
centerMode: true
}
}]
});
jQuery('.slider-loghi').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
/*********************************/
if (jQuery('.slider-commenti')[0]) {
jQuery('.slider-commenti').slick({
dots:false,
infinite: true,
speed: 900,
arrows: false,
slidesToShow: 2,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 5000,
accessibility:false,
slide:'.slide-commenti',
responsive: [{
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.arrows-commenti .next').click(function(){
jQuery('.slider-commenti').slick('slickNext');
})
jQuery('.arrows-commenti .prev').click(function(){
jQuery('.slider-commenti').slick('slickPrev');
})
if(window.innerWidth > 991){
if(jQuery('.slider-commenti .slick-slide').length <= 1){
jQuery('.arrows-commenti').hide();
}
}
jQuery('.slider-commenti').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
// slider foto //
if (jQuery('.slider-img')[0]) {
jQuery('.slider-img').slick({
arrows:false,
dots: false,
speed: 600,
slidesToShow: 3,
autoplay: true,
slide:'a',
autoplaySpeed: 2000,
infinite:false,
responsive: [{
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
jQuery('.arrows-img .next').click(function(){
jQuery('.slider-img').slick('slickNext');
});
jQuery('.arrows-img .prev').click(function(){
jQuery('.slider-img').slick('slickPrev');
});
if (window.innerWidth > 991) {
if (jQuery('.slider-img .slick-slide').length <= 1) {
jQuery('.arrows-img').hide();
}
}
/* tolgo freccia a sx per prima img */
if (jQuery('.slider-img .slick-active').attr('data-slick-index') == '0') {
jQuery('.slider-img').find('.slick-prev').addClass('freccia-none');
} else {
jQuery('.slider-img').find('.slick-next').removeClass('freccia-none');
}
jQuery('.slider-img').on('afterChange', function(event, slick, currentSlide, nextSlide){
/* tolgo freccia a dx per ultima img */
if (jQuery(this).find('.slick-slide:last-child').hasClass('slick-active')) {
//console.log('passo')
jQuery(this).find('.slick-next').addClass('freccia-none');
} else {
jQuery(this).find('.slick-next').removeClass('freccia-none');
}
/* tolgo freccia a sx per prima img dopo scorrimento iniziato */
if (jQuery(this).find('.slick-active').attr('data-slick-index') == '0') {
jQuery(this).find('.slick-prev').addClass('freccia-none');
} else {
jQuery(this).find('.slick-prev').removeClass('freccia-none');
}
});
jQuery('.slider-img').on('afterChange', function(event, slick, currentSlide, nextSlide) {
bLazy.revalidate();
});
}
if (jQuery('.slider-img-singola')[0]) {
jQuery('.slider-img-singola').slick({
arrows:false,
dots: true,
speed: 600,
slidesToShow: 1,
autoplay: true,
autoplaySpeed: 2000,
pauseOnHover:false,
infinite:true,
});
}
var pathname = window.location.href;
var pathname = pathname.split('?id=');
var parametro = pathname[1];
if (parametro) {
if (window.innerWidth < 991) {
setTimeout(function() {
goToByScroll(parametro, 50);
},500);
} else {
setTimeout(function() {
goToByScroll(parametro, 120);
},500);
}
}
//gestione tab regolamenti
var pathname_reg = window.location.href;
var pathname_reg = pathname_reg.split('?reg=');
var parametro_reg = pathname_reg[1];
//console.log("parametro_reg = "+parametro_reg);
if(cmsPageParams.relation_code == 1559055969){
if(parametro_reg){
switch(parametro_reg) {
case "pet":
//console.log("attivo la seconda tab");
jQuery('#tabs_472467').responsiveTabs('activate', 2); // tab 0,1,2,3..
break;
default:
}
}
if (window.innerWidth <= 767) {
jQuery('#tabs_472467').responsiveTabs('deactivate', 0); // This would close the first tab
}
}
/* gestione tab prodotti */
jQuery('.cont-tabs input').click(function(){
jQuery('.tab-content').hide();
var element = jQuery(this).attr('id');
jQuery(this).parent('.cont-tabs').siblings(jQuery('.'+ element +'').show());
});
jQuery(window).on('scroll', function() {
siteApp.viewCheck();
siteApp.scrollAnimation();
siteApp.countAnimation();
siteApp.scrollVideoYoutube();
});
jQuery('.image-container').each(function(){
var h_image = jQuery(this).find('img.foto').height();
jQuery(this).height(h_image);
});
jQuery(window).on('resize', function(){
if (window.innerWidth > 991) {
jQuery('.image-container').each(function(){
var h_image = jQuery(this).find('img.foto').height();
jQuery(this).height(h_image);
});
}
var height_img_top = jQuery('.slider-dx-top img').height();
jQuery('.item-slider-top.slick-slide').css('height', height_img_top);
if (window.innerWidth < 768) {
jQuery('.item-slider-mobi.slick-slide').css('height', height_img_top);
}
});
/* link hover home sezioni */
if (window.innerWidth > 991) {
jQuery('.link-hover').hover(
function() {
var idLink= jQuery(this).attr('id');
jQuery('.link-hover').removeClass('active');
jQuery(this).addClass('active');
jQuery('.link-hover-img ').removeClass('active');
jQuery('.'+idLink).addClass('active');
}, function() {
var idLink= jQuery(this).attr('id');
if (!jQuery('.'+idLink).hasClass('active')) {
return;
}
}
);
}
jQuery('.icone-popup .item > img').click(function() {
jQuery(".popup").removeClass('open-popup');
jQuery(this).parent().children('.popup').toggleClass('open-popup');
});
jQuery('.icone-popup .item .close-popup').click(function(){
//console.log(".icone-popup .item .close-popup");
jQuery(this).parent().removeClass('open-popup');
});
/***********************************/
//chiamo la funzione per rendere invisibili tutti i cambi di età dei bambini (quelli con classe .cnt-bambini)
//E mi restituisce il numero dei campi età dei bambini
var max_bambini = nascondo_bambini_form();
//console.log( "max_bambini = "+max_bambini );
//evento di quando cambio valore alla select del numero dei bambini
jQuery("select[name='numero_bambini']").on('change', function() {
//recupero il valore della select
var bambini_sel = this.value;
//se maggiore di zero vado ad attivare i campi altrimenti li nascondo tutti
if(bambini_sel > 0){
//ciclo per il numero totale dei campi età dei bambini
for (var i = 1; i <= max_bambini; ++ i){
var elem = jQuery(".cnt-bambini.bambino_"+i);
//se il campo i deve essere attivo controllo se già lo è.. altrimenti lo rendo visibile
if (i<=bambini_sel){
if(elem.is(':visible')){
//console.log("elem i= "+i+" visibile");
}else{
//console.log("elem i= "+i+" non visibile allora lo rendo visibile");
elem.fadeIn();
}
}else{
//se il campo i non deve essere attivo lo nascondo
elem.fadeOut();
console.log("vuoto la select "+i);
elem.find("select").val("");
}
}
} else {
nascondo_bambini_form();
}
});
bLazy = new Blazy({
offset: 5000,
loadInvisible: false,
selector: '.b-lazy', // all images
breakpoints: [{
width: 767, // max-width
src: 'data-src-small'
}, {
width: 2000, // max-width
src: 'data-src'
}]
});
siteApp.linkUtmAnchorElement();
var path_newsletter = window.location.href;
path_newsletter = path_newsletter.split('?');
if(path_newsletter[1]=="newsletter") {
setTimeout(function() {
goToByScroll('#contenuto_460082');
}, 2000);
};
if(path_newsletter[1]=="experience") {
setTimeout(function() {
goToByScroll('#blk_73686');
}, 2000);
};
jQuery('.slick-dots ').each(function(){
if(jQuery(this).children('li').length <= 1){
jQuery(this).hide();
};
});
},
downloadLibs: function(libs, successCallback) {
var cb = successCallback || function() {};
var scripts = libs || [];
var loadScripts = function(scripts) {
return scripts.reduce(function(currentPromise, scriptUrl) {
return currentPromise.then(function() {
return new Promise(function(resolve, reject) {
var script = document.createElement('script');
script.async = true;
script.src = scriptUrl;
script.onload = function() { resolve(); };
document.getElementsByTagName('head')[0].appendChild(script);
});
});
}, Promise.resolve());
}
loadScripts(scripts).then(function() { cb(); });
},
settaInfoStruttura: function(txt) {
var txtSel = dictionaryTranslate('[DIZIONARIO:'+txt+']', lingua_corrente);
var txtRichiedo = dictionaryTranslate('[DIZIONARIO:txt_richiedo]', lingua_corrente);
console.log(txtRichiedo + txtSel);
jQuery('#ContContatti2 textarea[name="richieste_particolari"]').val(txtRichiedo + ' ' + txtSel);
goToByScroll('#ContContatti2');
/*if (listaImm !='')
{
listaImm += '';
}
if (listaImm !='')
{
jQuery('#noSelezione').hide();
jQuery('#riepilogoSelezionati').html('Immobili selezionati:
'+listaImm);
}
else
{
jQuery('#noSelezione').fadeIn();
jQuery('#riepilogoSelezionati').html('');
}*/
},
linkUtmAnchorElement: function(){
//console.log("linkUtmAnchorElement");
var pathnameN = window.location.href;
var pathnameN = pathnameN.split('&anchorUtm=');
var parametroN = pathnameN[1];
//console.log(parametroN);
if(parametroN){
setTimeout(function() {
goToByScroll("#"+parametroN);
},1000);
}
},
// Create the element
openMenuMobile: function(){
/* variabili menu */
var $id_menu = '#menu_3099';
var $menu = jQuery($id_menu);
var $btn = jQuery('.op_block');
/**************************/
jQuery($btn).click(function() {
jQuery('.vedi-menu').toggleClass('slide-menu');
//if(window.innerWidth > 991){
// jQuery('.menu-fix').fadeToggle();
//}
$btn.find('.click').toggleClass('open');
$btn.toggleClass('open');
if(jQuery($id_menu+' .level2').hasClass('slide-menu')){
jQuery($id_menu+' .level2').removeClass('slide-menu')
}
});
//if (window.innerWidth < 991) {
/* jquery per chiudere la tendina del menu al click esterno alla tendina */
jQuery(document).bind("click touchstart", function(event) {
if(jQuery(event.target).parents('.op_block').size()
|(jQuery(event.target).hasClass('open'))
|(jQuery(event.target).parents('ul#root_3099 li').size())
|jQuery(event.target).is('.tendina-lingue')|jQuery(event.target).parents(".blocco-lingue").size()){
return;
}
// if(window.innerWidth > 991){
// jQuery('.menu-fix').fadeOut();
//}
jQuery(".op_block").removeClass('open');
$btn.find('.click').removeClass('open');
if(jQuery('.vedi-menu').hasClass('slide-menu')){
jQuery(".vedi-menu").removeClass('slide-menu');
}
if(jQuery(".level2").hasClass('slide-menu')){
jQuery(".level2").removeClass('slide-menu');
}
});
//}
},
openSecondLevel: function(){
jQuery('.submenu > a').click(function(e){
e.preventDefault(); /* disaable click 'a' event */
jQuery(this).parents('li').children('.level2').addClass('slide-menu') /* rendo visibile il level2 */
})
jQuery('.level2 li:first-child a').click(function(e){
e.preventDefault();
jQuery(this).parents('li').parents('.level2').removeClass('slide-menu') /* nascondo il level2 */
})
},
// Effetto Superfish //
openSubMenu: function(){
jQuery('.menu-fix #root_3099, #root_3099').superfish({
delay: 0, // the delay in milliseconds that the mouse can remain outside a submenu without it closing
speed: 'normal' // fast, normal
});
},
// fine effetto //
/* ***************gestione tab a fisarmonica*********** */
accordionTab: function(param){
jQuery('.slider-titolo').click(function(){
if(!jQuery(this).hasClass('opened')){
jQuery('.slider-titolo.opened').removeClass('opened');
jQuery(this).addClass('opened');
if (jQuery(this).hasClass('seawell')) {
}
jQuery('.slider-corpo.opened').slideUp('fast',function() {
jQuery(this).removeClass('opened');
})
jQuery(this).next().slideDown('fast',function() {
jQuery(this).addClass('opened');
});
} else {
jQuery(this).removeClass('opened');
jQuery('.slider-corpo.opened').slideUp('fast',function() {
jQuery(this).removeClass('opened');
});
}
});
},
enableMixItUp:function(){
jQuery('.cont-prodotti').mixItUp({
animation: {
enable: false
},
callbacks: {
onMixLoad: function(){
//console.log('onMixLoad: ',arguments)
jQuery(this).mixItUp('setOptions', {
animation: {
enable: true
},
});
},
onMixFail: function(state){
console.log('No elements found matching '+state.activeFilter);
},
onMixStart: function(obj_provenienza,obj_current){
//jQuery('div.element_mixitup').css('display','inline-block');
var array_titoli = new Array();
},
onMixEnd: function(obj_provenienza,obj_current){
//console.log('onMixEnd',obj_current._activeFilter, arguments);
}
}
});
},
hresize:function(param, padding){ /* FUNZIONE PER CALCOLARE L'ALTEZZA MAX TRA DIV AFFIANCATI */
var hm = '';
var maxh = '';
var arrH = [];
var sost = 0;
if (padding) {
sost = padding;
}
jQuery(param).each(function(){
hm = jQuery(this).height()+sost;
arrH.push(hm);
})
//console.log(arrH)
maxh = Math.max.apply(Math,arrH);
//console.log(maxh)
jQuery(param).height(maxh)
},
/**************** tendina lingue ********************/
openLanguage: function(){
//APRO MENU LINGUE
jQuery('.tendina-lingue').click(function() {
console.log("tendina");
var lingua = jQuery(this).children('#select_lingue');
if( lingua.is(':hidden') ) {
lingua.slideDown();
jQuery(this).addClass('open');
}else{
lingua.slideUp();
jQuery(this).removeClass('open');
}
});
jQuery('.tendina-lingue').click(function() {
console.log("tendina_new");
var lingua = jQuery(this).children('#select_lingue_new');
if( lingua.is(':hidden') ) {
lingua.slideDown();
jQuery(this).addClass('open');
}else{
lingua.slideUp();
jQuery(this).removeClass('open');
}
});
jQuery("#select_lingue").click(function() {
jQuery(this).slideUp();
jQuery('.tendina-lingue').children('.click').removeClass('open')
});
jQuery("#select_lingue_new").click(function() {
jQuery(this).slideUp();
jQuery('.tendina-lingue').children('.click').removeClass('open')
});
//APRO MENU LINGUE
jQuery('.tendina-mesi').click(function() {
var lingua = jQuery(this).children('#select_lingue');
if( lingua.is(':hidden') ) {
lingua.slideDown();
jQuery(this).addClass('open');
}else{
lingua.slideUp();
jQuery(this).removeClass('open');
}
});
jQuery('.tendina-mesi').click(function() {
var lingua = jQuery(this).children('#select_lingue_new');
if( lingua.is(':hidden') ) {
lingua.slideDown();
jQuery(this).addClass('open');
}else{
lingua.slideUp();
jQuery(this).removeClass('open');
}
});
jQuery("#select_lingue").click(function() {
jQuery(this).slideUp();
jQuery('.tendina-mesi').children('.click').removeClass('open')
});
jQuery("#select_lingue_new").click(function() {
console.log("menu_new");
jQuery(this).slideUp();
jQuery('.tendina-mesi').children('.click').removeClass('open')
});
/* jquery per chiudere la tendina delle lingue al click esterno alla tendina */
jQuery(document).click(function(event) {
if(jQuery(event.target).parents('.tendina-lingue').size()|(jQuery(event.target).hasClass('tendina-lingue'))|jQuery(event.target).parents('.tendina-mesi').size()|(jQuery(event.target).hasClass('tendina-mesi'))){
return;
}
if(!jQuery("#select_lingue").is(':hidden')){
jQuery("#select_lingue").slideUp();
jQuery('.tendina-mesi').removeClass('open')
jQuery('.tendina-lingue').removeClass('open')
}
});
jQuery(document).click(function(event) {
if(jQuery(event.target).parents('.tendina-lingue').size()|(jQuery(event.target).hasClass('tendina-lingue'))|jQuery(event.target).parents('.tendina-mesi').size()|(jQuery(event.target).hasClass('tendina-mesi'))){
return;
}
if(!jQuery("#select_lingue_new").is(':hidden')){
jQuery("#select_lingue_new").slideUp();
jQuery('.tendina-mesi').removeClass('open')
jQuery('.tendina-lingue').removeClass('open')
}
});
},
scrollVideoYoutube: function(){
setTimeout(function() {
/*if(window.innerWidth > 991){*/
jQuery('.video_youtube.visible').each( function(i){
var data_src = jQuery(this).attr("data-src-youtube");
if(data_src !== undefined){
var src = jQuery(this).attr("data-src-youtube");
// console.log("src = "+src);
jQuery(this).attr("src",src);
jQuery(this).removeAttr("data-src-youtube");
// console.log('vado');
}
});
/*}*/
}, 150);
},
viewCheck:function(){
if (window.innerWidth > 991) {
//console.log('ok')
jQuery('.moveUp,.moveRight,.moveDown, .moveLeft, .moveLine, .hideme, .image-container, .highlight, .video_youtube').viewportChecker({
classToAdd: 'visible', // Class to add to the elements when they are visible,
classToAddForFullView: 'full-visible', // Class to add when an item is completely visible in the viewport
repeat: false // Add the possibility to remove the class if the elements are not visible
});
}
else{
jQuery('.highlight, .video_youtube').viewportChecker({
classToAdd: 'visible', // Class to add to the elements when they are visible,
classToAddForFullView: 'full-visible', // Class to add when an item is completely visible in the viewport
repeat: false // Add the possibility to remove the class if the elements are not visible
});
}
},
showMe: function(elem){
anim = jQuery(elem).attr('data-anim');
jQuery(elem).addClass('animated '+anim);
jQuery(elem).animate({
opacity:1
}, 300, function() {
})
},
scrollAnimation: function(){
setTimeout(function() {
if(window.innerWidth > 991){
jQuery('.hideme.visible').each( function(i){
siteApp.showMe(this);
// console.log('vado');
});
}
}, 150);
},
fadeInHeader: function(element){
if(window.innerWidth > 991){
jQuery(window).scroll(function(){
var scrollpos = (document.documentElement.scrollTop || document.body.scrollTop);
var h_w = jQuery(window).height();
if(scrollpos > 300){
element.fadeIn();
bLazy.revalidate();
}
else{
element.fadeOut();
}
});
}
},
countAnimation: function(){
if(window.innerWidth > 991){
jQuery('.count').each(function () {
if(jQuery(this).hasClass('visible')){
// console.log('xxx')
if(!jQuery(this).hasClass('fatto')){
jQuery(this).fadeIn();
jQuery(this).prop('Counter',0).animate({
Counter: jQuery(this).text()
}, {
duration: 4000,
easing: 'swing',
step: function (now) {
jQuery(this).text(Math.ceil(now));
}
});
jQuery(this).addClass('fatto');
}
}
});
}
},
adatta: function(elem){
var win_h = window.innerHeight;
jQuery(elem).css('height',win_h);
},
openClickBooking: function () {
jQuery("#frm").submit(function(e){
e.preventDefault();
});
jQuery('#btn_submit').click(function (e) {
e.preventDefault(); /* disaable click 'a' event */
/*
jQuery('#booking_gg').val(jQuery('#data_arrivo').val().substring(0, 2));
jQuery('#booking_mm').val(jQuery('#data_arrivo').val().substring(3, 5));
jQuery('#booking_aa').val(jQuery('#data_arrivo').val().substring(6, 10));
jQuery('#booking_ggf').val(jQuery('#data_partenza').val().substring(0, 2));
jQuery('#booking_mmf').val(jQuery('#data_partenza').val().substring(3, 5));
jQuery('#booking_aaf').val(jQuery('#data_partenza').val().substring(6, 10));
*/
console.log('btn_preventivo click');
var data_arrivo = jQuery('.booking #data_arrivo').val();
createCookie('data_arrivo', data_arrivo, 1);
//console.log('data_arrivo '+ data_arrivo);
var data_partenza = jQuery('.booking #data_partenza').val();
createCookie('data_partenza', data_partenza, 1);
// console.log('data_arrivo '+ (readCookie("data_arrivo")));
/* jQuery("#alpaca6").val(readCookie("data_arrivo"));
jQuery("#alpaca7").val(readCookie("data_partenza"));*/
jQuery("input[name='periodo_0_arrival_date']").val(readCookie("data_arrivo"));
jQuery("input[name='periodo_0_departure_date']").val(readCookie("data_partenza"));
goToByScroll(".myReplyForm");
})
},
loadGoogleFont: function(url) {
// the 'fetch' equivalent has caching issues
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
var css = xhr.responseText;
css = css.replace(/}/g, 'font-display: swap; }');
var head = document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.appendChild(document.createTextNode(css));
head.appendChild(style);
}
};
xhr.send();
},
refreshWebCam: function(img, url, timeOut) {
var ts = new Date().getTime();
jQuery(img).attr("src", url + '?' + ts);
setTimeout(function() { siteApp.refreshWebCam(img, url, timeOut); }, timeOut);
}
}
window.addEventListener("load", function(){
siteApp.init();
siteApp.viewCheck();
siteApp.scrollAnimation();
siteApp.scrollVideoYoutube();
});
function nascondo_bambini_form() {
var n_bambini = 0
jQuery(".cnt-bambini").each(function() {
jQuery(this).fadeOut();
jQuery(this).find("select").val("");
n_bambini++;
});
return n_bambini;
}
jQuery(window).on('load resize', function(){
if(window.innerWidth > 991){
jQuery('.adattHeight').each(function(){
$height = jQuery(this).next().height();
// console.log($height)
if($height) {
jQuery(this).height($height);
} else if(!$height) {
$height = jQuery(this).next().height();
jQuery(this).height($height);
}
});
}
})
/*gestione di funzioni es. onclick="gotobyscroll('.classe')"*/
function add_slide_menu(item) {
jQuery('li' + item + ' .level2').toggleClass('slide-menu');
//console.log(item)
}
function back_menu(item) {
jQuery('li' + item + ' .level2').toggleClass('slide-menu');
//console.log('vado')
}
function show_menu(elem) {
if (window.innerWidth < 992) {
//console.log('passo');
jQuery(elem).children('.sottomenu').toggleClass('slide-menu');
}
}
function hide_sottomenu(elem) {
if (window.innerWidth < 992) {
//console.log('passo');
jQuery(elem).closest('.sottomenu').removeClass('slide-menu');
}
}
function goToByScroll(param, offset){
bLazy.revalidate();
try {
if (offset) {
jQuery('html, body').animate({scrollTop: jQuery(param).offset().top-offset}, 2000, "easeInOutQuad");
} else {
jQuery('html, body').animate({scrollTop: jQuery(param).offset().top-250}, 2000, "easeInOutQuad");
}
bLazy.revalidate();
//bLazy.destroy();
}
catch(err) {
}
}
/* funzioni dei cookie */
function createCookie(name, value, days) {
console.log('createCookie');
if (days) {
var date = new Date();
// Now get the current Time (in milliseconds) and add the required number of days (in milliseconds). Set the Time of the date to this new value, so that it now contains the date in milliseconds that the cookie should expire.
date.setTime(date.getTime()+(days*24*60*60*1000));
// Set the variable expires to this date in the UTC/GMT format required by cookies.
var expires = "; expires=" + date.toGMTString();
} else {
// If 0 is passed to the function, expires is not set and the cookie expires when the user closes his browser..
var expires = "";
}
// Finally write the new cookie into document.cookie in the correct syntax.
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
console.log('readCookie');
var nameEQ = name + "=";
// Then split document.cookie on semicolons. ca becomes an array containing all cookies that are set for this domain and path.
var ca = document.cookie.split(';');
// Then we go through the array (so through all cookies):
for(var i=0;i < ca.length;i++) {
// Set c to the cookie to be checked.
var c = ca[i];
// If the first character is a space, remove it by using the substring() method. Continue doing this until the first character is not a space.
while (c.charAt(0)==' ') c = c.substring(1, c.length);
// Now string c begins with the name of the current cookie. If this is the name of the desired cookie
// we've found what we were looking for. We now only need to return the value of the cookie, which is the part of c that comes after nameEQ. By returning this value we also end the function: mission accomplished.
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
// If, after having gone through all cookies, we haven't found the name we're looking for, the cookie is not present. We return null.
return null;
}
function eraseCookie(name) {
createCookie(name,'',-1);
}