var onlyRequired = true; var policyCookieConsent1 = '0'; var policyCookieRequired1 = '0'; var policyCookiePreferences1 = '0'; var policyCookieStatistics1 = '0'; var policyCookieMarketing1 = '0'; var policyCookieDate1 = '0'; function detectRequired() { onlyRequired = true; if ($('#cookie-detail-card-preferences-input')[0].checked || $('#cookie-detail-card-statistics-input')[0].checked || $('#cookie-detail-card-marketing-input')[0].checked) onlyRequired = false; } function resetModal() { $('#cookie-modal').removeClass('hide'); $('#cookie-modal').removeClass('show'); $('#cookie-tab').removeClass('show'); $('#cookie-tab > div').removeClass('show'); $('#cookie-block > div').removeClass('show'); $('#cookie-btn-required').removeClass('show'); $('#cookie-btn-save').removeClass('show'); $('#cookie-consent').addClass('show'); $('#cookie-btn-confirm').addClass('show'); $('#cookie-btn-detail').addClass('show'); } function showTab() { $('#cookie-modal').addClass('show'); $('#cookie-tab').addClass('show'); $('#cookie-tab > div').removeClass('show'); $('#cookie-block > div').removeClass('show'); $('#cookie-btn-required').removeClass('show'); $('#cookie-btn-save').removeClass('show'); } function showTabConsent() { showTab() $('#cookie-tab-consent').addClass('show'); $('#cookie-consent').addClass('show'); $('#cookie-btn-required').removeClass('show'); $('#cookie-btn-detail').addClass('show'); } function showTabDetail() { showTab() $('#cookie-tab-detail').addClass('show'); $('#cookie-detail').addClass('show'); $('#cookie-btn-detail').removeClass('show'); if (onlyRequired) { $('#cookie-btn-required').addClass('show'); $('#cookie-btn-save').removeClass('show'); } else { $('#cookie-btn-required').removeClass('show'); $('#cookie-btn-save').addClass('show'); } } function showTabInfo() { showTab() $('#cookie-tab-info').addClass('show'); $('#cookie-info').addClass('show'); $('#cookie-btn-required').removeClass('show'); $('#cookie-btn-detail').addClass('show'); } function toggleList(el, listID) { $(el).toggleClass('show'); $('#'+listID).toggleClass('show'); } function changeCookie() { detectRequired(); if (onlyRequired) { $('#cookie-btn-required').addClass('show'); $('#cookie-btn-save').removeClass('show'); } else { $('#cookie-btn-required').removeClass('show'); $('#cookie-btn-save').addClass('show'); } } function declineCookie() { policyCookieConsent1 = '0'; policyCookieRequired1 = '1'; $('#cookie-detail-card-preferences-input')[0].checked = false; $('#cookie-detail-card-statistics-input')[0].checked = false; $('#cookie-detail-card-marketing-input')[0].checked = false; saveCookie(); } function saveRequiredCookie() { policyCookieConsent1 = '1'; policyCookieRequired1 = '1'; $('#cookie-detail-card-preferences-input')[0].checked = false; $('#cookie-detail-card-statistics-input')[0].checked = false; $('#cookie-detail-card-marketing-input')[0].checked = false; saveCookie(); } function saveAllCookie() { policyCookieConsent1 = '1'; policyCookieRequired1 = '1'; $('#cookie-detail-card-preferences-input')[0].checked = true; $('#cookie-detail-card-statistics-input')[0].checked = true; $('#cookie-detail-card-marketing-input')[0].checked = true; saveCookie(); } function saveSelectedCookie() { policyCookieConsent1 = '1'; policyCookieRequired1 = '1'; saveCookie(); } function saveCookie() { policyCookiePreferences1 = '0'; policyCookieStatistics1 = '0'; policyCookieMarketing1 = '0'; if ($('#cookie-detail-card-preferences-input')[0].checked) policyCookiePreferences1 = '1'; if ($('#cookie-detail-card-statistics-input')[0].checked) policyCookieStatistics1 = '1'; if ($('#cookie-detail-card-marketing-input')[0].checked) policyCookieMarketing1 = '1'; SetCookie('policyCookieConsent', policyCookieConsent1, 365); SetCookie('policyCookieRequired', policyCookieRequired1, 365) SetCookie('policyCookiePreferences', policyCookiePreferences1, 365); SetCookie('policyCookieStatistics', policyCookieStatistics1, 365); SetCookie('policyCookieMarketing', policyCookieMarketing1, 365); SetCookie('policyCookieDate', new Date().toLocaleString(), 365); $('#cookie-modal').addClass('hide'); window.policyCookiePreferences = false; if (policyCookiePreferences1 == '0') { $('#cookie_policyCookiePreferences').hide('slow'); window.policyCookiePreferences = true; } window.policyCookieStatistics = false; if (policyCookieStatistics1 == '0') { $('#cookie_policyCookieStatistics').hide('slow'); window.policyCookieStatistics = true; } window.policyCookieMarketing = false; if (policyCookieMarketing1 == '0') { $('#cookie_policyCookieMarketing').hide('slow'); window.policyCookieMarketing = true; } $('.cookie-btn-erase').show(); showStatusCookie(); $(window).trigger('eventCookieUpdate'); } function SetCookie(name, value, expiredays) { var exdate = new Date() exdate.setDate(exdate.getDate() + expiredays) if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(document.location.hostname)) { document.cookie = name + "=" + escape(value) + ((expiredays==null) ? "" : ";path=/;expires="+exdate.toGMTString()); } else { var n = document.location.hostname.split("."); var e = n.slice(1).join("."); document.cookie = name + "=" + escape(value) + ((expiredays==null) ? "" : ";domain=."+e+";path=/;expires="+exdate.toGMTString()); } } function eraseCookie() { var noremove = ["lang", "lang_id", "policyCookieUnique"]; var names = []; var e = ""; if (!(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(document.location.hostname))) { var n = document.location.hostname.split("."); var e = n.slice(1).join("."); } document.cookie.split(";").forEach(function(c) { name = c.split("=")[0].trim(); if (noremove.indexOf(name) == -1) { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;path=/;expires= Thu, 01 Jan 1970 00:00:00 UTC"); if (e != "") { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;domain=."+e+";path=/;expires= Thu, 01 Jan 1970 00:00:00 UTC"); } names.push(name); } }); if (window.ipt !== undefined) {window.ipt("delete", {"names":names});} resetModal(); $('#cookie_policyCookiePreferences').show('slow'); $('#cookie_policyCookieStatistics').show('slow'); $('#cookie_policyCookieMarketing').show('slow'); $('#cookie-detail-card-preferences-input')[0].checked = false; $('#cookie-detail-card-statistics-input')[0].checked = false; $('#cookie-detail-card-marketing-input')[0].checked = false; $('.cookie-btn-erase').hide(); policyCookieConsent1 = '0'; policyCookieRequired1 = '0'; window.policyCookieMarketing = true; window.policyCookiePreferences = true; window.policyCookieStatistics = true; showStatusCookie(); $(window).trigger('eventCookieUpdate'); } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie.replace(/\+/g, ' ')); var ca = decodedCookie.split(';'); for(var i = 0; i