{% if languages|length > 1 %}
<div class="box-language hidden-xs hidden-sm">
	<div id="language">
		<div class="btn-group">
			<button class="btn-language-top dropdown-toggle" data-toggle="dropdown">
				{% for language in languages %}
					{% if language.current %}
						{{ language.name }}
					{% endif %}
				{% endfor %}
			</button>
			<ul class="dropdown-menu dropdown-menu-right ch-dropdown">
				<li class="mob-title-language visible-xs">{{ text_language }}</li>
				{% for language in languages %}
					<li {% if language.current %} class="active" {% endif %}>
						{% if language.main %}
							<button class="btn-lang-select" type="button" onclick="lm_deleteCookie('languageauto'); window.location = '{{ language.url }}'">
							{% else %}
							<button class="btn-lang-select" type="button" onclick="lm_setCookie('languageauto', '1', {expires: 180}); window.location = '{{ language.url }}'">
							{% endif %}
							{{ language.name }}</button>
						</li>
					{% endfor %}
				</ul>
			</div>
			<span class="mob-text-language">{{ text_language }}</span>

		</div>
	</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 %}