{*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

{function generateCarousel hook_name = '' carousel = '' in_tabs = false}
	<div id="{$hook_name|escape:'html'}_{$carousel.carousel_type|escape:'html'}" class="{if $in_tabs}tab-pane{else}block{/if} {if $smarty.foreach.cit_details.first}active{/if}">
		{if !$in_tabs}
			<div class="col-xs-12">
				<h3 class="title_block carousel_title">{if isset($carousel.name)}{$carousel.name|escape:'html'}{/if}</h3>
			</div>
		{/if}
		<div class="multicarousel" data-settings="{$carousel.owl_settings|escape:'html'}">
			{foreach from=$carousel.items item=item}
				<div class="carousel_col">
					{foreach from=$item item=i key=k}
						{include file="./{$carousel.general_settings.resource_type}-details.tpl"
							item = $i
							link = $link
							show_price = $carousel.general_settings.show_price
							show_add_to_cart = $carousel.general_settings.show_add_to_cart
							show_view_more = $carousel.general_settings.show_view_more
							show_stickers = $carousel.general_settings.show_stickers
							image_type = $carousel.general_settings.image_type}
					{/foreach}
				</div>
			{/foreach}
		</div>
	</div>
{/function}

<!-- carousels grouped in tabs -->
{if $carousels_in_tabs|count > 0}
	<div class="multicarousels_in_tabs container">
		<ul id="{$hook_name|escape:'html'}_multicarousel_tabs" class="nav nav-tabs" data-tabs="tabs" role="tablist">
			{foreach from=$carousels_in_tabs item=carousel name=cit}
				<li class="{if $smarty.foreach.cit.first}active{/if} carousel_title">
					<a data-toggle="tab" href="#{$hook_name|escape:'html'}_{$carousel.carousel_type|escape:'html'}">{if isset($carousel.name)}{$carousel.name|escape:'html'}{/if}</a>
				</li>
			{/foreach}
		</ul>
		<div class="tab-content row">
		{foreach from=$carousels_in_tabs item=carousel name=cit_details}
			{generateCarousel hook_name = $hook_name carousel = $carousel in_tabs = true}	
		{/foreach}
		</div>
	</div>
{/if}

<!-- carousels out of tabs -->
{if $carousels_one_by_one|count > 0}
	<div class="multicarousels_one_by_one row">
		{foreach from=$carousels_one_by_one item = carousel}
			{generateCarousel hook_name = $hook_name carousel = $carousel}	
		{/foreach}
	</div>
{/if}