

var sLang = "it"; 
var sPrivacyPageUrl = "/it/fondazione/contatto/privacy/";

    var klaroConfig = {
        /*
        You can customize the ID of the DIV element that Klaro will create when starting
        up. By default, Klaro will use 'klaro'.
        */
        elementID: "tbCookieConsent",
        /*
         You can customize how Klaro persists consent information in the browser. Specify
         either cookie' (the default) or 'localStorage'.
         */
        storageMethod: "cookie",
        /*
        You can customize the name of the cookie or localStorage entry that Klaro will
        use for storing the consent information. By default, Klaro will use 'klaro'.
        */
        storageName: "tbCookieConsent",
        /*
        If set to `true`, Klaro will render the texts given in the
        `consentModal.description` and `consentNotice.description` translations as HTML.
        This enables you to e.g. add custom links or interactive content.
         */
        htmlTexts: true,
        /*
        You can change the cookie domain for the consent manager itself. Use this if you
        want to get consent once for multiple matching domains. By default, Klaro will
        use the current domain. Only relevant if 'storageMethod' is set to 'cookie'.
        */
        // cookieDomain: '.example.com',
        /*
        You can also set a custom expiration time for the Klaro cookie. By default, it
        will expire after 30 days. Only relevant if 'storageMethod' is set to 'cookie'.
        */
        cookieExpiresAfterDays: "30",
        /*
        You can specify a link to your privacy policy here (relative or absolute), which
        will then be shown in the notice and modal. You can also specify an object with
        language-specific links and an optional fallback using the 'default' key:
        privacyPolicy : {de: "/#datenschutz", en: "/#privacy", default: "/#privacy" },
        */
        privacyPolicy: sPrivacyPageUrl,
        /*
        Defines the default state for applications in the consent modal (true=enabled by
        default). You can override this setting in each app.
         */
        default: false,
        /*
        If 'mustConsent' is set to 'true', Klaro will directly display the consent
        manager modal and not allow the user to close it before having actively
        consented or declined the use of third-party applications.
         */
        mustConsent: true,
        /*
        Setting 'acceptAll' to 'true' will show an "accept all" button in the notice and
        modal, which will enable all third-party apps if the user clicks on it. If set
        to 'false', there will be an "accept" button that will only enable the apps that
        are enabled in the consent modal.
         */
        acceptAll: true,
        /*
       Setting 'hideDeclineAll' to 'true' will hide the "decline" button in the consent
       modal and force the user to open the modal in order to change his/her consent or
       disable all third-party apps. We strongly advise you to not use this feature, as
       it opposes the "privacy by default" and "privacy by design" principles of the
       GDPR (but might be acceptable in other legislations such as under the CCPA)
        */
        hideDeclineAll:  false,
        /*
        Setting 'hideLearnMore' to 'true' will hide the "learn more / customize" link in
        the consent notice. We strongly advise against using this under most
        circumstances, as it keeps the user from customizing his/her consent choices.
         */
        hideLearnMore: false,

        /* Skripte hier definieren */
        apps: [
            {
							name: 'GoogleTagManager',
							title: 'Google TagManager',
							description: '',
							purposes: ['besucherstatistiken'],
							cookies: []						
						},{
							name: 'GoogleAnalytics',
							title: 'Google Analytics',
							description: '',
							purposes: ['besucherstatistiken'],
							cookies: ['/^ga/i']						
						},  
        ],
        callback: function (consent, app) {

        }
        , translations: {}
    };


    /*
      You can overwrite existing translations and add translations for your app
      descriptions and purposes. See `src/translations/` for a full list of
      translations that can be overwritten:
      https://github.com/KIProtect/klaro/tree/master/src/translations
    */ klaroConfig.translations["it"] = {
        acceptAll: "Accettare tutti",
        acceptSelected: "Accettare selezionati",
        app: {
            disableAll: {
                description: "Attivare o disattivare tutti i servizi",
                title: "Attivare o disattivare tutti i servizi",
            },
            optOut: {
                description: "Questo servizio è caricato di default",
                title: "(Opt-out)",
            },
            purpose: "finalità",
            purposes: "finalità",
            required: {
                description: "Questo servizio è sempre richiesto",
                title: "(sempre richiesto)",
            }
        },
        close: "chiudi",
        consentModal: {
            description:"Qui può personalizzare i servizi che verranno utilizzati su questo sito web. La scelta è Sua: può abilitare o disabilitare i servizi che desidera.",
            privacyPolicy: {
                name: "informativa sulla privacy",
                text: "Per saperne di più, può consultare la nostra {privacyPolicy}.",
            },
            title: "Cookie",
        },
        consentNotice: {
            changeDescription: "Ci sono stati dei cambiamenti rispetto alla Sua ultima visita,    La preghiamo di rinnovare il Suo consenso.",
            configure: "personalizza",
            description: "Ciao! Possiamo attivare alcuni cookie aggiuntivi per {purposes} ?",
            imprint: {
                name: "Impressum",
            },
            learnMore: "Personalizza",
            privacyPolicy: {
                name: "informativa sulla privacy",
            },
            testing: "Testmodus!"
        },
        decline: "Solo cookie tecnici",
        ok: "Accetta",
        poweredBy: " ",
        purposeItem: {
            app: "servizio",
            apps: "servizi",
        },
        purposes: {
			besucherstatistiken: 'Statistiche dei visitatori',					
						karten: 'Mappe',					
						
        }
    };

    // Fuer den Fall das es keine besonderen Dienste gibt -> andere Texte
    if (klaroConfig.apps.length == 0) {
        klaroConfig.translations[sLang].consentNotice.learnMore = "scegliere";
        klaroConfig.translations[sLang].consentModal.title = " ";
        klaroConfig.translations[sLang].consentNotice.description = "Questo sito web utilizza i cookie per offrirti il massimo in termini di funzionalità." + " <a class='privay-link' href='" + sPrivacyPageUrl + "'>" + "informativa sulla privacy" + "</a>";
        klaroConfig.translations[sLang].ok = "Accetta"
    }

    // Schliessen Event
       function closeKlaro() {
            if ($(".cn-decline").length > 0) {
                $(".cn-decline").click();
            } else {
                $("#tbCookieConsent .klaro").html("<div></div>");
            }       
        }
		
	// Funktion zum Aufrufen
	function openKlaroDialog(){
		klaro.show();
	}