{{ header }} 
{% if (registry.has('theme_options') == constant('true')) %} 
	{% set theme_options = registry.get('theme_options') %}
	{% set config = registry.get('config') %}

	<!-- BREADCRUMB
		================================================== -->
	<div class="breadcrumb {% if (theme_options.get( 'breadcrumb_layout' ) == 1) %} {{ 'full-width' }} {% elseif (theme_options.get( 'breadcrumb_layout' ) == 4) %} {{ 'fixed3 fixed2' }} {% elseif (theme_options.get( 'breadcrumb_layout' ) == 3) %} {{ 'fixed2' }} {% else %} {{ 'fixed' }} {% endif %}">
		<div class="background-breadcrumb"></div>
		<div class="background" {% set breadcrumb = theme_options.getModules('breadcrumb') %} {% if ( breadcrumb|length > 0 ) %} {% for module in breadcrumb %} {{ module }} {% endfor %} {% endif %}>
			<div class="shadow"></div>
			<div class="pattern">
				<div class="container">
					<div class="clearfix">
					     {% if (product_page is defined and theme_options.get( 'product_breadcrumb' ) != '2') %} 
					     {% set product_prev_next = theme_options.getNextPrevProduct( product_id ) %} 
					          <div class="row">
					               <div class="col-md-3 hidden-xs hidden-sm">
					                    {% if (product_prev_next['prev'] is iterable) %} 
					                         {% if (theme_options.get( 'product_breadcrumb' ) == '1') %} 
	     				                    <div class="next-product-2 clearfix">
	     				                         <a href="{{ product_prev_next['prev']['href'] }}" data-toggle="tooltip" data-placement="top" title="{{ product_prev_next['prev']['name'] }}" class="button-previous-next">{% if (theme_options.get( 'previous_product_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'previous_product_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Previous product' }} {% endif %}</a>
	     				                    </div>
	     				                    {% else %} 
	     				                    <div class="next-product clearfix">
	     				                         <div class="image"><a href="{{ product_prev_next['prev']['href'] }}"><img src="{{ product_prev_next['prev']['thumb'] }}" alt="{{ product_prev_next['prev']['name'] }}"></a></div>
	     				                         <div class="right">
	     				                              <div class="name"><a href="{{ product_prev_next['prev']['href'] }}">{{ product_prev_next['prev']['name'] }}</a></div>
	     				                              <div class="price">{% if (product_prev_next['prev']['special']) %} {{ product_prev_next['prev']['special'] }} {% else %} {{ product_prev_next['prev']['price'] }} {% endif %}</div>
	     				                         </div>
	     				                    </div>
	     				                    {% endif %} 
					                    {% endif %} 
					               </div>
					               
					               <div class="col-md-6">
					               		{% for breadcrumb in breadcrumbs %} 
					               			{% set heading_title = breadcrumb['text'] %} 
					               		{% endfor %} 
					               		
					                    <h1 id="title-page">{{ heading_title }} 
					                    	{% if (weight is defined) %} {% if (weight) %} 
					                    	&nbsp;({{ weight }})
					                    	{% endif %} {% endif %} 
					                    </h1>
					                    
					                    <ul>
					                    	{% for breadcrumb in breadcrumbs %} 
					                    	<li><a href="{{ breadcrumb['href'] }}">{% if (breadcrumb['text'] != '<i class="fa fa-home"></i>') %} {{ breadcrumb['text'] }} {% else %} {% if (theme_options.get( 'home_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'home_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Home' }} {% endif %} {% endif %}</a></li>
					                    	{% endfor %} 
					                    </ul>
					               </div>
					               
	     					     <div class="col-md-3 hidden-xs hidden-sm">
	     					          {% if (product_prev_next['next'] is iterable) %} 
	          					          {% if (theme_options.get( 'product_breadcrumb' ) == '1') %} 
	          					          <div class="next-product-2 right clearfix">
	          					               <a href="{{ product_prev_next['next']['href'] }}" data-toggle="tooltip" data-placement="top" title="{{ product_prev_next['next']['name'] }}" class="button-previous-next">{% if (theme_options.get( 'next_product_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'next_product_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Next product' }} {% endif %}</a>
	          					          </div>
	          					          {% else %} 
	          					          <div class="next-product right clearfix">
	          					               <div class="image"><a href="{{ product_prev_next['next']['href'] }}"><img src="{{ product_prev_next['next']['thumb'] }}" alt="{{ product_prev_next['next']['name'] }}"></a></div>
	          					               <div class="right">
	          					                    <div class="name"><a href="{{ product_prev_next['next']['href'] }}">{{ product_prev_next['next']['name'] }}</a></div>
	          					                    <div class="price">{% if (product_prev_next['next']['special']) %} {{ product_prev_next['next']['special'] }} {% else %} {{ product_prev_next['next']['price'] }} {% endif %}</div>
	          					               </div>
	          					          </div>
	          					          {% endif %} 
	     					          {% endif %} 
	     					     </div>
	     					</div>
						{% else %} 
							 {% for breadcrumb in breadcrumbs %} 
							 	{% set heading_title = breadcrumb['text'] %} 
							 {% endfor %} 
							 
						     <h1 id="title-page">{{ heading_title }} 
						     	{% if (weight is defined) %} {% if (weight) %} 
						     	&nbsp;({{ weight }})
						     	{% endif %} {% endif %} 
						     </h1>
						     
						     <ul>
						     	{% for breadcrumb in breadcrumbs %} 
						     	<li><a href="{{ breadcrumb['href'] }}">{% if (breadcrumb['text'] != '<i class="fa fa-home"></i>') %} {{ breadcrumb['text'] }} {% else %} {% if (theme_options.get( 'home_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'home_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Home' }} {% endif %} {% endif %}</a></li>
						     	{% endfor %} 
						     </ul> 
						{% endif %} 
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- MAIN CONTENT
		================================================== -->
	<div class="main-content {% if (theme_options.get( 'content_layout' ) == 1) %} {{ 'full-width' }} {% elseif (theme_options.get( 'content_layout' ) == 4) %} {{ 'fixed3 fixed2' }} {% elseif (theme_options.get( 'content_layout' ) == 3) %} {{ 'fixed2' }} {% else %} {{ 'fixed' }} {% endif %} inner-page">
		<div class="background-content"></div>
		<div class="background">
			<div class="shadow"></div>
			<div class="pattern">
				<div class="container">
					
					{% set preface_left = theme_options.getModules('preface_left') %}
					{% set preface_right = theme_options.getModules('preface_right') %}
					
					{% if ( preface_left|length > 0 or preface_right|length > 0 ) %} 
					<div class="row">
						<div class="col-sm-9">
													{% if ( preface_left|length > 0 ) %}
								{% for module in preface_left %} 
									{{ module }}
								{% endfor %}
							{% endif %} 
						</div>
						
						<div class="col-sm-3">
													{% if ( preface_right|length > 0 ) %}
								{% for module in preface_right %} 
									{{ module }}
								{% endfor %}
							{% endif %} 
						</div>
					</div>
					{% endif %} 
					
					
					{% set preface_fullwidth = theme_options.getModules('preface_fullwidth') %}
					{% if ( preface_fullwidth|length > 0 ) %}
						{{ '<div class="row"><div class="col-sm-12">' }}
						{% for module in preface_fullwidth %} 
							{{ module }}
						{% endfor %}
						{{ '</div></div>' }}
					{% endif %} 
					
					<div class="row">
						{% set columnleft = theme_options.getModules('column_left') %}
						{% if ( columnleft|length > 0 ) %} 
						<div class="col-md-3" id="column-left">
							{% for module in columnleft %} 
								{{ module }}
							{% endfor %}
						</div>
						{% endif %} 
						
						{% set grid_center = 12 %} {% if ( columnleft|length > 0 ) %} {% set grid_center = 9 %} {% endif %} 
						<div class="col-md-{{ grid_center }}">
							
							{% set content_big_column = theme_options.getModules('content_big_column') %}
							{% if ( content_big_column|length > 0 ) %} 
								{% for module in content_big_column %} 
									{{ module }}
								{% endfor %}
							{% endif %} 
							
							
							{% set content_top = theme_options.getModules('content_top') %}
							{% if ( content_top|length > 0 ) %} 
								{% for module in content_top %} 
									{{ module }}
								{% endfor %}
							{% endif %} 
							
							<div class="row">
								
								{% set grid_content_top = 12 %} 
								{% set grid_content_right = 3 %}
								{% set column_right = theme_options.getModules('column_right') %} 
								{% if ( column_right|length > 0 ) %}
									{% if (grid_center == 9) %}
										{% set grid_content_top = 8 %}
										{% set grid_content_right = 4 %}
									{% else %} 
										{% set grid_content_top = 9 %}
										{% set grid_content_right = 3 %}
									{% endif %}
								{% endif %}
								
								<div class="col-md-{{ grid_content_top }} center-column {% if (background_status is defined) %} {{ 'content-without-background' }} {% else %} {{ 'content-with-background' }} {% endif %}" id="content">

									{% if (error_warning is defined and checkoutPage is not defined) %} 
										{% if (error_warning) %} 
										<div class="warning">
											<button type="button" class="close" data-dismiss="alert">&times;</button>
											{{ error_warning }} 
										</div>
										{% endif %} 
									{% endif %} 
									
									{% if (success is defined) %} 
										{% if (success) %} 
										<div class="success">
											<button type="button" class="close" data-dismiss="alert">&times;</button>
											{{ success }} 
										</div>
										{% endif %} 
									{% endif %}
{% endif %}

{% if (settings['comments_engine'] == 'FACEBOOK') %}
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
{% endif %} 

{% set theme_options = registry.get('theme_options') %}
{% set config = registry.get('config') %} 
{% set page_direction = theme_options.get( 'page_direction' ) %} 
{% set language_id = config.get( 'config_language_id' ) %}

{% if (article|length > 0) %}
<div class="post">
    <div class="post-entry">
        {% if (article['gallery']|length > 0) %}
            {% if (article['article_list_gallery_display'] == 'CLASSIC') %}
                <div class="post-media">
                    {{ article['gallery'][0]['output'] }}
                </div>
            {% endif %} 
            {% if (article['article_list_gallery_display'] == 'SLIDER') %}
                <div class="post-media">
                    <div class="media-slider">
                    {% for gallery in article['gallery'] %}
                        <div class="item">{{ gallery['output'] }}</div>
                    {% endfor %} 
                    </div>
                </div>
            {% endif %} 
        {% endif %} 

        <div class="post-content">
            {{ article['content']}}
        </div>
        
        <ul class="meta">
            {% if (author) %}
                <li>{{ text_posted_by }} : <a href="{{ author['href'] }}">{{ author['name'] }}</a></li>
            {% endif %} 
            <li>
                <span class="month">
                    {{ theme_options.date('M', theme_options.strtotime(article['date_published'])) }} 
                </span>
                <span class="day">
                    {{ theme_options.date('d', theme_options.strtotime(article['date_published'])) }},
                </span>
                <span class="day">
                    {{ theme_options.date('Y', theme_options.strtotime(article['date_published'])) }} 
                </span>
            </li>
            {% if (article['categories']|length > 0) %}
            {% set i = 0 %}
            <li class="post-categories">
                <span>{{ text_category }}: </span>
                {% for cat in article['categories'] %}
                {% set i = i + 1 %} 
                <a href="{{ cat['href'] }}">{{ cat['name'] }}</a>{% if (i < article['categories']|length) %}, {% endif %} 
                {% endfor %} 
            </li>
            {% endif %} 
            {% if (settings['comments_engine'] == 'LOCAL') %}
            <li>{{ text_comments}}: {{ article['comments_count']}}</li>
            {% endif %} 
        </ul>
        
        {% if (tags) %} 
        <div class="tags">
            {% set i = 0 %}{% for i in i..tags %} 
                <a href="{{ tags[i]['href'] }}">{{ tags[i]['tag'] }}</a>
            {% endfor %} 
        </div>
        {% endif %} 

        {% if (settings['author_description'] == 1) %}
          {% if (author|length > 0) %}
          <div class="blog-post-author">
              <div class="media">
                  {% if (author['thumb'] is defined) %}
                  <a href="{{ author['href'] }}" class="photo">
                      <img src="{{ author['thumb'] }}" alt="{{ author['name'] }}">
                  </a>
                  {% endif %} 
                  <div class="media-body">
                      <h4 class="media-heading"><a href="{{ author['href'] }}">{{ author['name'] }}</a></h4>
                      <div class="desc">{{ author['description'] }}</div>
                  </div>
              </div>
          </div>
          {% endif %} 
        {% endif %}  
        
     {% if (articles|length > 0 and settings['article_related_status'] == 1) %} 
      {% include 'odesk/template/blog/article_related/' ~ settings['article_related_template']|replace({'.tpl': '.twig'}) %} 
     {% endif %}  
     
     
     {% if (products|length > 0 and settings['product_related_status'] == 1) %} 
       
         {% set class = 3 %}
         {% set id = random(5000)*random(50000) %} 
         {% set all = 4 %} 
         {% set row = 4 %} 
         
         {% if (settings['product_related_per_row'] == 6) %} {% set class = 2 %} {% endif %}
         {% if (settings['product_related_per_row'] == 5) %} {% set class = 25 %} {% endif %}
         {% if (settings['product_related_per_row'] == 3) %} {% set class = 4 %} {% endif %}
         
         {% if (settings['product_related_per_row'] > 1) %}
           {% set row = settings['product_related_per_row'] %}
           {% set all = settings['product_related_per_row'] %}
         {% endif %} 
   
         <div class="box clearfix box-no-advanced box-with-products {% if (settings['product_scroll_related'] == 1) %} {{ 'with-scroll' }} {% endif %}">
           {% if (settings['product_scroll_related'] == 1) %} 
           <!-- Carousel nav -->
           <a class="next" href="#myCarousel{{ id }}" id="myCarousel{{ id }}_next"><span></span></a>
           <a class="prev" href="#myCarousel{{ id }}" id="myCarousel{{ id }}_prev"><span></span></a>
           {% endif %} 
          
           <div class="box-heading">{{ text_related_products }}</div>
           <div class="clear"></div>
           <div class="box-content products related-products">
             <div class="box-product">
              <div id="myCarousel{{ id }}" {% if (settings['product_scroll_related'] == 1) %}class="carousel slide"{% endif %}>
                <!-- Carousel items -->
                <div class="carousel-inner">
                  {% set i = 0 %} {% set row_fluid = 0 %} {% set item = 0 %} {% for product in products %} {% set row_fluid = row_fluid + 1 %} 
                    {% if (i == 0) %} {% set item = item + 1 %} {{ '<div class="active item"><div class="product-grid"><div class="row">' }} {% endif %} 
                    {% set r=row_fluid-(row_fluid/all)|round(0, 'floor')*all %} {% if (row_fluid>all and r == 1) %} {% if (settings['product_scroll_related'] == 1) %} {{ '</div></div></div><div class="item"><div class="product-grid"><div class="row">' }} {% set item = item + 1 %} {% else %} {{ '</div><div class="row">' }} {% endif %} {% else %} {% set r=row_fluid-(row_fluid/row)|round(0, 'floor')*row %} {% if (row_fluid>row and r == 1) %} {{ '</div><div class="row">' }} {% endif %} {% endif %} 
                    <div class="col-sm-{{ class }} col-xs-6">
                      {% set theme_options = registry.get('theme_options') %}
{% set config = registry.get('config') %}

<!-- Product -->
<div class="product clearfix product-hover">
	<div class="left">
		{% if (product['thumb']) %} 
			{% if (product['special'] and theme_options.get( 'display_text_sale' ) != '0') %} 
				{% set text_sale = 'Sale' %}
				{% if (theme_options.get( 'sale_text', config.get( 'config_language_id' ) ) != '') %}
					{% set text_sale = theme_options.get( 'sale_text', config.get( 'config_language_id' ) ) %}
				{% endif %} 

				{% if (theme_options.get( 'type_sale' ) == '1') %} 
					{% set product_detail = theme_options.getDataProduct( product['product_id'] ) %}
					{% set roznica_ceny = product_detail['price']-product_detail['special'] %}
					{% set procent = roznica_ceny*100/product_detail['price'] %} 
					<div class="sale">-{{ procent|round }}%</div>
				{% else %} 
					<div class="sale">{{ text_sale }}</div>
				{% endif %}
				
			 {% elseif (theme_options.get( 'display_text_new' ) != '0' and theme_options.isLatestProduct( product['product_id'] )) %} 
				 <div class="new">{% if (theme_options.get( 'new_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'new_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'New' }} {% endif %}</div>
			 {% endif %} 
			
			<div class="image {% if (theme_options.get( 'product_image_effect' ) == '1') %} {{ 'image-swap-effect' }} {% endif %}">
				<a href="{{ product['href'] }}">
					{% if (theme_options.get( 'product_image_effect' ) == '1') %}
						{% set nthumb = product['thumb']|replace({' ': "%20"}) %}
						{% set adres = constant('HTTP_SERVER') %}
						{% set nthumb = nthumb|replace({adres: ""}) %}
						{% set image_size = theme_options.getimagesize(nthumb) %}
						{% set image_swap = theme_options.productImageSwap(product['product_id'], image_size[0], image_size[1]) %}
						{% if (image_swap != '') %} {{ '<img src="' ~ image_swap ~ '" alt="' ~ product['name'] ~ '" class="swap-image" />' }}{% endif %}
					{% endif %} 
					
					{% if (theme_options.get( 'lazy_loading_images' ) != '0') %} 
					<img src="image/catalog/blank.gif" data-echo="{{ product['thumb'] }}" alt="{{ product['name'] }}" class="{% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'zoom-image-effect' }} {% endif %}" />
					{% else %} 
					<img src="{{ product['thumb'] }}" alt="{{ product['name'] }}" class="{% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'zoom-image-effect' }} {% endif %}" />
					{% endif %} 
				</a>
			</div>
		{% else %} 
			<div class="image">
				<a href="{{ product['href'] }}"><img src="image/no_image.jpg" alt="{{ product['name'] }}" {% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'class="zoom-image-effect"' }} {% endif %} /></a>
			</div>
		{% endif %} 
		
		{% if (theme_options.get( 'display_specials_countdown' ) == '1' and product['special']) %} 
			{% set countdown = random(5000) * random(50000) %} 
		 {% set product_detail = theme_options.getDataProduct( product['product_id'] ) %}
		 {% set date_end = product_detail['date_end'] %}
		 {% if (date_end != '0000-00-00' and date_end) %} 
               		<script>
               		$(function () {
               			var austDay = new Date();
               			austDay = new Date({{ theme_options.date("Y", theme_options.strtotime(date_end)) }}, {{ theme_options.date("m", theme_options.strtotime(date_end)) }} - 1, {{ theme_options.date("d", theme_options.strtotime(date_end)) }});
               			$('#countdown{{ countdown }}').countdown({until: austDay});
               		});
               		</script>
               		<div id="countdown{{ countdown }}" class="clearfix"></div>
     		     {% endif %} 
		{% endif %}  
	</div>
	<div class="right">
		<div class="name"><a href="{{ product['href'] }}">{{ product['name'] }}</a></div>
		{% if (theme_options.get( 'product_grid_type' ) == '7') %} 
			{% set product_detail = theme_options.getDataProduct( product['product_id'] ) %} 
			<div class="brand">{{ product_detail['manufacturer'] }}</div>
		{% endif %} 
		
		{% if (product['price']) %} 
		<div class="price">
			{% if (not product['special']) %} 
			{{ product['price'] }} 
			{% else %} 
			<span class="price-old">{{ product['price'] }}</span> <span class="price-new">{{ product['special'] }}</span>
			{% endif %} 
		</div>
		{% endif %} 
		
		
		{% if (theme_options.get( 'display_add_to_compare' ) != '0' or theme_options.get( 'display_add_to_wishlist' ) != '0' or theme_options.get( 'display_add_to_cart' ) != '0') %} 
		<div class="only-hover">
		     <ul>
		          {% if (theme_options.get( 'display_add_to_cart' ) != '0') %} 
		               {% set enquiry = constant('false') %} 
		               	{% if (config.get( 'product_blocks_module' ) != '') %} {% set enquiry = theme_options.productIsEnquiry(product['product_id']) %} {% endif %}
		 				{% if (enquiry is iterable) %} 
		               		<li><a href="javascript:openPopup('{{ enquiry['popup_module'] }}', '{{ product['product_id'] }}')" data-toggle="tooltip" data-original-title="{{ enquiry['block_name'] }}"><i class="fa fa-question"></i></a></li>
		               {% else %} 
		               		<li><a onclick="cart.add('{{ product['product_id'] }}');" data-toggle="tooltip" data-original-title="{{ button_cart }}"><i class="fa fa-shopping-cart"></i></a></li>
		               {% endif %} 
		          {% endif %} 
		          
		          {% if (theme_options.get( 'quick_view' ) == 1) %} 
		          <li class="quickview"><a href="index.php?route=product/quickview&amp;product_id={{ product['product_id'] }}" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'quickview_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.html_entity_decode(theme_options.get( 'quickview_text', config.get( 'config_language_id' ) )) }} {% else %} {{ 'Quickview' }} {% endif %}"><i class="fa fa-search"></i></a></li>
		          {% endif %} 
		     
				{% if (theme_options.get( 'display_add_to_compare' ) != '0') %} 
				<li><a onclick="compare.add('{{ product['product_id'] }}');" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'add_to_compare_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'add_to_compare_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Add to compare' }} {% endif %}"><i class="fa fa-exchange"></i></a></li>
				{% endif %} 
				
				{% if (theme_options.get( 'display_add_to_wishlist' ) != '0') %} 
				<li><a onclick="wishlist.add('{{ product['product_id'] }}');" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'add_to_wishlist_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'add_to_wishlist_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Add to wishlist' }} {% endif %}"><i class="fa fa-heart"></i></a></li>
				{% endif %} 
			</ul>
		</div>
		{% endif %} 
		
	</div>
</div>
                    </div>
                  {% set i = i + 1 %} {% endfor %} 
                  {% if (i > 0) %} {{ '</div></div></div>' }} {% endif %} 
                </div>
            </div>
             </div>
           </div>
         </div>
     {% endif %}   
       
       {% if (settings['product_scroll_related'] == 1) %} 
         <script type="text/javascript">
         $(document).ready(function() {
           var owl{{ id }} = $(".box #myCarousel{{ id }} .carousel-inner");
          
           $("#myCarousel{{ id }}_next").click(function(){
               owl{{ id }}.trigger('owl.next');
               return false;
             })
           $("#myCarousel{{ id }}_prev").click(function(){
               owl{{ id }}.trigger('owl.prev');
               return false;
           });
             
           owl{{ id }}.owlCarousel({
              slideSpeed : 500,
               singleItem:true,
               {% if (page_direction[language_id] == 'RTL') %} 
               direction: 'rtl'
               {% endif %} 
            });
         });
         </script>
       {% endif %} 
        
        {% if (article['status_comments']) %} 
          {% if (settings['comments_engine'] == 'LOCAL') %}

              <div class="box box-no-advanced comments">
                   <div class="box-heading">{{ text_comments }}: {{ article['comments_count'] }}</div>
                   <div class="box-content">
                        {% if (comments|length > 0) %}
                        <div class="comments-list">
                            {% for comment in comments %}
                            <div class="author"><span class="name">{{ comment['name'] }}</span> <span class="date">{{ theme_options.date('d-m-Y H:i', theme_options.strtotime(comment['date_added'])) }}</span></div>
                                <div class="text">
                                    {{ comment['content'] }} 
                                </div>
                            {% endfor %} 
                        </div> 
                        {% else %} 
                        <p>{{ text_no_comments }}</p>
                        {% endif %} 
                   </div>
              </div>
              
              <div class="box box-no-advanced leave-reply" id="reply-block">
                   <div class="box-heading">{{ text_leave_reply }}</div>
                   <div class="box-content">
                         <p style="padding-top: 5px">{{ text_required_info }}<abbr class="required">*</abbr> </p>
         
                         <form class="form-horizontal" method="post" id="form-comment">
                             <div class="form-group required">
                                 <div class="col-xs-12 col-sm-6">
                                     <label class="control-label" for="input-name">{{ text_name }}</label>
                                     <input type="text" name="name" value="" id="input-name" class="form-control">
                                 </div>
                                 <div class="col-xs-12 col-sm-6">
                                     <label class="control-label" for="input-email">{{ text_email }}</label>
                                     <input type="text" name="email" value="" id="input-email" class="form-control">
                                 </div>
                             </div>
                             <div class="form-group required">
                                 <div class="col-xs-12">
                                     <label class="control-label" for="input-content">{{ text_content }}</label>
                                     <textarea rows="10" id="input-content" name="content" class="form-control"></textarea>
                                 </div>
                             </div>
         
                             <div class="text-center">
                                  <button class="button button-large button-comment" id="button-comment" type="submit">{{ button_post_comment }}</button>
                             </div>
                         </form>
                   </div>
                   
              </div>
              {% endif %} 

              {% if (settings['comments_engine'] == 'DISQUS') %}
                <div style="height: 40px"></div>
                <div id="disqus_thread"></div>
                <script type="text/javascript">
                    /* * * CONFIGURATION VARIABLES * * */
                    var disqus_shortname = '{{ settings['disqus_name'] }}';

                    /* * * DON'T EDIT BELOW THIS LINE * * */
                    (function() {
                        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
                        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
                        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
                    })();
                </script>
                <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
              {% endif %} 

              {% if (settings['comments_engine'] == 'FACEBOOK') %}
                   <div style="height: 40px"></div>
                  <div class="fb-comments" data-href="{{ theme_options.facebook() }}" data-width="100%"></div>
              {% endif %} 
          {% endif %}
    </div>            
</div>

<script>
    $(function(){
        $('.media-slider').owlCarousel({
            navigation : true, // Show next and prev buttons
            slideSpeed : 300,
            paginationSpeed : 400,
            singleItem:true,
            pagination: true,
            autoHeight : true,
            lazyLoad: true,
            navigationText: false,
            {% if (page_direction[language_id] == 'RTL') %} 
            direction: 'rtl'
            {% endif %} 
        })
        
        $('#button-comment').on('click', function(e) {
            e.preventDefault();
            $.ajax({
                url: 'index.php?route=blog/article/write&article_id={{ article_id }}',
                type: 'post',
                dataType: 'json',
                data: $("#form-comment").serialize(),
                beforeSend: function() {
                    $('#button-comment').button('loading');
                },
                complete: function() {
                    $('#button-comment').button('reset');
                },
                success: function(json) {
                    $('.alert-success, .alert-danger').remove();

                    if (json['error']) {
                        $('.leave-reply .box-content > *:first-child').before('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
                    }

                    if (json['success']) {
                        $('.leave-reply .box-content > *:first-child').before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');

                        $('input[name=\'name\']').val('');
                        $('input[name=\'email\']').val('');
                        $('textarea[name=\'content\']').val('');
                    }
                }
            });
        });
    });
</script>

{% endif %}

{% if (registry.has('theme_options') == constant('true')) %} 
	{% set theme_options = registry.get('theme_options') %}
	{% set config = registry.get('config') %}

	{% set columnleft = theme_options.getModules('column_left') %}
	{% set grid_center = 12 %} 
	{% if ( columnleft|length > 0 ) %} 
		{% set grid_center = 9 %} 
	{% endif %} 

	{% set grid_content_right = 3 %}
	{% set column_right = theme_options.getModules('column_right') %} 
	{% if ( column_right|length > 0 ) %}
		{% if (grid_center == 9) %}
			{% set grid_content_right = 4 %}
		{% else %} 
			{% set grid_content_right = 3 %}
		{% endif %}
	{% endif %}

							</div>
							
							{% if ( column_right|length > 0 ) %} 
							<div class="col-md-{{ grid_content_right }}" id="column-right">
								{% for module in column_right %} 
									{{ module }}
								{% endfor %} 
							</div>
							{% endif %} 
						</div>
						
						{% if (products is defined and product_page is defined) %} {% if (products and theme_options.get( 'product_related_status' ) != '0') %} 
							
							{% set class = 3 %} 
							{% set id = random(5000)*random(500000) %} 
							{% set all = 4 %} 
							{% set row = 4 %} 
							
							{% if (theme_options.get( 'product_per_pow' ) == 6) %} {% set class = 2 %} {% endif %}
							{% if (theme_options.get( 'product_per_pow' ) == 5) %} {% set class = 25 %} {% endif %}
							{% if (theme_options.get( 'product_per_pow' ) == 3) %} {% set class = 4 %} {% endif %}
							
							{% if (theme_options.get( 'product_per_pow' ) > 1) %} {% set row = theme_options.get( 'product_per_pow' ) %} {% set all = theme_options.get( 'product_per_pow' ) %} {% endif %} 
							
							<div class="box clearfix box-with-products box-no-advanced {% if (theme_options.get( 'product_scroll_related' ) != '0') %} {{ 'with-scroll' }} {% endif %}">
							  {% if (theme_options.get( 'product_scroll_related' ) != '0') %} 
							  <!-- Carousel nav -->
							  <a class="next" href="#myCarousel{{ id }}" id="myCarousel{{ id }}_next"><span></span></a>
							  <a class="prev" href="#myCarousel{{ id }}" id="myCarousel{{ id }}_prev"><span></span></a>
							  {% endif %} 
								
							  <div class="box-heading">{{ text_related }}</div>
							  <div class="strip-line"></div>
							  <div class="clear"></div>
							  <div class="box-content products related-products">
							    <div class="box-product">
							    	<div id="myCarousel{{ id }}" {% if (theme_options.get( 'product_scroll_related' ) != '0') %}class="carousel slide"{% endif %}>
							    		<!-- Carousel items -->
							    		<div class="carousel-inner">
							    			{% set i = 0 %} {% set row_fluid = 0 %} {% set item = 0 %} {% for product in products %} {% set row_fluid = row_fluid + 1 %} 
								    			{% if (i == 0) %} {% set item = item + 1 %} {{ '<div class="active item"><div class="product-grid"><div class="row">' }} {% endif %} 
								    			{% set r=row_fluid-(row_fluid/all)|round(0, 'floor')*all %} {% if (row_fluid>all and r == 1) %} {% if (theme_options.get( 'product_scroll_related' ) != '0') %} {{ '</div></div></div><div class="item"><div class="product-grid"><div class="row">' }} {% set item = item + 1 %} {% else %} {{ '</div><div class="row">' }} {% endif %} {% else %} {% set r=row_fluid-(row_fluid/row)|round(0, 'floor')*row %} {% if (row_fluid>row and r == 1) %} {{ '</div><div class="row">' }} {% endif %} {% endif %} 
								    			<div class="col-sm-{{ class }} col-xs-6">
								    				{% set theme_options = registry.get('theme_options') %}
{% set config = registry.get('config') %}

<!-- Product -->
<div class="product clearfix product-hover">
	<div class="left">
		{% if (product['thumb']) %} 
			{% if (product['special'] and theme_options.get( 'display_text_sale' ) != '0') %} 
				{% set text_sale = 'Sale' %}
				{% if (theme_options.get( 'sale_text', config.get( 'config_language_id' ) ) != '') %}
					{% set text_sale = theme_options.get( 'sale_text', config.get( 'config_language_id' ) ) %}
				{% endif %} 

				{% if (theme_options.get( 'type_sale' ) == '1') %} 
					{% set product_detail = theme_options.getDataProduct( product['product_id'] ) %}
					{% set roznica_ceny = product_detail['price']-product_detail['special'] %}
					{% set procent = roznica_ceny*100/product_detail['price'] %} 
					<div class="sale">-{{ procent|round }}%</div>
				{% else %} 
					<div class="sale">{{ text_sale }}</div>
				{% endif %}
				
			 {% elseif (theme_options.get( 'display_text_new' ) != '0' and theme_options.isLatestProduct( product['product_id'] )) %} 
				 <div class="new">{% if (theme_options.get( 'new_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'new_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'New' }} {% endif %}</div>
			 {% endif %} 
			
			<div class="image {% if (theme_options.get( 'product_image_effect' ) == '1') %} {{ 'image-swap-effect' }} {% endif %}">
				<a href="{{ product['href'] }}">
					{% if (theme_options.get( 'product_image_effect' ) == '1') %}
						{% set nthumb = product['thumb']|replace({' ': "%20"}) %}
						{% set adres = constant('HTTP_SERVER') %}
						{% set nthumb = nthumb|replace({adres: ""}) %}
						{% set image_size = theme_options.getimagesize(nthumb) %}
						{% set image_swap = theme_options.productImageSwap(product['product_id'], image_size[0], image_size[1]) %}
						{% if (image_swap != '') %} {{ '<img src="' ~ image_swap ~ '" alt="' ~ product['name'] ~ '" class="swap-image" />' }}{% endif %}
					{% endif %} 
					
					{% if (theme_options.get( 'lazy_loading_images' ) != '0') %} 
					<img src="image/catalog/blank.gif" data-echo="{{ product['thumb'] }}" alt="{{ product['name'] }}" class="{% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'zoom-image-effect' }} {% endif %}" />
					{% else %} 
					<img src="{{ product['thumb'] }}" alt="{{ product['name'] }}" class="{% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'zoom-image-effect' }} {% endif %}" />
					{% endif %} 
				</a>
			</div>
		{% else %} 
			<div class="image">
				<a href="{{ product['href'] }}"><img src="image/no_image.jpg" alt="{{ product['name'] }}" {% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'class="zoom-image-effect"' }} {% endif %} /></a>
			</div>
		{% endif %} 
		
		{% if (theme_options.get( 'display_specials_countdown' ) == '1' and product['special']) %} 
			{% set countdown = random(5000) * random(50000) %} 
		 {% set product_detail = theme_options.getDataProduct( product['product_id'] ) %}
		 {% set date_end = product_detail['date_end'] %}
		 {% if (date_end != '0000-00-00' and date_end) %} 
               		<script>
               		$(function () {
               			var austDay = new Date();
               			austDay = new Date({{ theme_options.date("Y", theme_options.strtotime(date_end)) }}, {{ theme_options.date("m", theme_options.strtotime(date_end)) }} - 1, {{ theme_options.date("d", theme_options.strtotime(date_end)) }});
               			$('#countdown{{ countdown }}').countdown({until: austDay});
               		});
               		</script>
               		<div id="countdown{{ countdown }}" class="clearfix"></div>
     		     {% endif %} 
		{% endif %}  
	</div>
	<div class="right">
		<div class="name"><a href="{{ product['href'] }}">{{ product['name'] }}</a></div>
		{% if (theme_options.get( 'product_grid_type' ) == '7') %} 
			{% set product_detail = theme_options.getDataProduct( product['product_id'] ) %} 
			<div class="brand">{{ product_detail['manufacturer'] }}</div>
		{% endif %} 
		
		{% if (product['price']) %} 
		<div class="price">
			{% if (not product['special']) %} 
			{{ product['price'] }} 
			{% else %} 
			<span class="price-old">{{ product['price'] }}</span> <span class="price-new">{{ product['special'] }}</span>
			{% endif %} 
		</div>
		{% endif %} 
		
		
		{% if (theme_options.get( 'display_add_to_compare' ) != '0' or theme_options.get( 'display_add_to_wishlist' ) != '0' or theme_options.get( 'display_add_to_cart' ) != '0') %} 
		<div class="only-hover">
		     <ul>
		          {% if (theme_options.get( 'display_add_to_cart' ) != '0') %} 
		               {% set enquiry = constant('false') %} 
		               	{% if (config.get( 'product_blocks_module' ) != '') %} {% set enquiry = theme_options.productIsEnquiry(product['product_id']) %} {% endif %}
		 				{% if (enquiry is iterable) %} 
		               		<li><a href="javascript:openPopup('{{ enquiry['popup_module'] }}', '{{ product['product_id'] }}')" data-toggle="tooltip" data-original-title="{{ enquiry['block_name'] }}"><i class="fa fa-question"></i></a></li>
		               {% else %} 
		               		<li><a onclick="cart.add('{{ product['product_id'] }}');" data-toggle="tooltip" data-original-title="{{ button_cart }}"><i class="fa fa-shopping-cart"></i></a></li>
		               {% endif %} 
		          {% endif %} 
		          
		          {% if (theme_options.get( 'quick_view' ) == 1) %} 
		          <li class="quickview"><a href="index.php?route=product/quickview&amp;product_id={{ product['product_id'] }}" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'quickview_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.html_entity_decode(theme_options.get( 'quickview_text', config.get( 'config_language_id' ) )) }} {% else %} {{ 'Quickview' }} {% endif %}"><i class="fa fa-search"></i></a></li>
		          {% endif %} 
		     
				{% if (theme_options.get( 'display_add_to_compare' ) != '0') %} 
				<li><a onclick="compare.add('{{ product['product_id'] }}');" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'add_to_compare_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'add_to_compare_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Add to compare' }} {% endif %}"><i class="fa fa-exchange"></i></a></li>
				{% endif %} 
				
				{% if (theme_options.get( 'display_add_to_wishlist' ) != '0') %} 
				<li><a onclick="wishlist.add('{{ product['product_id'] }}');" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'add_to_wishlist_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'add_to_wishlist_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Add to wishlist' }} {% endif %}"><i class="fa fa-heart"></i></a></li>
				{% endif %} 
			</ul>
		</div>
		{% endif %} 
		
	</div>
</div>
								    			</div>
							    			{% set i = i + 1 %} {% endfor %} 
							    			{% if (i > 0) %} {{ '</div></div></div>' }} {% endif %} 
							    		</div>
								  </div>
							    </div>
							  </div>
							</div>
							
							{% if (theme_options.get( 'product_scroll_related' ) != '0') %} 
							<script type="text/javascript">
							$(document).ready(function() {
							  var owl{{ id }} = $(".box #myCarousel{{ id }} .carousel-inner");
								
							  $("#myCarousel{{ id }}_next").click(function(){
							      owl{{ id }}.trigger('owl.next');
							      return false;
							    })
							  $("#myCarousel{{ id }}_prev").click(function(){
							      owl{{ id }}.trigger('owl.prev');
							      return false;
							  });
							    
							  owl{{ id }}.owlCarousel({
							  	  slideSpeed : 500,
							      singleItem:true
							   });
							});
							</script>
							{% endif %} 
						{% endif %}{% endif %} 
					</div>
				</div>
				
				<div class="row">	
					<div class="col-sm-12">	
						
						{% set contentbottom = theme_options.getModules('content_bottom') %}
						{% if ( contentbottom|length > 0 ) %} 
														{% for module in contentbottom %} 
								{{ module }}
							{% endfor %}
							
						{% endif %} 
					</div>
				</div>
			</div>
		</div>
	</div>				  
</div>
{% endif %}
{{ footer }}