<!DOCTYPE html>
<!--[if IE]><![endif]-->
<!--[if IE 8 ]>
<html dir="{{ direction }}" lang="{{ lang }}" class="ie8"><![endif]-->
<!--[if IE 9 ]>
<html dir="{{ direction }}" lang="{{ lang }}" class="ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html dir="{{ direction }}" lang="{{ lang }}">
<!--<![endif]-->
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Collective Store - {{ title }}</title>
    <base href="{{ base }}"/>
    {% if description %}
        <meta name="description" content="{{ description }}"/>
    {% endif %}
    {% if keywords %}
        <meta name="keywords" content="{{ keywords }}"/>
    {% endif %}

    {% for link in links %}
        <link href="{{ link.href }}" rel="{{ link.rel }}"/>
    {% endfor %}

    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700,900" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.0/css/ionicons.min.css" rel="stylesheet">

    <link href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.carousel.min.css" rel="stylesheet"/>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.theme.green.min.css" rel="stylesheet"/>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css" rel="stylesheet"/>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" media="screen"/>

    <link href="catalog/view/javascript/GDPR-Cookie/ihavecookies.css" rel="stylesheet">

    <link href="catalog/view/theme/collective/stylesheet/plugins.min.css" rel="stylesheet">

    {% for style in styles %}
        <link href="{{ style.href }}" type="text/css" rel="{{ style.rel }}" media="{{ style.media }}"/>
    {% endfor %}

    <link href="catalog/view/theme/collective/stylesheet/stylesheet.css" rel="stylesheet">

    <script src="https://code.jquery.com/jquery-2.2.4.min.js" type="text/javascript"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" type="text/javascript"></script>
    {% for script in scripts %}
        <script src="{{ script }}" type="text/javascript"></script>
    {% endfor %}
    <!-- Google Tag Manager -->
    <script>(function (w, d, s, l, i) {
            w[l] = w[l] || [];
            w[l].push({
                'gtm.start':
                    new Date().getTime(), event: 'gtm.js'
            });
            var f = d.getElementsByTagName(s)[0],
                j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
            j.async = true;
            j.src =
                'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
            f.parentNode.insertBefore(j, f);
        })(window, document, 'script', 'dataLayer', 'GTM-K6RC9F5');
    </script>
    <!-- End Google Tag Manager -->

        <script type="text/javascript">
          function facebook_loadScript(url, callback) {
            var script = document.createElement("script");
            script.type = "text/javascript";
            if(script.readyState) {  // only required for IE <9
              script.onreadystatechange = function() {
                if (script.readyState === "loaded" || script.readyState === "complete") {
                  script.onreadystatechange = null;
                  if (callback) {
                    callback();
                  }
                }
              };
            } else {  //Others
              if (callback) {
                script.onload = callback;
              }
            }

            script.src = url;
            document.getElementsByTagName("head")[0].appendChild(script);
          }
        </script>

        <script type="text/javascript">
          (function() {
            var enableCookieBar = '{{ facebook_enable_cookie_bar }}';
            if (enableCookieBar === 'true') {
              facebook_loadScript("catalog/view/javascript/facebook/cookieconsent.min.js");

              // loading the css file
              var css = document.createElement("link");
              css.setAttribute("rel", "stylesheet");
              css.setAttribute("type", "text/css");
              css.setAttribute(
                "href",
                "catalog/view/theme/css/facebook/cookieconsent.min.css");
              document.getElementsByTagName("head")[0].appendChild(css);

              window.addEventListener("load", function(){
                function setConsent() {
                  fbq(
                    'consent',
                    this.hasConsented() ? 'grant' : 'revoke'
                  );
                }
                window.cookieconsent.initialise({
                  palette: {
                    popup: {
                      background: '#237afc'
                    },
                    button: {
                      background: '#fff',
                      text: '#237afc'
                    }
                  },
                  cookie: {
                    name: fbq.consentCookieName
                  },
                  type: 'opt-out',
                  showLink: false,
                  content: {
                    dismiss: 'Agree',
                    deny: 'Opt Out',
                    header: 'Our Site Uses Cookies',
                    message: 'By clicking Agree, you agree to our <a class="cc-link" href="https://www.facebook.com/legal/terms/update" target="_blank">terms of service</a>, <a class="cc-link" href="https://www.facebook.com/policies/" target="_blank">privacy policy</a> and <a class="cc-link" href="https://www.facebook.com/policies/cookies/" target="_blank">cookies policy</a>.'
                  },
                  layout: 'basic-header',
                  location: true,
                  revokable: true,
                  onInitialise: setConsent,
                  onStatusChange: setConsent,
                  onRevokeChoice: setConsent
                }, function (popup) {
                  // If this isn't open, we know that we can use cookies.
                  if (!popup.getStatus() && !popup.options.enabled) {
                    popup.setStatus(cookieconsent.status.dismiss);
                  }
                });
              });
            }
          })();
        </script>

        <script type="text/javascript">
          (function() {
            !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
            n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
            n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
            t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
            document,'script','https://connect.facebook.net/en_US/fbevents.js');

            var enableCookieBar = '{{ facebook_enable_cookie_bar }}';
            if (enableCookieBar === 'true') {
              fbq.consentCookieName = 'fb_cookieconsent_status';

              (function() {
                function getCookie(t){var i=("; "+document.cookie).split("; "+t+"=");if(2==i.length)return i.pop().split(";").shift()}
                var consentValue = getCookie(fbq.consentCookieName);
                fbq('consent', consentValue === 'dismiss' ? 'grant' : 'revoke');
              })();
            }

            {% if facebook_pixel_id_FAE %}
// system auto generated facebook_pixel.js, DO NOT MODIFY
pixel_script_filename = 'catalog/view/javascript/facebook/facebook_pixel_2_1_10.js';
// system auto generated facebook_pixel.js, DO NOT MODIFY
              facebook_loadScript(
                pixel_script_filename,
                function() {
                  var params = {{ facebook_pixel_params_FAE }};
                  _facebookAdsExtension.facebookPixel.init(
                    '{{ facebook_pixel_id_FAE }}',
                    {{ facebook_pixel_pii_FAE }},
                    params);
                  {% if facebook_pixel_event_params_FAE %}
                    _facebookAdsExtension.facebookPixel.firePixel(
                      JSON.parse('{{facebook_pixel_event_params_FAE }}'));
                  {% endif %}
                });
            {% endif %}
          })();
        </script>
      
