{% if languages|length > 1 %}
<style>
	.header__actions {
		margin-left: 6px !important;
	}
	.langmark {
		margin-top: 0;
		margin-right: 0;
		margin-left: 8px;
		color: #343434;
	}
	.langmark a {
		color: #343434;
	}
	.langmark a:hover {
		color: #343434;
		/* text-decoration: underline; */
	}
	.langmark li {
		display: inline;
		margin: 0 0 0 2px;
		padding: 0;
	}
	.langmark a.langmarkactive {
		color: #343434;
		font-weight: bold;
	}
</style>
<div class="langmark">
	<ul class="list-inline">
		<li><img src="/catalog/language/uk-ua/uk-ua.png"></li>
		{% for language in languages %}
			{% if language.main %}
				<li>
					<span>
						<a {% if (not language['current']) %} href="{{ language.url }}" {% endif %} {% if (language['current']) %} class="langmarkactive" {% endif %} onclick="lm_deleteCookie('languageauto'); window.location = '{{ language.url }}'">{{ language.name }}</a>
					</span>
				</li>
			{% else %}
				<li>
					<span>
						<a {% if (not language['current']) %} href="{{ language.url }}" {% endif %} {% if (language['current']) %} class="langmarkactive" {% endif %} onclick="lm_setCookie('languageauto', '1', {expires: 180}); window.location = '{{ language.url }}'">{{ language.name }}</a>
					</span>
				</li>
			{% endif %}
			{% if not loop.last %}
				<li>{{ "|" }}</li>
			{% endif %}
		{% endfor %}
	</ul>
</div>

	<script>
	function lm_setCookie(name, value, options = {}) {
	options = {
	  path: '/',
	  ...options
	};
	
	let date = new Date(Date.now() + (86400e3 * options.expires));
	date = date.toUTCString();
	options.expires = date;
	 
	let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
	
	for (let optionKey in options) {
	  updatedCookie += "; " + optionKey;
	  let optionValue = options[optionKey];
	  if (optionValue !== true) {
		updatedCookie += "=" + optionValue;
	  }
	}
	document.cookie = updatedCookie;
	}
	
	function lm_deleteCookie(name) {
	  lm_setCookie(name, "", {'max-age': -1});
	}
	</script>
{% endif %}