{% set nest_type = this.setting('nest_type') %}

{% if nest_type == 'buttons' %}
	{% set showButtons = true %}
	{% set showTabs = false %}
	{% set showTabNames = false %}

{% elseif nest_type == 'indicator' %}
	{% set showButtons = false %}
	{% set showTabs = true %}
	{% set showTabNames = false %}

{% elseif nest_type == 'indicator_and_buttons' %}
	{% set showButtons = true %}
	{% set showTabs = true %}
	{% set showTabNames = false %}

{% elseif nest_type == 'tabs' %}
	{% set showButtons = false %}
	{% set showTabs = true %}
	{% set showTabNames = true %}

{% elseif nest_type == 'tabs_and_buttons' %}
	{% set showButtons = true %}
	{% set showTabs = true %}
	{% set showTabNames = true %}

{% elseif this.setting('show_global_tabs') %}
	{% set showButtons = false %}
	{% set showTabs = true %}
	{% set showTabNames = true %}

{% else %}
	{% set showButtons = false %}
	{% set showTabs = false %}
	{% set showTabNames = false %}
{% endif %}

<div class="nest_wrap">
	{% if this.setting('show_heading') %}
		<div class="nest_title">
			{% if this.setting('heading_tag') %}
				<{{this.setting('heading_tag')}}>
					{% if Nest_Heading_Href %}
						<a href="{{Nest_Heading_Href|e}}" {% if Nest_Heading_Target_Blank %} target="_blank" {% endif %}</a>
					{% endif %}
						{{this.setting('heading_text')|trans}}
					{% if Nest_Heading_Href %}
						</a>
					{% endif %}
				</{{this.setting('heading_tag')}}>
			{% else %}
				<h1>{{this.setting('heading_text')|trans}}</h1>
			{% endif %}
		</div>
	{% endif %}
	
	{% if Tabs %}
		{% if showTabs %}
			<div class="nest_tabs {% if nest_type == 'indicator' or nest_type == 'indicator_and_buttons' %} indicators {% endif %}">
				{% for Tab in Tabs %}
					{% if Tab.Visible and (Tab.Tab_Link or Tab.Tab_Name or not showTabNames) %}
						<ul>
							<li class="{{Tab.Class|e}}">
								<a {{Tab.Tab_Link}}>
									{% if Tab.Tab_Has_Image %}
										<span class="slide_image" id="{{Tab.Tab_Image_HTML_ID|e}}"></span>
									{% endif %}
									{% if showTabNames %}
										<span class="slide_label">{{Tab.Tab_Name}}</span>
									{% endif %}
								</a>
							</li>
						</ul>
					{% endif %}
				{% endfor %}
			</div>
		{% endif %}
		
		{% set Eggs_Equal_Height = this.setting('eggs_equal_height') %}
		
		<div class="nest_plugins_wrap">
			{% for Tab in Tabs %}
				{% if Tab.Plugins %}
					{% if Tab.Show_Back or Tab.Show_Refresh %}
						<div class="nest_buttons">
							{% if Tab.Show_Back %}
								{% if this.cCommandEnabled('back') %}
									<a
										class="nest_back nest_go_back"
										href="{{this.cBackLink()|escape}}"
										onclick="zenario_conductor.goBack('{{slotName|escape}}', {{this.setting('restore_scroll_pos')? 1 : 0}}); return false;"
									>
									<i class="fa fa-caret-left" aria-hidden="true"></i>
									{{this.phrase('Back')}}</a>
								{% endif %}
							{% endif %}
							
							{% if Tab.Show_Auto_Refresh %}
								<a
									class="nest_refresh auto_refresh"
									onclick="zenario_conductor.autoRefresh('{{slotName|escape}}', {{Tab.Auto_Refresh_Interval|escape}});"
								>
								<i class="fa fa-circle" aria-hidden="true"></i>
								{{this.phrase('Auto refresh')}}</a>
								<div class="stop_auto_refresh">
									<a
										class="nest_refresh"
										onclick="zenario_conductor.stopAutoRefresh('{{slotName|escape}}');"
									>
									<i class="fa fa-circle" aria-hidden="true"></i>
									{{this.phrase('Stop auto refreshing')}}</a>
									<p>{{this.phrase('Last Updated: [[updated]]', {updated: Tab.Last_Updated})}}</p>
								</div>
							{% endif %}
							{% if Tab.Show_Refresh %}
								<a
									class="nest_refresh"
									onclick="zenario.refreshSlot('{{slotName|escape}}');"
								>
								<i class="fa fa-refresh" aria-hidden="true"></i>
								{{this.phrase('Refresh')}}</a>
							{% endif %}
						</div>
					{% endif %}
					
					<div
						class="
							nest_plugins
							{% if Eggs_Equal_Height %}
								nest_equal_height setmychildren
							{% endif %}
							{{Tab.Slide_Class|escape}}
						"
						{% if Tab.Hidden %} style="display: none;" {% endif %}
					>
						{% set first = true %}
						{% for Plugin in Tab.Plugins %}
							{% do this.showPlugin(Plugin, true, first) %}
							{% set first = false %}
						{% endfor %}
					</div>
				{% endif %}
			{% endfor %}
		</div>
	{% endif %}
	
	{% if showButtons %}
		<a {{Prev_Link}} class="prev{{Prev_Disabled}}">
			<div>
				<span>{{this.phrase('&lt; Prev')}}</span>
			</div>
		</a>
		<div class="background_prev"></div>
		
		<a {{Next_Link}} class="next{{Next_Disabled}}">
			<div >
				<span>{{this.phrase('Next &gt;')}}</span>
			</div>
		</a>
		<div class="background_next"></div>
	{% endif %}
	
	
</div>