</head>
<body class="{{ class }} group2">
<!-- Google Tag Manager (noscript) -->
<noscript>
    <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K6RC9F5" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->
{% spaceless %}
	{% if block2 %}
		{{ block2 }}
	{% endif %}
    <header>
        <div class="container-fix">
            <div class="container">
                <div class="logo-container pull-left">
                    <div id="logo">
                        {% if logo %}
                            <a href="{{ home }}">
                                <img src="{{ logo }}" title="{{ name }}" alt="{{ name }}" class="img-responsive"/>
                            </a>
                        {% else %}
                            <h1><a href="{{ home }}">{{ name }}</a></h1>
                        {% endif %}
                    </div>
                </div>
                <div class="block-right pull-right">
                    <div class="cart-container pull-right">{{ cart }}</div>
                    <div class="setting pull-right">
                        <button data-toggle="dropdown" type="button">
                            <i class="ion-ios-gear-outline"></i>
                        </button>
                        <nav id="top" class="dropdown-menu">
                            <ul class="list-unstyled top-links">
                                <li>{{ currency }}</li>
                                <li>{{ language }}</li>
                                <li>
                                    <div>
                                        <span class="text-ex">{{ text_account }}</span>
                                        <div id="top-links">
                                            {% if use_ajax_login %}
                                            <ul class="ul-account list-unstyled">
                                                {% else %}
                                                <ul class="list-unstyled">
                                                    {% endif %}
                                                    {% if logged %}
                                                        <li><a href="{{ account }}">{{ text_account }}</a></li>
                                                        <li><a href="{{ order }}">{{ text_order }}</a></li>
                                                        <li><a href="{{ transaction }}">{{ text_transaction }}</a></li>
                                                        <li><a href="{{ wishlist }}" id="wishlist-total" title="{{ text_wishlist }}">{{ text_wishlist }}</a></li>
                                                        <li>
                                                            {% if use_ajax_login %}
                                                                <a id="a-logout-link" href="{{ logout }}">{{ text_logout }}</a>
                                                            {% else %}
                                                                <a href="{{ logout }}">{{ text_logout }}</a>
                                                            {% endif %}
                                                        </li>
                                                    {% else %}
                                                        <li>
                                                            {% if use_ajax_login %}
                                                                <a id="a-register-link" href="{{ register }}">{{ text_register }}</a>
                                                            {% else %}
                                                                <a href="{{ register }}">{{ text_register }}</a>
                                                            {% endif %}
                                                        </li>
                                                        <li>
                                                            {% if use_ajax_login %}
                                                                <a id="a-login-link" href="{{ login }}">{{ text_login }}</a>
                                                            {% else %}
                                                                <a href="{{ login }}">{{ text_login }}</a>
                                                            {% endif %}
                                                        </li>
                                                    {% endif %}
                                                </ul>
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </nav>
                    </div>
                    <div class="search-containers pull-right">{{ search }}</div>
                </div>
            </div>
        </div>
        <div class="main-menu">
            {% if block1 %}
                {{ block1 }}
            {% endif %}
        </div>


        {% if facebook_messenger_enabled_FAE == 'true' %}
        <!-- Facebook JSSDK -->
        <script>
          window.fbAsyncInit = function() {
            FB.init({
              appId            : '',
              autoLogAppEvents : true,
              xfbml            : true,
              version          : '{{ facebook_jssdk_version_FAE }}'
            });
          };

          (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 = "https://connect.facebook.net/{{ facebook_customization_locale_FAE }}/sdk/xfbml.customerchat.js";
             fjs.parentNode.insertBefore(js, fjs);
           }(document, 'script', 'facebook-jssdk'));
        </script>
        <div
          class="fb-customerchat"
          attribution="fbe_opencart"
          page_id="{{ facebook_page_id_FAE }}"
          {{ facebook_customization_greeting_text_code_FAE }}
          {{ facebook_customization_theme_color_code_FAE }}
        />
        {% endif %}
      
    </header>
{% endspaceless %}
<div class="wrapper">
