var list = new Array();
{% set i = 0 %}
{% for id, cat in config('menu_categories') %}
	{% if (cat.id != 'shops' or setting('core.gifts_system')) and menus[id]|length > 0 %}
		list[{{ i }}] = '{{ cat.id }}';
		{% set i = i + 1 %}
	{% endif %}
{% endfor %}

function initMenu()
{
	var length = list.length;
	for(i = 0; i < length; i++)
	{
		if(list[i] == category)
		{
			document.getElementById(list[i]).className = 'tab-active';
			document.getElementById(list[i] + "-submenu").style.display = 'block';
		}
		else
		{
			document.getElementById(list[i]).className = 'tab';
			document.getElementById(list[i] + "-submenu").style.display = 'none';
		}
	}
}

function menuSwitch(cat)
{
	category = cat;
	initMenu();
}
