{% set config = registry.get('config') %}
{% if (position == 'footer_bottom' or position == 'footer' or position == 'footer_top' or position == 'footer_left' or position == 'footer_right' or position == 'customfooter_top' or position == 'customfooter_bottom' or position == 'customfooter') %}
	
	{% if (module['content']['title'] != '') %}
	 {{ '<h4>'~module['content']['title']~'</h4>' }}
	{% else %} 
	 {{ '<div style="height:13px"></div>' }}
	{% endif %}
	{{ '<div class="strip-line"></div>' }}

	{% if module['content']['limit'] < 1 %} 
		{% set limit = 20 %}
	{% else %}
		{% set limit = module['content']['limit'] %}
	{% endif %} 

	{% set count_columns = (module['content']['links']|length/limit)|round(0, 'ceil') %}
	{% set class = 3 %} 
	
	{% if (count_columns == 1) %} {% set class = 12 %}{% endif %}
	{% if (count_columns == 2) %} {% set class = 6 %}{% endif %}
	{% if (count_columns == 3) %} {% set class = 4 %}{% endif %}
	{% if (count_columns == 4) %} {% set class = 3 %}{% endif %}
	{% if (count_columns == 5) %} {% set class = 25 %}{% endif %}
	{% if (count_columns == 6) %} {% set class = 2 %}{% endif %} 
	
	{{ '<div class="row" style="clear: both">' }}
	 {{ '<div class="col-sm-' ~ class ~ '">' }}
	 {{ '<ul>' }}
	 {% set i = 0 %} 
	 
 	{% for link in module['content']['links'] %} 
 	 {% if (limit == i) %}
 	 {% set i = 0 %}
 	 {{ '</ul></div><div class="col-sm-' ~ class ~ '"><ul>' }}
 	 {% endif %}
 	 
  	 {% if (link['url'] is iterable) %}
 	 	{% set nowy_link = link['url'] %}
 	 	{% set language_id = config.get( 'config_language_id' ) %}
 	 	{% if (nowy_link[language_id] is defined) %}
 	 		{% set link = link|merge({'url': nowy_link[language_id]}) %}
 	 	{% else %} 
 	 		{% set link = link|merge({'url': ''}) %}
 	 	{% endif %}
 	 {% endif %} 
 	 
 	 {{ '<li><a href="' ~ link['url'] ~ '">' ~ theme_options.html_entity_decode(link['name']) ~ '</a></li>' }}
 	 {% set i = i + 1 %}
 	{% endfor %} 
 {{ '</ul>' }}
 {{ '</div>' }}
 {{ '</div>' }}  
{% else %} 
	
	{{ '<div class="box">' }}
		{{ '<div class="box-heading">' }}
			{{ module['content']['title'] }}
		{{ '</div>' }}
		{{ '<div class="strip-line"></div>' }}
		{{ '<div class="box-content">' }}

			{% if module['content']['limit'] < 1 %} 
				{% set limit = 20 %}
			{% else %}
				{% set limit = module['content']['limit'] %}
			{% endif %} 

			{% set count_columns = (module['content']['links']|length/limit)|round(0, 'ceil') %}
			{% set class = 3 %} 	

			{% if (count_columns == 1) %} {% set class = 12 %}{% endif %}
			{% if (count_columns == 2) %} {% set class = 6 %}{% endif %}
			{% if (count_columns == 3) %} {% set class = 4 %}{% endif %}
			{% if (count_columns == 4) %} {% set class = 3 %}{% endif %}
			{% if (count_columns == 5) %} {% set class = 25 %}{% endif %}
			{% if (count_columns == 6) %} {% set class = 2 %}{% endif %}
			
			{{ '<div class="row">' }}
			 {{ '<div class="col-sm-' ~ class ~ '">' }}
			 {{ '<ul>' }}
			 {% set i = 0 %}
			 {% for link in module['content']['links'] %} 
			 	 {% if (limit == i) %}
			 	 {% set i = 0 %}
			 	 {{ '</ul></div><div class="col-sm-' ~ class ~ '"><ul>' }}
			 	 {% endif %}
			 	 
			  	 {% if (link['url'] is iterable) %}
			 	 	{% set nowy_link = link['url'] %}
			 	 	{% set language_id = config.get( 'config_language_id' ) %}
			 	 	{% if (nowy_link[language_id] is defined) %}
			 	 		{% set link = link|merge({'url': nowy_link[language_id]}) %}
			 	 	{% else %} 
			 	 		{% set link = link|merge({'url': ''}) %}
			 	 	{% endif %}
			 	 {% endif %} 
			 	 
			 	 {{ '<li><a href="' ~ link['url'] ~ '">' ~ link['name'] ~ '</a></li>' }}
			 	 {% set i = i + 1 %}
			 {% endfor %}
			 {{ '</ul>' }}
			 {{ '</div>' }}
			{{ '</div>' }}
		{{ '</div>' }}
	{{ '</div>' }}
{% endif %}