{{ header }}

<div id="product-product" class="container full-width-container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
    <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
  
  {% if prev_prod_name %}
  <div class="prev">
        <div class="prev-img">
        <a href="{{ prev_prod_url }}" class="prev-img-link" title="{{ prev_prod_name }}">
        <img src="{{ prev_prod_thumb }}" alt="{{ prev_prod_name }}">
        <div class="prev-name">{{ prev_prod_name }}</div>
        </a>
        </div>
        <div class="prev-arrow">
        <a href="{{ prev_prod_url }}" title="{{ prev_prod_name }}" class="prev-arrow-link">
        {{ t1o_text_previous_product[lang_id] }}
        </a>
        </div> 
  </div>
  {% endif %}
  {% if next_prod_name %}
  <div class="next">
        <div class="next-img">
        <a href="{{ next_prod_url }}" class="next-img-link" title="{{ next_prod_name }}">
        <img src="{{ next_prod_thumb }}" alt="{{ next_prod_name }}">
        <div class="next-name">{{ next_prod_name }}</div>
        </a> 
        </div>
        <div class="next-arrow">
        <a href="{{ next_prod_url }}" title="{{ next_prod_name }}" class="next-arrow-link">
        {{ t1o_text_next_product[lang_id] }}
        </a>
        </div>
  </div>
  {% endif %}
  
  <div class="row">{{ column_left }}
    {% if column_left and column_right %}
    {% set class = 'col-sm-6' %}
    {% elseif column_left or column_right %}
    {% set class = 'col-sm-9' %}
    {% else %}
    {% set class = 'col-sm-12' %}
    {% endif %}
    
    <div id="content" class="{{ class }} product-page">{{ content_top }}
    
    {% if t1o_product_name_position == 1 %}
    <h1>{{ heading_title }}</h1>
    <ul class="list-unstyled pf pf-top">
       <li>{{ text_stock }} <span class="stock">{{ stock }}</span></li>
       {% if manufacturer %}
       <li>{{ text_manufacturer }} <a href="{{ manufacturers }}">{{ manufacturer }}</a></li>
       {% endif %}
       <li>{{ text_model }} <span>{{ model }}</span></li>
       {% if reward %}
       <li>{{ text_reward }} <span>{{ reward }}</span></li>
       {% endif %}
       {% if t1o_product_viewed_status == 1 %}
       <li>{{ t1o_text_product_viewed[lang_id] }} <span>{{ product_info.viewed }}</span></li>
      {% endif %}
    </ul>
    {% endif %}  
    
      <div class="row">
      
        {% if t1o_layout_product_page == 1 %}<div class="col-sm-6 product-left">{% endif %}
        {% if t1o_layout_product_page == 2 %}<div class="col-sm-4 product-left">{% endif %}
        {% if t1o_layout_product_page == 3 %}<div class="col-sm-7 product-left">{% endif %}
        {% if t1o_layout_product_page == 4 %}<div class="col-sm-12 product-left">{% endif %}
        {% if t1o_layout_product_page == 5 %}<div class="col-sm-4 product-left">{% endif %}
        {% if t1o_layout_product_page == 6 %}<div class="col-sm-3 product-left">{% endif %}
        {% if t1o_layout_product_page == 7 %}<div class="col-sm-5 product-left">{% endif %}
        {% if t1o_layout_product_page == 8 %}<div class="col-sm-7 product-left">{% endif %}
        {% if t1o_layout_product_page == 9 %}<div class="col-sm-6 product-left">{% endif %}
        {% if t1o_layout_product_page == 10 %}<div class="col-sm-5 product-left">{% endif %}
        {% if t1o_layout_product_page == 11 %}<div class="col-sm-6 product-left">{% endif %}
        {% if t1o_layout_product_page == 12 %}<div class="col-sm-5 product-left">{% endif %}
        {% if t1o_layout_product_page == 13 %}<div class="col-sm-4 product-left">{% endif %}

          {% if thumb or images %}
         
          {% if t1o_layout_product_page == 1 or t1o_layout_product_page == 2 or t1o_layout_product_page == 3 or t1o_layout_product_page == 4 or t1o_layout_product_page == 5 or t1o_layout_product_page == 6 or t1o_layout_product_page == 7 or t1o_layout_product_page == 11 or t1o_layout_product_page == 12 or t1o_layout_product_page == 13 %}
          <ul class="thumbnails">
            {% if thumb %}
            <li class="image-main">
            
            <span class="badge-wrapper">
            
            {% if t1o_sale_badge_status == 1 %}	
            {% if special and t1o_sale_badge_type == 0 %}
            <span class="badge sale">{{ t1o_text_sale[lang_id] }}</span>
            {% endif %} 
            {% if special and t1o_sale_badge_type == 1 %}            
            {% set res = (val1 / val2) * 100 %}
            {% set res = 100 - res %}
            <span class="badge sale">-{{ res|round(0, 'common') }}%</span>
            {% endif %}
            {% endif %}
      
            {% if t1o_new_badge_status == 1 %}	
            {% set days = (endDate2|round(0, 'common') / 86400) - (startDate1|round(0, 'common') /86400) %}
            {% set newproductdays = 30 %}
            {% if days < newproductdays %}
            <span class="badge new">{{ t1o_text_new_prod[lang_id] }}</span>
            {% endif %}
            {% endif %}
            
            </span>
              
            <a class="cloud-zoom thumbnail" href="{{ popup }}" title="{{ heading_title }}" id='zoom1' rel="position:'inside', adjustX: 15, adjustY: 0, tint:'#ffffff', tintOpacity:0.1, smoothMove:3, showTitle:false">
            <img src="{{ thumb }}" title="{{ heading_title }}" alt="{{ heading_title }}" class="img-responsive img-{{ t1d_img_style }}" id="image" />
            </a>
            </li>
            {% endif %}
          </ul>
          <div class="row">
          <ul class="image-additional-wrapper thumbnails">
            {% if images %}
            <li class="image-additional col-sm-12">
            <div>
            <a href='{{ popup }}' title='{{ heading_title }}' class='cloud-zoom-gallery' rel="useZoom: 'zoom1', smallImage: '{{ thumb }}' ">
            <img src="{{ thumb }}" title="{{ heading_title }}" alt="{{ heading_title }}" class="img-responsive img-{{ t1d_img_style }}" />
            </a>
            </div>  
            </li>
            {% for image in images %}
            <li class="image-additional col-sm-12">
            <div>
            <a class="cloud-zoom-gallery" href="{{ image.popup }}" title="{{ heading_title }}" rel="useZoom: 'zoom1', smallImage: '{{ image.thumb }}' ">
            <img src="{{ image.thumb }}" title="{{ heading_title }}" alt="{{ heading_title }}" class="img-responsive img-{{ t1d_img_style }}" />
            </a>
            </div>
            </li>
            {% endfor %}
            {% endif %}
          </ul>
          </div>       
