


$(function() {
    var bookingResourcesTranslations = {
        room: "Cottage",
        found: "en réponse",
        moreInfo: "Plus d'infos",
        lessInfo: "Moins d'info...",
        };




eviivo.availabilitySearch.init({
    isDefaultReferrer: true,
    defaultNightsServiced: null,
    roomsLimit: 8,
    cultureLanguageCode: "fr-FR",
    
    baseSearchUrl: "/fr-FR/rooms-cottages",
    
    resources:
    {
        adults: "Adulte(s)",
        children: "Enfant(s)",
        room: "Cottage",
        rooms: "Cottages",
        roomAdded: "ajout de {0} Cottage",
        roomsAdded: "ajout de {0} Cottages"
    }
});
    
delayedInitPromoFeature(eviivo.availabilitySearch.triggerSearch);



        eviivo.smoothScrolling.init();
        eviivo.popup.init();
        eviivo.combinedInventory.init({
            maxInventory: 8,
            resources: {
                soldout: "Sold Out",
                select: "Select",
            }
        });

        
        eviivo.imageMainGallery.init({
        initializeGalleryByDefault: true,
        initializeGalleryOnClick: false,
        initializeGalleryForRooms: true,
        });

        
        

    //enable jquery UI tooltip (only for specific targeted cp-tip items)
    $(".cp-tip").tooltip({
        position: {
            my: "center bottom-15",
            at: "center top",
            using: function (position, feedback) {
                $(this).css(position);
                $("<div>")
    .addClass("arrow")
    .addClass(feedback.vertical)
    .addClass(feedback.horizontal)
    .appendTo(this);
    }
    },
    content: function ()
    {
    return $(this).prop('title');
    }
    });

    $(".accordion-rooms a.accordion-rooms-toggle").on("click", function () {
    if ($('.intro-description').length) {
    $(this).parent().siblings(".intro-description").slideToggle("slow");
    }
    $(this).siblings(".accordion").slideToggle("slow");
    $(this).parent().toggleClass("expanded");
    var textDefault = bookingResourcesTranslations.moreInfo;
    var textExpanded = bookingResourcesTranslations.lessInfo;
    $(this).text(function (i, text) {
    return text === textExpanded ? textDefault : textExpanded;
    });


    });
    // Close error/notice box
    var $closeControl = $(".cp-close");
    $closeControl.on("click", function () {
    $(this).parent().parent().hide();

    });

    
    eviivo.stickyContainer.init({
    resources: {
    room: bookingResourcesTranslations.room,
    found: bookingResourcesTranslations.found
    }
    });

    $('#accept-cookies').on("click", function () {
    var currentCookieSession = window.eviivo.webcore.cookieManager.getCookie('userSettings');
    if (currentCookieSession)
    {
    window.eviivo.webcore.cookieManager.setCookie('userSettings', currentCookieSession.concat('&' + 'cookienotification' + '=accepted'), 30);
    }

    $('.cookiebar').remove();
    });

    $.widget("custom.iconselectmenu", $.ui.selectmenu, {
    _renderItem: function (ul, item) {
    var li = $("<li>", { text: item.label });
        if (item.disabled) {
        li.addClass("ui-state-disabled");
        }
        $("<span>", {
            style: item.element.attr("data-style"),
            "class": "ui-icon " + item.element.attr("data-class")
            })
            .appendTo(li);
            return li.appendTo(ul);
            }
            });

            //Let stry to disabled zooming for mobile screens
            if (/iphone|ipod|android|blackberry|opera mini|opera mobi|skyfire|maemo|windows phone|palm|iemobile|symbian|symbianos|fennec/i.test(navigator.userAgent.toLowerCase())) {
            $("meta[name='viewport']").attr("content", "width=device-width, initial-scale=1.0, maximum-scale=1.0");
            }
            


            
                eviivo.bookingFlow.init();
            
        function delayedInitPromoFeature(searchTrigger){
        eviivo.promos.init({
        resources: {
        apply: "Appliquer",
        unlockSpecials: "Un clic pour d&#233;verrouiller nos offres exclusives!",
        enterPromoCode: "Entrez un code promotionnel ou un No de fid&#233;lisation"
        },
        queryString: {
        promoCode: "pce",
        askForPromoInstantDeal: "peid"
        },
        cookie:
        {
        flags:{
        promotionCode: "pc_flags",
        instantDeal: "pid_flags"
        }
        },
        bannerTypes: {
        webExclusivePromoCode: "WXC",
        webExclusiveInstantDeal: "WXI",
        webExclusivePromoCodeFail: "WXCF",
        webExclusiveBannerWarning: "WXWARN",
        webExclusivePromoCodeUnlocked: "WXPU"
        },
        captcha: {
        siteKey: "6LdAbAoUAAAAAMuXWv2p3tnpik9AdCDyLRbpfeaB"
        },
        searchTrigger: searchTrigger
        });

        eviivo.promos.codeValidator.init({
        callback: eviivo.promos.onCodeValid,
        resources: {
        promoValidationMessage: "Votre code est invalide ou a expir&#233; !",
        promoValidationEmptyCode: "Il faut soumettre un code promo."
        }
        });
        }

        eviivo.instantWebMenu.init();

                    
                eviivo.mapView.init({
                googleMapsApiUrl: "//maps.googleapis.com/maps/api/js?key=AIzaSyCtPYb_pV8h_-HxZJIEJ_pJBuPel7LUz5s&amp;v=3&amp;callback=",
                lat: "60.965421",
                lng: "-149.135837",
                resources: {
                switchToMap: "Voir la carte",
                switchToImage: "Voir les photos"
                },
                showMapByDefault: false
                });
            
        eviivo.bookingSystem.managePageLogin.init({
        popupHeaderTitle: "G&#233;rer votre r&#233;servation",
        ajaxUrl: "/instantweb/manage/RetrieveOrderCancellationPermissions",
        referrerShortName: "MyWeb",
        propertyShortName: "CrrgHsAccmmdtns99587",
        requestVerificationToken: "1C-f92I8y-IX1nEFSA0LdDSV7DOdCuZBjgqL9WK6Jasoc_0nekNTdWh9Pxr1pX04NDaiUrnxefeLghN7mS2riklGbtY1:ng3qSMDWCFAojwf9x3v6OlatEghjHLS3In7s8GOLlUTI3FTmFK2nDmpIWkWg-du179g41EK6vRdWfrCWGDalKVhUe0g1",
        ajaxLoaderResources: {
        loadingUpdateResults: "Nous v&#233;rifions votre num&#233;ro de r&#233;servation et votre adresse e-mail...",
        loadingSlowSystemWarning: "Merci de votre patience... nous recherchons votre r&#233;servation pour l&#39;annuler.",
        loadingRefreshingIssueWarning: "Une erreur est intervenue! Merci de cliquer sur",
        ajaxFailText: "Il y a une erreur, merci d&#39;essayer de",
        refreshPageText: "relancer la page"
        }
        });

        });

        
