

var sLang = "de"; 
var sPrivacyPageUrl = "/de/stiftung/kontakt/datenschutz/";

    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["de"] = {
        acceptAll: "alle akzeptieren",
        acceptSelected: "ausgewählte akzeptieren",
        app: {
            disableAll: {
                description: "Mit diesem Schalter können Sie alle Dienste aktivieren oder deaktivieren.",
                title: "Alle Dienste aktivieren oder deaktivieren",
            },
            optOut: {
                description: "Diese Dienste werden standardmäßig geladen",
                title: "(Opt-out)",
            },
            purpose: "Zweck",
            purposes: "Zwecke",
            required: {
                description: "Dieser Service ist immer erforderlich",
                title: "(immer erforderlich)",
            }
        },
        close: "schließen",
        consentModal: {
            description:"Hier können Sie die Dienste, die wir auf dieser Website nutzen möchten,    bewerten und anpassen. Sie haben das Sagen! Aktivieren oder deaktivieren Sie die    Dienste, wie Sie es für richtig halten.",
            privacyPolicy: {
                name: "Datenschutzerklärung",
                text: "Um mehr zu erfahren, lesen Sie bitte unsere {privacyPolicy}",
            },
            title: "Cookies",
        },
        consentNotice: {
            changeDescription: "Seit Ihrem letzten Besuch gab es Änderungen, bitte erneuern Sie    Ihre Zustimmung.",
            configure: "konfigurieren",
            description: "Hallo! Könnten wir bitte einige zusätzliche Dienste für {purposes} aktivieren?",
            imprint: {
                name: "Impressum",
            },
            learnMore: "Dienste wählen",
            privacyPolicy: {
                name: "Datenschutzerklärung",
            },
            testing: "Testmodus!"
        },
        decline: "Nur technische Cookies",
        ok: "Einverstanden",
        poweredBy: " ",
        purposeItem: {
            app: "Dienst",
            apps: "Dienste",
        },
        purposes: {
			besucherstatistiken: 'Besucher-Statistiken',					
						karten: 'Karten',					
						
        }
    };

    // Fuer den Fall das es keine besonderen Dienste gibt -> andere Texte
    if (klaroConfig.apps.length == 0) {
        klaroConfig.translations[sLang].consentNotice.learnMore = "mehr erfahren";
        klaroConfig.translations[sLang].consentModal.title = " ";
        klaroConfig.translations[sLang].consentNotice.description = "Diese Website verwendet Cookies, um eine bestmögliche Erfahrung bieten zu können." + " <a class='privay-link' href='" + sPrivacyPageUrl + "'>" + "Datenschutzerklärung" + "</a>";
        klaroConfig.translations[sLang].ok = "verstanden"
    }

    // 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();
	}