<script type="text/javascript"><!--
$('.image-additional-wrapper').owlCarousel({
	items: {{ t1o_additional_images }},
	itemsMobile: [479,2],
	singleItem: false,
	scrollPerPage: false,
	pagination: false,
	navigation: true,
	navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>']
});
--></script>

          {% else %} 
          
          <ul class="thumbnails">      
            <div class="col-xs-2">         
            {% if images %}
            <li class="image-additional col-sm-12">
            <a href='{{ popup }}' title='{{ heading_title }}' class='cloud-zoom-gallery' rel="useZoom: 'zoom1', smallImage: '{{ thumb }}' ">
            <img src="{{ thumb }}" title="{{ heading_title }}" alt="{{ heading_title }}" class="img-responsive img-{{ t1d_img_style }}" /></a>  
            </li>
            {% for image in images %}
            <li class="image-additional col-sm-12">
            <a class="cloud-zoom-gallery" href="{{ image.popup }}" title="{{ heading_title }}" rel="useZoom: 'zoom1', smallImage: '{{ image.thumb }}' ">
            <img src="{{ image.thumb }}" title="{{ heading_title }}" alt="{{ heading_title }}" class="img-responsive img-{{ t1d_img_style }}" />
            </a>
            </li>
            {% endfor %}
            {% endif %}
            </div>
            <div class="col-xs-10">
            {% if thumb %}
            <li class="image-main">
            
            <span class="badge-wrapper">
            
            {% if t1o_sale_badge_status == 1 %}	
            {% if special and t1o_sale_badge_type == 0 %}
            <span class="badge sale">{{ t1o_text_sale[lang_id] }}</span>
            {% endif %} 
            {% if special and t1o_sale_badge_type == 1 %}            
            {% set res = (val1 / val2) * 100 %}
            {% set res = 100 - res %}
            <span class="badge sale">-{{ res|round(0, 'common') }}%</span>
            {% endif %}
            {% endif %}
      
            {% if t1o_new_badge_status == 1 %}	
            {% set days = (endDate2|round(0, 'common') / 86400) - (startDate1|round(0, 'common') /86400) %}
            {% set newproductdays = 30 %}
            {% if days < newproductdays %}
            <span class="badge new">{{ t1o_text_new_prod[lang_id] }}</span>
            {% endif %}
            {% endif %}
            
            </span>
            
            <a class="cloud-zoom thumbnail" href="{{ popup }}" title="{{ heading_title }}" id='zoom1' rel="position:'inside', adjustX: 10, adjustY: 0, tint:'#ffffff', tintOpacity:0.1, smoothMove:3, showTitle:false">
            <img src="{{ thumb }}" title="{{ heading_title }}" alt="{{ heading_title }}" class="img-responsive img-{{ t1d_img_style }}" id="image" />
            </a>
            </li>
            {% endif %}
            </div>
          </ul>
          
          {% endif %}
          {% endif %}
        
        {% if t1o_product_custom_block_1_status == 1 %}
          <div class="product-under-image-custom-block">
          {% if t1o_product_custom_block_1_title[lang_id] %}
          <legend>{{ t1o_product_custom_block_1_title[lang_id] }}</legend>
          {% endif %}
          {{ t1o_product_custom_block_1_content }}  
          </div>
        {% endif %}
          
        </div>
        
        {% if t1o_layout_product_page == 1 %}<div class="col-sm-6 product-buy">{% endif %}
        {% if t1o_layout_product_page == 2 %}<div class="col-sm-8 product-buy">{% endif %}
        {% if t1o_layout_product_page == 3 %}<div class="col-sm-5 product-buy">{% endif %}
        {% if t1o_layout_product_page == 4 %}<div class="col-sm-12 product-buy">{% endif %}
        {% if t1o_layout_product_page == 5 %}<div class="col-sm-5 product-buy">{% endif %}
        {% if t1o_layout_product_page == 6 %}<div class="col-sm-6 product-buy">{% endif %}
        {% if t1o_layout_product_page == 7 %}<div class="col-sm-4 product-buy">{% endif %}
        {% if t1o_layout_product_page == 8 %}<div class="col-sm-5 product-buy">{% endif %}
        {% if t1o_layout_product_page == 9 %}<div class="col-sm-6 product-buy">{% endif %}
        {% if t1o_layout_product_page == 10 %}<div class="col-sm-4 product-buy">{% endif %}
        {% if t1o_layout_product_page == 11 %}<div class="col-sm-6 product-buy">{% endif %}
        {% if t1o_layout_product_page == 12 %}<div class="col-sm-7 product-buy">{% endif %}
        {% if t1o_layout_product_page == 13 %}<div class="col-sm-5 product-buy">{% endif %}
        
        <div class="product-buy-wrapper">
       
          {% if t1o_product_name_position == 0 %}
          <h1>{{ heading_title }}</h1>
          <ul class="list-unstyled pf">
            <li>{{ text_stock }} <span class="stock">{{ stock }}</span></li>
            {% if manufacturer %}
            <li>{{ text_manufacturer }} <a href="{{ manufacturers }}">{{ manufacturer }}</a></li>
            {% endif %}
            <li>{{ text_model }} <span>{{ model }}</span></li>
            {% if reward %}
            <li>{{ text_reward }} <span>{{ reward }}</span></li>
            {% endif %}
            {% if t1o_product_viewed_status == 1 %}
            <li>{{ t1o_text_product_viewed[lang_id] }} <span>{{ product_info.viewed }}</span></li>
            {% endif %}
          </ul>
          {% endif %}
        
        {% if t1o_layout_product_page == 13 %}  
        {{ description }}
        </div>
        </div>
        <div class="col-sm-3 product-buy">
        <div class="product-buy-wrapper">
        {% endif %}
          <hr />
          {% if price %}
          <ul class="list-unstyled pp">
            {% if not special %}
            <li>
              <h2><span class="price-reg">{{ price }}</span></h2>
            </li>
            {% else %}
            <li class="product-special-price">
              <div class="row">
              <div class="col-md-4">
              {{ t1o_text_special_price[lang_id] }}<br />
              <h2 class="price-h"><span class="price-new">{{ special }}</span></h2>
              </div>
              <div class="col-md-4">
              {{ t1o_text_old_price[lang_id] }}<br />
              <h2 class="price-h"><span class="price-old">{{ price }}</span></h2>
              </div>
              <div class="col-md-4">
              {% if t1o_product_save_percent_status == 1 %}
              {{ t1o_text_percent_saved[lang_id] }}<br />
              <h2 class="price-h"><span class="save-percent">{{ percent_savings }}%</span></h2>
              {% endif %}
              </div>
              </div>
            </li>
            {% endif %}
            {% if t1o_product_tax_status == 1 %}
            {% if tax %}
            <li>{{ text_tax }} {{ tax }}</li>
            {% endif %}
            {% endif %}
            {% if points %}
            <li>{{ text_points }} {{ points }}</li>
            {% endif %}
            {% if discounts %}
            {% for discount in discounts %}
            <li>{{ discount.quantity }}{{ text_discount }}{{ discount.price }}</li>
            {% endfor %}
            {% endif %}
          </ul>
          {% endif %}
          <hr />
          {% if review_status %}
          <div class="rating">
            <p>
              <span class="rating-stars">
              {% for i in 1..5 %}
              {% if rating < i %}
              <span class="fa fa-stack fa-g"><i class="fa fa-star fa-stack-2x"></i></span>
              {% else %}
              <span class="fa fa-stack fa-y"><i class="fa fa-star fa-stack-2x"></i></span>
              {% endif %}
              {% endfor %}
              </span>
              <a href="" onclick="$('a[href=\'#tab-review\']').trigger('click'); return false;" class="scroll_to_tabs">{{ reviews }}</a> <a href="" onclick="$('a[href=\'#tab-review\']').trigger('click'); return false;" class="scroll_to_tabs"><i class="fa fa-pencil"></i> {{ text_write }}</a></p>
          </div>
          {% endif %}  
          
          {% if t1o_product_custom_block_2_status == 1 %}
            <div class="product-buy-custom-block">
            {% if t1o_product_custom_block_2_title[lang_id] %}
            <legend>{{ t1o_product_custom_block_2_title[lang_id] }}</legend>
            {% endif %}
            {{ t1o_product_custom_block_2_content }}  
            </div>
          {% endif %}
        
          <div id="product">
            {% if options %}
            <legend>{{ text_option }}</legend>
            {% for option in options %}
            {% if option.type == 'select' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <select name="option[{{ option.product_option_id }}]" id="input-option{{ option.product_option_id }}" class="form-control">
                <option value="">{{ text_select }}</option>
                {% for option_value in option.product_option_value %}
                <option value="{{ option_value.product_option_value_id }}">{{ option_value.name }}
                {% if option_value.price %}
                ({{ option_value.price_prefix }}{{ option_value.price }})
                {% endif %} </option>
                {% endfor %}
              </select>
            </div>
            {% endif %}
            {% if option.type == 'radio' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label">{{ option.name }}</label>
              <div id="input-option{{ option.product_option_id }}"> {% for option_value in option.product_option_value %}
                <div class="radio">
                  <label>
                    <input type="radio" name="option[{{ option.product_option_id }}]" value="{{ option_value.product_option_value_id }}" />
                    {% if option_value.image %} <img src="{{ option_value.image }}" alt="{{ option_value.name }} {% if option_value.price %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" class="img-thumbnail" /> {% endif %}                  
                    {{ option_value.name }}
                    {% if option_value.price %}
                    ({{ option_value.price_prefix }}{{ option_value.price }})
                    {% endif %} </label>
                </div>
                {% endfor %} </div>
            </div>
            {% endif %}
            {% if option.type == 'checkbox' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label">{{ option.name }}</label>
              <div id="input-option{{ option.product_option_id }}"> {% for option_value in option.product_option_value %}
                <div class="checkbox">
                  <label>
                    <input type="checkbox" name="option[{{ option.product_option_id }}][]" value="{{ option_value.product_option_value_id }}" />
                    {% if option_value.image %} <img src="{{ option_value.image }}" alt="{{ option_value.name }} {% if option_value.price %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" class="img-thumbnail" /> {% endif %}
                    {{ option_value.name }}
                    {% if option_value.price %}
                    ({{ option_value.price_prefix }}{{ option_value.price }})
                    {% endif %} </label>
                </div>
                {% endfor %} </div>
            </div>
            {% endif %}
            {% if option.type == 'text' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id }}" class="form-control" />
            </div>
            {% endif %}
            {% if option.type == 'textarea' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <textarea name="option[{{ option.product_option_id }}]" rows="5" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id }}" class="form-control">{{ option.value }}</textarea>
            </div>
            {% endif %}
            {% if option.type == 'file' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label">{{ option.name }}</label>
              <button type="button" id="button-upload{{ option.product_option_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default btn-block"><i class="fa fa-upload"></i> {{ button_upload }}</button>
              <input type="hidden" name="option[{{ option.product_option_id }}]" value="" id="input-option{{ option.product_option_id }}" />
            </div>
            {% endif %}
            {% if option.type == 'date' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <div class="input-group date">
                <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD" id="input-option{{ option.product_option_id }}" class="form-control" />
                <span class="input-group-btn">
                <button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button>
                </span></div>
            </div>
            {% endif %}
            {% if option.type == 'datetime' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <div class="input-group datetime">
                <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD HH:mm" id="input-option{{ option.product_option_id }}" class="form-control" />
                <span class="input-group-btn">
                <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                </span></div>
            </div>
            {% endif %}
            {% if option.type == 'time' %}
            <div class="form-group{% if option.required %} required {% endif %}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <div class="input-group time">
                <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="HH:mm" id="input-option{{ option.product_option_id }}" class="form-control" />
                <span class="input-group-btn">
                <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                </span></div>
            </div>
            {% endif %}
            {% endfor %}
            {% endif %}
            {% if recurrings %}
            <hr />
            <h3>{{ text_payment_recurring }}</h3>
            <div class="form-group required">
              <select name="recurring_id" class="form-control">
                <option value="">{{ text_select }}</option>
                {% for recurring in recurrings %}
                <option value="{{ recurring.recurring_id }}">{{ recurring.name }}</option>
                {% endfor %}
              </select>
              <div class="help-block" id="recurring-description"></div>
            </div>
            {% endif %}

            <div class="form-group">
              <div class="qty">
              <label class="control-label" for="input-quantity">{{ entry_qty }}</label>
              <br />
              {% if t1o_product_i_c_status == 1 %}
              <input type="button" class="dec" value=" - " />
              {% endif %}
              <input type="text" name="quantity" value="{{ minimum }}" size="2" id="input-quantity" class="form-control i-d-quantity" />
              {% if t1o_product_i_c_status == 1 %}
              <input type="button" class="inc" value=" + " />
              {% endif %}
              <input type="hidden" name="product_id" value="{{ product_id }}" />
              
     
              <button type="button" id="button-cart" data-loading-text="{{ text_loading }}" class="btn btn-primary"><i class="fa fa-shopping-bag"></i> {{ button_cart }}</button>
              </div>
              <a class="wcs" onclick="wishlist.add('{{ product_id }}');"><i class="fa fa-heart"></i> {{ button_wishlist }}</a>
              <a class="wcs" onclick="compare.add('{{ product_id }}');"><i class="fa fa-retweet"></i> {{ button_compare }}</a>
            <!--
            <?php function curPageURL() {
              if (!empty($_SERVER['HTTPS'])) {
                $pref = 'https';
              } else {
                $pref = 'http';
              }
              $pageURL = $pref."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
              return urlencode($pageURL);
            } ?>
            <a class="btn btn-default wcs" data-toggle="tooltip" title="{{ t1o_text_product_friend[lang_id] }}" href="mailto:enterfriend@addresshere.com?subject={{ heading_title }}&body={{ heading_title }}: {{ curPageURL }}"><i class="fa fa-envelope"></i></a> 
            -->
            </div>
            {% if minimum > 1 %}
            <div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ text_minimum }}</div>
            {% endif %}
          </div>
          
          <div class="product-share">
          <!-- Share This -->
          <script type="text/javascript" src="//ws.sharethis.com/button/buttons.js"></script> 
          <span class='st_sharethis_hcount' displayText='ShareThis'></span>
          <span class='st_facebook_hcount' displayText='Facebook'></span>
          <span class='st_twitter_hcount' displayText='Tweet'></span>
          <span class='st_pinterest_hcount' displayText='Pinterest'></span>
          <span class='st__hcount' displayText=''></span>
          <!-- END Share This -->
          </div>
          
        </div>
        </div>
 
        
        {% if t1o_layout_product_page == 5 or t1o_layout_product_page == 6 or t1o_layout_product_page == 7 or t1o_layout_product_page == 10 %}	
        <div class="col-sm-3 product-right-sm hidden-xs">
        <hr />
        {% if manufacturer and t1o_product_manufacturer_logo_status == 1 %}
          <div class="product-right-sm-logo">   
            {% if manufacturers_img %}
            <a href="{{ manufacturers }}">{{ manufacturers_img ? '<img src="'~manufacturers_img~'" title="'~manufacturers~'" alt="'~manufacturers~'" />' : manufacturers  }}</a>
            {% endif %}
            <a class="see-all btn btn-default" href="{{ manufacturers }}"><span class="hidden-sm">{{ t1o_text_see_all_products_by[lang_id] }}<br /></span>{{ manufacturer }}</a>
          </div> 
        {% endif %}
        
        {% if t1o_product_custom_block_3_status == 1 %}
          <div class="product-right-sm-custom">
          {% if t1o_product_custom_block_3_title[lang_id] %}
          <legend>{{ t1o_product_custom_block_3_title[lang_id] }}</legend>
          {% endif %}
          {{ t1o_product_custom_block_3_content }}  
          </div>
        {% endif %}

  
    {% if t1o_product_fb1_title[lang_id] or t1o_product_fb2_title[lang_id] or t1o_product_fb3_title[lang_id] %}
    <div class="product-right-sm-info">
    
{% if t1o_product_fb1_title[lang_id] %}
<div class="theme-modal">
<a href="#" data-toggle="modal" data-target="#modal-product-fb1">
<div class="product-right-sm-info-content">
      <span class="p-icon">
        {% if _SERVER.HTTPS and _SERVER.HTTPS != 'off' %}
        	{% set path_image = config_ssl ~ 'image/' %}
        {% else %}  
        	{% set path_image = config_url ~ 'image/' %}
        {% endif %}
        {% if t1o_product_fb1_icon != '' %}   
		<img src="{{ path_image ~ t1o_product_fb1_icon }}" alt="+" title="+">
        {% elseif t1o_product_fb1_awesome !='none' %}
        <i class="fa fa-{{ t1o_product_fb1_awesome }}"></i>
        {% else %}
        <i class="fa fa-paper-plane"></i>
		{% endif %}
        <i class="fa fa-search"></i>
      </span>
<span class="p-title">{{ t1o_product_fb1_title[lang_id] }}</span>
{% if t1o_product_fb1_subtitle[lang_id] %}
<span class="p-subtitle">{{ t1o_product_fb1_subtitle[lang_id] }}</span>
{% endif %}
</div>
</a>
<div class="modal fade" id="modal-product-fb1" tabindex="-1" role="dialog" aria-labelledby="modal-product-fb1" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-body">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <div class="content-product-fb">
        <h2>{{ t1o_product_fb1_title[lang_id] }} {{ t1o_product_fb1_subtitle[lang_id] }}</h2>
        {{ t1o_product_fb1_content }}
      </div>
      </div>
    </div>
  </div>
</div>
</div>
{% endif %}
    
{% if t1o_product_fb2_title[lang_id] %}
<div class="theme-modal">
<a href="#" data-toggle="modal" data-target="#modal-product-fb2">
<div class="product-right-sm-info-content">
      <span class="p-icon">
        {% if _SERVER.HTTPS and _SERVER.HTTPS != 'off' %}
        	{% set path_image = config_ssl ~ 'image/' %}
        {% else %}  
        	{% set path_image = config_url ~ 'image/' %}
        {% endif %}
        {% if t1o_product_fb2_icon != '' %}   
		<img src="{{ path_image ~ t1o_product_fb2_icon }}" alt="+" title="+">
        {% elseif t1o_product_fb2_awesome !='none' %}
        <i class="fa fa-{{ t1o_product_fb2_awesome }}"></i>
        {% else %}
        <i class="fa fa-paper-plane"></i>
		{% endif %}
        <i class="fa fa-search"></i>
      </span>
<span class="p-title">{{ t1o_product_fb2_title[lang_id] }}</span>
{% if t1o_product_fb2_subtitle[lang_id] %}
<span class="p-subtitle">{{ t1o_product_fb2_subtitle[lang_id] }}</span>
{% endif %}
</div>
</a>
<div class="modal fade" id="modal-product-fb2" tabindex="-1" role="dialog" aria-labelledby="modal-product-fb2" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-body">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <div class="content-product-fb">
        <h2>{{ t1o_product_fb2_title[lang_id] }} {{ t1o_product_fb2_subtitle[lang_id] }}</h2>
        {{ t1o_product_fb2_content }}
      </div>
      </div>
    </div>
  </div>
</div>
</div>
{% endif %}
    
{% if t1o_product_fb3_title[lang_id] %}
<div class="theme-modal">
<a href="#" data-toggle="modal" data-target="#modal-product-fb3">
<div class="product-right-sm-info-content">
      <span class="p-icon">
        {% if _SERVER.HTTPS and _SERVER.HTTPS != 'off' %}
        	{% set path_image = config_ssl ~ 'image/' %}
        {% else %}  
        	{% set path_image = config_url ~ 'image/' %}
        {% endif %}
        {% if t1o_product_fb3_icon != '' %}   
		<img src="{{ path_image ~ t1o_product_fb3_icon }}" alt="+" title="+">
        {% elseif t1o_product_fb3_awesome !='none' %}
        <i class="fa fa-{{ t1o_product_fb3_awesome }}"></i>
        {% else %}
        <i class="fa fa-paper-plane"></i>
		{% endif %}
        <i class="fa fa-search"></i>
      </span>
<span class="p-title">{{ t1o_product_fb3_title[lang_id] }}</span>
{% if t1o_product_fb3_subtitle[lang_id] %}
<span class="p-subtitle">{{ t1o_product_fb3_subtitle[lang_id] }}</span>
{% endif %}
</div>
</a>
<div class="modal fade" id="modal-product-fb3" tabindex="-1" role="dialog" aria-labelledby="modal-product-fb3" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-body">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <div class="content-product-fb">
        <h2>{{ t1o_product_fb3_title[lang_id] }} {{ t1o_product_fb3_subtitle[lang_id] }}</h2>
        {{ t1o_product_fb3_content }}
      </div>
      </div>
    </div>
  </div>
</div>
</div>
{% endif %}
    
    </div>  
    {% endif %}

{% if products %} 
{% if t1o_product_related_status == 1 and t1o_product_related_position == 0 %}
<div class="product-right-sm-related panel panel-default">
<div class="panel-heading">{{ text_related }}</div>   
<div class="product-right-sm-related-carousel product-grid {{ t1o_category_prod_box_style }} owl-carousel">       
    {% for product in products %} 
    <div class="item product-thumb">
      <div class="image">
      
            <span class="badge-wrapper">
            
            {% if t1o_sale_badge_status == 1 %}	
            {% if product.special and t1o_sale_badge_type == 0 %}
            <span class="badge sale">{{ t1o_text_sale[lang_id] }}</span>
            {% endif %} 
            {% if product.special and t1o_sale_badge_type == 1 %}            
            {% set res = (product.val1 / product.val2) * 100 %}
            {% set res = 100 - res %}
            <span class="badge sale">-{{ res|round(0, 'common') }}%</span>
            {% endif %}
            {% endif %}
      
            {% if t1o_new_badge_status == 1 %}	
            {% set days = (product.endDate2|round(0, 'common') / 86400) - (product.startDate1|round(0, 'common') /86400) %}
            {% set newproductdays = 30 %}
            {% if days < newproductdays %}
            <span class="badge new">{{ t1o_text_new_prod[lang_id] }}</span>
            {% endif %}
            {% endif %}
            
            </span>
            
            {% if t1o_category_prod_box_style == 'product-box-style-3' %}
            <div class="flybar-top">  
            <div class="flybar-top-items">
            <p class="description">{{ product.description }}</p>
            <div class="rating">
              {% for i in 1..5 %}
              {% if product.rating < i %}
              <span class="fa fa-stack fa-g"><i class="fa fa-star fa-stack-2x"></i></span>
              {% else %}
              <span class="fa fa-stack fa-y"><i class="fa fa-star fa-stack-2x"></i></span>
              {% endif %}
              {% endfor %}
            </div>
            </div>   
            </div>
            {% endif %}
            
            <div class="flybar">  
            <div class="flybar-items">
            <button type="button" data-toggle="tooltip" title="{{ button_cart }}" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');" class="btn btn-default"><i class="fa fa-shopping-bag"></i></button>
            <a class="btn btn-default quickview" href="{{ product.quickview }}" data-toggle="tooltip" title="{{ t1o_text_quickview[lang_id] }}"><i class="fa fa-search"></i></a>
            <button type="button" data-toggle="tooltip" title="{{ button_wishlist }}" onclick="wishlist.add('{{ product.product_id }}');" class="wishlist"><i class="fa fa-heart"></i></button>
            <button type="button" data-toggle="tooltip" title="{{ button_compare }}" onclick="compare.add('{{ product.product_id }}');" class="compare"><i class="fa fa-retweet"></i></button>
            </div>   
            </div>
        
            {% if product.thumb_swap %}
            <a href="{{ product.href }}">
            <img src="{{ lazy_load_placeholder }}" data-src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive img-{{ t1d_img_style }} lazyload" />
            <img src="{{ lazy_load_placeholder }}" data-src="{{ product.thumb_swap }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive thumb_swap img-{{ t1d_img_style }} lazyload" />
            </a>
            {% else %}
            <a href="{{ product.href }}"><img src="{{ lazy_load_placeholder }}" data-src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive img-{{ t1d_img_style }} lazyload" /></a>
            {% endif %}
            
      </div>
      <div class="caption">  
      
        <div class="name"><h4><a href="{{ product.href }}">{{ product.name }}</a></h4></div>
        <div class="product_box_brand">{% if product.brand %}<a href="{{ product.brand_url }}">{{ product.brand }}</a>{% endif %}</div>
                
                <div class="rating">
                  {% for i in 1..5 %}
                  {% if product.rating < i %}
                  <span class="fa fa-stack fa-g"><i class="fa fa-star fa-stack-2x"></i></span>
                  {% else %}
                  <span class="fa fa-stack fa-y"><i class="fa fa-star fa-stack-2x"></i></span>
                  {% endif %}
                  {% endfor %}
                </div>
                
                {% if product.price %}
                <p class="price">
                  {% if not product.special %}
                  {{ product.price }}
                  {% else %}
                  <span class="price-new">{{ product.special }}</span> <span class="price-old">{{ product.price }}</span>
                  {% endif %}
                </p>
                {% endif %}
                
                <div class="product-list-buttons">
                  <button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');" class="btn btn-default cart"><i class="fa fa-shopping-bag"></i> <span>{{ button_cart }}</span></button>
                  <a class="btn btn-default quickview list-quickview" href="{{ product.quickview }}" data-toggle="tooltip" title="{{ t1o_text_quickview[lang_id] }}"><i class="fa fa-search"></i></a>
                  <button type="button" data-toggle="tooltip" title="{{ button_wishlist }}" onclick="wishlist.add('{{ product.product_id }}');" class="btn btn-default list-wishlist"><i class="fa fa-heart"></i></button>
                  <button type="button" data-toggle="tooltip" title="{{ button_compare }}" onclick="compare.add('{{ product.product_id }}');" class="btn btn-default list-compare"><i class="fa fa-retweet"></i></button>
                </div>
      </div>            
    </div>
    {% endfor %}
</div>  
<script type="text/javascript"><!--
$('.product-right-sm-related-carousel').owlCarousel({
	items: 1,
	autoPlay: 5000,
	singleItem: true,
	pagination: false,
	navigation: true,
	navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>']
});
--></script>
</div>    
{% endif %}
{% endif %}   
  
        
        </div>
        {% endif %}
        
      </div>
      
      <div id="product-tabs" class="row content-padd">
        <div class="col-sm-12">
        <ul class="nav nav-tabs">
            {% if t1o_layout_product_page != 13 %}
            <li {% if t1o_layout_product_page != 13 %} {{ 'class="active"' }} {% endif %}><a href="#tab-description" data-toggle="tab">{{ tab_description }}</a></li>
            {% endif %}
            {% if attribute_groups %}
            <li {% if t1o_layout_product_page == 13 %} {{ 'class="active"' }} {% endif %}><a href="#tab-specification" data-toggle="tab">{{ tab_attribute }}</a></li>
            {% endif %}
            {% if review_status %}
            <li><a href="#tab-review" data-toggle="tab">{{ tab_review }}</a></li>
            {% endif %}
            {% for i in 1..3 %}
            {% if t1o_product_custom_tab[i].status == 1 and t1o_product_custom_tab[i][lang_id].title !='' %} 
            <li><a href="#tab-custom{{ i }}" data-toggle="tab">{{ t1o_product_custom_tab[i][lang_id].title }}</a></li>
            {% endif %}
            {% endfor %}
          </ul>
          <div class="tab-content">
            {% if t1o_layout_product_page != 13 %}
            <div {% if t1o_layout_product_page != 13 %} {{ 'class="fade in tab-pane active"' }} {% endif %} id="tab-description">{{ description }}</div>
            {% endif %}
            {% if attribute_groups %}
            <div {% if t1o_layout_product_page == 13 %} {{ 'class="fade in tab-pane active"' }} {% else %} {{ 'class="fade tab-pane"' }} {% endif %} id="tab-specification">
              <table class="table table-bordered">
                {% for attribute_group in attribute_groups %}
                <thead>
                  <tr>
                    <td colspan="2"><strong>{{ attribute_group.name }}</strong></td>
                  </tr>
                </thead>
                <tbody>
                  {% for attribute in attribute_group.attribute %}
                  <tr>
                    <td>{{ attribute.name }}</td>
                    <td>{{ attribute.text }}</td>
                  </tr>
                  {% endfor %}
                </tbody>
                {% endfor %}
              </table>
            </div>
            {% endif %}
            {% if review_status %}
            <div class="fade tab-pane" id="tab-review">
              <form class="form-horizontal" id="form-review">
                <div id="review"></div>
                <h2>{{ text_write }}</h2>
                {% if review_guest %}
                <div class="form-group required">
                  <div class="col-sm-12">
                    <label class="control-label" for="input-name">{{ entry_name }}</label>
                    <input type="text" name="name" value="{{ customer_name }}" id="input-name" class="form-control" />
                  </div>
                </div>
                <div class="form-group required">
                  <div class="col-sm-12">
                    <label class="control-label" for="input-review">{{ entry_review }}</label>
                    <textarea name="text" rows="5" id="input-review" class="form-control"></textarea>
                    <div class="help-block">{{ text_note }}</div>
                  </div>
                </div>
                <div class="form-group required">
                  <div class="col-sm-12">
                    <label class="control-label">{{ entry_rating }}</label>
                    &nbsp;&nbsp;&nbsp; {{ entry_bad }}&nbsp;
                    <input type="radio" name="rating" value="1" />
                    &nbsp;
                    <input type="radio" name="rating" value="2" />
                    &nbsp;
                    <input type="radio" name="rating" value="3" />
                    &nbsp;
                    <input type="radio" name="rating" value="4" />
                    &nbsp;
                    <input type="radio" name="rating" value="5" />
                    &nbsp;{{ entry_good }}</div>
                </div>
                {{ captcha }}
                <div class="buttons clearfix">
                  <div class="pull-right">
                    <button type="button" id="button-review" data-loading-text="{{ text_loading }}" class="btn btn-primary">{{ button_continue }}</button>
                  </div>
                </div>
                {% else %}
                {{ text_login }}
                {% endif %}
              </form>
            </div>
            {% endif %}
            
            {% for i in 1..3 %}
            {% if t1o_product_custom_tab[i].status == 1 and t1o_product_custom_tab[i][lang_id].title !='' %} 
            <div class="fade tab-pane" id="tab-custom{{ i }}">
            {{ t1o_product_custom_tab_htmlcontent[i] }}
            </div>
            {% endif %}
            {% endfor %}
            
          </div>
        </div>
      </div>
      
    {% if tags %}
    <div class="product-tags">
      <h4>{{ text_tags }}</h4>
        {% for i in 0..tags|length %}
        {% if i < (tags|length - 1) %}
        <a class="btn btn-default" href="{{ tags[i].href }}">{{ tags[i].tag }}</a>
        {% else %}
        <a class="btn btn-default" href="{{ tags[i].href }}">{{ tags[i].tag }}</a>
        {% endif %}
        {% endfor %}
    </div>
    {% endif %}
    
      
      {% if products %}
      {% if t1o_product_related_status == 1 and t1o_product_related_position == 1 %}
      <div id="product-related">
      <h2>{{ text_related }}</h2>
      <div class="row product-slider">
      <div class="product-items product-items-related">
        {% for product in products %}
          
          {% if t1o_product_related_style == 1 %}
          <div class="product-layout-slider product-grid col-xs-12">
          {% else %}
          <div class="product-layout-grid product-grid col-xs-12">
          {% endif %}

          <div class="product-thumb">

            <div class="image">
            
            <span class="badge-wrapper">
            
            {% if t1o_sale_badge_status == 1 %}	
            {% if product.special and t1o_sale_badge_type == 0 %}
            <span class="badge sale">{{ t1o_text_sale[lang_id] }}</span>
            {% endif %} 
            {% if product.special and t1o_sale_badge_type == 1 %}            
            {% set res = (product.val1 / product.val2) * 100 %}
            {% set res = 100 - res %}
            <span class="badge sale">-{{ res|round(0, 'common') }}%</span>
            {% endif %}
            {% endif %}
      
            {% if t1o_new_badge_status == 1 %}	
            {% set days = (product.endDate2|round(0, 'common') / 86400) - (product.startDate1|round(0, 'common') /86400) %}
            {% set newproductdays = 30 %}
            {% if days < newproductdays %}
            <span class="badge new">{{ t1o_text_new_prod[lang_id] }}</span>
            {% endif %}
            {% endif %}
            
            </span>
            
            {% if t1o_category_prod_box_style == 'product-box-style-3' %}
            <div class="flybar-top">  
            <div class="flybar-top-items">
            <p class="description">{{ product.description }}</p>
            <div class="rating">
              {% for i in 1..5 %}
              {% if product.rating < i %}
              <span class="fa fa-stack fa-g"><i class="fa fa-star fa-stack-2x"></i></span>
              {% else %}
              <span class="fa fa-stack fa-y"><i class="fa fa-star fa-stack-2x"></i></span>
              {% endif %}
              {% endfor %}
            </div>
            </div>   
            </div>
            {% endif %}
            
            <div class="flybar">  
            <div class="flybar-items">
            <button type="button" data-toggle="tooltip" title="{{ button_cart }}" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');" class="btn btn-default"><i class="fa fa-shopping-bag"></i></button>
            <a class="btn btn-default quickview" href="{{ product.quickview }}" data-toggle="tooltip" title="{{ t1o_text_quickview[lang_id] }}"><i class="fa fa-search"></i></a>
            <button type="button" data-toggle="tooltip" title="{{ button_wishlist }}" onclick="wishlist.add('{{ product.product_id }}');" class="wishlist"><i class="fa fa-heart"></i></button>
            <button type="button" data-toggle="tooltip" title="{{ button_compare }}" onclick="compare.add('{{ product.product_id }}');" class="compare"><i class="fa fa-retweet"></i></button>
            </div>   
            </div>            
            {% if product.thumb_swap %}
            <a href="{{ product.href }}">
            <img src="{{ lazy_load_placeholder }}" data-src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive img-{{ t1d_img_style }} lazyload" />
            <img src="{{ lazy_load_placeholder }}" data-src="{{ product.thumb_swap }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive thumb_swap img-{{ t1d_img_style }} lazyload" />
            </a>
            {% else %}
            <a href="{{ product.href }}"><img src="{{ lazy_load_placeholder }}" data-src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive img-{{ t1d_img_style }} lazyload" /></a>
            {% endif %}
            </div>
            <div>
            
              <div class="caption">
                <div class="name"><h4><a href="{{ product.href }}">{{ product.name }}</a></h4></div>
                <div class="product_box_brand">{% if product.brand %}<a href="{{ product.brand_url }}">{{ product.brand }}</a>{% endif %}</div>
                <p class="description">{{ product.description }}</p>
                <div class="rating">
                  {% for i in 1..5 %}
                  {% if product.rating < i %}
                  <span class="fa fa-stack fa-g"><i class="fa fa-star fa-stack-2x"></i></span>
                  {% else %}
                  <span class="fa fa-stack fa-y"><i class="fa fa-star fa-stack-2x"></i></span>
                  {% endif %}
                  {% endfor %}
                </div>
                {% if product.price %}
                <p class="price">
                  {% if not product.special %}
                  {{ product.price }}
                  {% else %}
                  <span class="price-new">{{ product.special }}</span> <span class="price-old">{{ product.price }}</span>
                  {% endif %}
                </p>
                {% endif %}
                <div class="product-list-buttons">
                  <button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');" class="btn btn-default cart"><i class="fa fa-shopping-bag"></i> <span>{{ button_cart }}</span></button>
                  <a class="btn btn-default quickview list-quickview" href="{{ product.quickview }}" data-toggle="tooltip" title="{{ t1o_text_quickview[lang_id] }}"><i class="fa fa-search"></i></a>
                  <button type="button" data-toggle="tooltip" title="{{ button_wishlist }}" onclick="wishlist.add('{{ product.product_id }}');" class="btn btn-default list-wishlist"><i class="fa fa-heart"></i></button>
                  <button type="button" data-toggle="tooltip" title="{{ button_compare }}" onclick="compare.add('{{ product.product_id }}');" class="btn btn-default list-compare"><i class="fa fa-retweet"></i></button>
                </div>
              </div>
                            
            </div>
          </div>
        </div>
        {% endfor %}
      </div>
      </div>
      
{% if t1o_product_related_style == 1 %}
<script type="text/javascript"><!--
$('.product-items-related').owlCarousel({
	items: {{ t1o_related_per_row }},
	itemsMobile : [479, 2],
	singleItem: false,
	scrollPerPage: true,
	pagination: false,
	navigation: true,
	navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>']
});
--></script>
{% endif %}

      </div>
      {% endif %}
      {% endif %}

      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>
<script type="text/javascript"><!--
$(".scroll_to_tabs").click(function() {
	
	$screensize = $(window).width();
	
		if ($screensize < 768) {
			$('html, body').animate({
                scrollTop: ($("#product-tabs").offset().top - 15)
            }, 700);
		} else {
			$('html, body').animate({
                scrollTop: ($("#product-tabs").offset().top - 150)
            }, 700);
		}				

});
//--></script>
<script type="text/javascript"><!--
$('select[name=\'recurring_id\'], input[name="quantity"]').change(function(){
	$.ajax({
		url: 'index.php?route=product/product/getRecurringDescription',
		type: 'post',
		data: $('input[name=\'product_id\'], input[name=\'quantity\'], select[name=\'recurring_id\']'),
		dataType: 'json',
		beforeSend: function() {
			$('#recurring-description').html('');
		},
		success: function(json) {
			$('.alert-dismissible, .text-danger').remove();
			
			if (json['success']) {
				$('#recurring-description').html(json['success']);
			}
		}
	});
});
//--></script> 
<script type="text/javascript"><!--
$('#button-cart').on('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
		dataType: 'json',
		beforeSend: function() {
			$('#button-cart').button('loading');
		},
		complete: function() {
			$('#button-cart').button('reset');
		},
		success: function(json) {
			$('.alert-dismissible, .text-danger').remove();
			$('.form-group').removeClass('has-error');

			if (json['error']) {
				if (json['error']['option']) {
					for (i in json['error']['option']) {
						var element = $('#input-option' + i.replace('_', '-'));
						
						if (element.parent().hasClass('input-group')) {
							element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						} else {
							element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						}
					}
				}
				
				if (json['error']['recurring']) {
					$('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
				}
				
				// Highlight any found errors
				$('.text-danger').parent().addClass('has-error');
			}
			
			if (json['success']) {
				$('.breadcrumb').after('<div class="alert alert-success alert-dismissible"><i class="fa fa-check"></i> ' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
				
				setTimeout(function() {
				    $('.alert').delay(500).fadeOut(1000);
				}, 5000);
						
				$('#cart-total').html(json['total']);
				/*
				$('html, body').animate({ scrollTop: 0 }, 'slow');
				*/
				
				$('#cart > ul').load('index.php?route=common/cart/info ul li');
			}
		},
        error: function(xhr, ajaxOptions, thrownError) {
            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
});
//--></script> 
<script type="text/javascript"><!--
$('.date').datetimepicker({
	language: '{{ datepicker }}',
	pickTime: false
});

$('.datetime').datetimepicker({
	language: '{{ datepicker }}',
	pickDate: true,
	pickTime: true
});

$('.time').datetimepicker({
	language: '{{ datepicker }}',
	pickDate: false
});

$('button[id^=\'button-upload\']').on('click', function() {
	var node = this;
	
	$('#form-upload').remove();
	
	$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');
	
	$('#form-upload input[name=\'file\']').trigger('click');
	
	if (typeof timer != 'undefined') {
    	clearInterval(timer);
	}
	
	timer = setInterval(function() {
		if ($('#form-upload input[name=\'file\']').val() != '') {
			clearInterval(timer);
			
			$.ajax({
				url: 'index.php?route=tool/upload',
				type: 'post',
				dataType: 'json',
				data: new FormData($('#form-upload')[0]),
				cache: false,
				contentType: false,
				processData: false,
				beforeSend: function() {
					$(node).button('loading');
				},
				complete: function() {
					$(node).button('reset');
				},
				success: function(json) {
					$('.text-danger').remove();
					
					if (json['error']) {
						$(node).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
					}
					
					if (json['success']) {
						alert(json['success']);
						
						$(node).parent().find('input').val(json['code']);
					}
				},
				error: function(xhr, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
				}
			});
		}
	}, 500);
});
//--></script> 
<script type="text/javascript"><!--
$('#review').delegate('.pagination a', 'click', function(e) {
    e.preventDefault();

    $('#review').fadeOut('slow');

    $('#review').load(this.href);

    $('#review').fadeIn('slow');
});

$('#review').load('index.php?route=product/product/review&product_id={{ product_id }}');

$('#button-review').on('click', function() {
	$.ajax({
		url: 'index.php?route=product/product/write&product_id={{ product_id }}',
		type: 'post',
		dataType: 'json',
		data: $("#form-review").serialize(),
		beforeSend: function() {
			$('#button-review').button('loading');
		},
		complete: function() {
			$('#button-review').button('reset');
		},
		success: function(json) {
			$('.alert-dismissible').remove();

			if (json['error']) {
				$('#review').after('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
			}

			if (json['success']) {
				$('#review').after('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');

				$('input[name=\'name\']').val('');
				$('textarea[name=\'text\']').val('');
				$('input[name=\'rating\']:checked').prop('checked', false);
			}
		}
	});
});

$(document).ready(function() {
	$('.thumbnails').magnificPopup({
		type:'image',
		delegate: 'a',
		gallery: {
			enabled: true
		}
	});
});
//--></script>
{{ footer }} 
