{strip}<title>{$Template->getTitle()}</title>{/strip}

<!-- [begin] meta -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

{if $Template->getAttribute('html5') === false}
<meta http-equiv="content-language" content="{$Project->getlang()}" />
<meta name="page-topic" content='{$Site->getAttribute('title')|escape:'html'}" />

<meta name="date" content="{$Site->getAttribute('e_date')}" />
<meta name="copyright" content="{$Project->getConfig('meta.copyright')}" />
{/if}

<meta name="description" content="{$Site->getAttribute('meta.description')|escape:'html'}" />
<meta name="keywords" content="{$Site->getAttribute('meta.keywords')|escape:'html'}" />

{if $Locale->no_translation}
<meta name="robots" content="noindex" />
<meta name="googlebot" content="noindex"/>
{else}
<meta name="robots" content="{$Site->getAttribute('meta.robots')}" />
<meta name="googlebot" content="{$Site->getAttribute('meta.robots')}"/>
{/if}

<meta name="generator" content="{$smarty.const.GENERATOR}" />
<meta name="author" content="{$Site->getAttribute('meta.author')}" />
{if $Site->getAttribute('meta.publisher')}
<meta name="publisher" content="{$Site->getAttribute('meta.publisher')|escape:'html'}" />
{/if}
<meta name="revisit-after" content="{$Site->getAttribute('meta.revisit')}" />

{$Favicon->output($Project)}

<script type="text/javascript" data-no-cache="1">
    var URL_DIR          = '{$URL_DIR}',
        URL_OPT_DIR      = '{$URL_OPT_DIR}',
        URL_BIN_DIR      = '{$URL_BIN_DIR}',
        URL_LIB_DIR      = '{$URL_LIB_DIR}',
        URL_VAR_DIR      = '{$URL_VAR_DIR}',
        URL_PROJECT_DIR  = '{$URL_USR_DIR}{$Project->getName()}/',
        URL_TEMPLATE_DIR = '{$URL_OPT_DIR}{$Project->getAttribute('template')}/';

    var QUIQQER = {
        lu : '{$lastUpdate|md5}',
        ajax: '{$URL_DIR}ajax.php',
        title: '{$Template->getTitle()|escape:"html"}',
        country: '{$systemCountry}',
        locale: '{$localePublishVersion}'
    };

    {assign var=httpshost value=$Project->getVHost( true, true )}
    var QUIQQER_PROJECT = {
        name      : '{$Project->getName()}',
        lang      : '{$Project->getLang()}',
        languages : '{$languages}',
        logo      : '{if isset($projectLogo)}{$projectLogo}{/if}',
        template  : '{$Project->getAttribute("template")|escape:"html"}',
        httpshost : {if strpos( $httpshost, 'https' ) !== false}'{$httpshost}'{else}false{/if}
    };

    var QUIQQER_SITE = {
        id   : '{$Site->getId()}',
        type : '{$Site->getAttribute("type")}',
        url  : '{$Site->getUrlRewritten()}'
    };

    var QUIQQER_ONLOAD_MODULES = {$loadModuleFiles|json_encode:true},
        QUIQQER_FRONTEND       = 1,
        QUIQQER_LOCALE         = {$localeFiles|json_encode:true};

    {if "LOGIN_FAILED"|defined}
        {if LOGIN_FAILED|is_string}
        var QUIQQER_LOGIN_FAILED = "{$smarty.const.LOGIN_FAILED}";
        {else}
        var QUIQQER_LOGIN_FAILED = "{locale group="quiqqer/core" value="exception.login.fail"}";
        {/if}
    {/if}

</script>

<script id="quiqqer-user-defined">
    {assign var=userCountry value=$User->getCountry()}
    var QUIQQER_USER = {
        id   : '{$User->getUUID()}',
        name : '{$User->getName()}',
        lang : '{$User->getLang()}',
        isNobody : {$sessionUserIsNobody},
        isLoggedIn : {$sessionUserIsAuth},
        country: {if $userCountry}'{$userCountry->getCode()}'{else}false{/if}
    };
</script>

<!-- quiqqer-js-defined -->
{*if $Template->getAttribute('mootools')}
<!-- mootools -->
<script src="{$URL_OPT_DIR}bin/qui/qui/lib/mootools-core.js?lu={$lastUpdate}"></script>
<script src="{$URL_OPT_DIR}bin/qui/qui/lib/mootools-more.js?lu={$lastUpdate}"></script>
<script src="{$URL_OPT_DIR}bin/qui/qui/lib/moofx.js?lu={$lastUpdate}"></script>
{/if*}

{if $Template->getAttribute('requirejs')}
<!-- include components -->
<script src="{$URL_OPT_DIR}bin/quiqqer-asset/requirejs/requirejs/require.js?lu={$lastUpdate|md5}"></script>
<script>
    require.config({
        baseUrl : URL_DIR,
        paths   : {
            "assets"    : URL_OPT_DIR +'bin',
            "package"   : URL_OPT_DIR,
            "locale"    : URL_VAR_DIR +'locale/bin',
            "qui"       : URL_OPT_DIR +'bin/qui/qui',
            "classes"   : URL_BIN_DIR +'QUI/classes',
            "controls"  : URL_BIN_DIR +'QUI/controls',
            "utils"     : URL_BIN_DIR +'QUI/utils',
            "polyfills" : URL_BIN_DIR +'QUI/polyfills',
            "Controls"  : URL_BIN_DIR +'Controls',
            "project"   : URL_TEMPLATE_DIR +'bin/js',

            "Ajax"          : URL_BIN_DIR +'QUI/Ajax',
            "Locale"        : URL_BIN_DIR +'QUI/Locale',
            "UploadManager" : URL_BIN_DIR +'QUI/UploadManager',
            "Mustache"      : URL_OPT_DIR + 'bin/quiqqer-asset/mustache/mustache/mustache.min',
            "QUIQQER"       :  URL_OPT_DIR + 'quiqqer/core/bin/QUI/QUIQQER',
            "Packages"      :  URL_OPT_DIR + 'quiqqer/core/bin/QUI/Packages',

            "MooToolsCore"      : URL_OPT_DIR + "bin/qui/qui/lib/mootools-core",
            "MooToolsMore"      : URL_OPT_DIR + "bin/qui/qui/lib/mootools-more",
            "MooFX"             : URL_OPT_DIR + "bin/qui/qui/lib/moofx",
            "URI"               : URL_OPT_DIR + 'bin/quiqqer-asset/urijs/urijs/src/URI',
            'IPv6'              : URL_OPT_DIR + 'bin/quiqqer-asset/urijs/urijs/src/IPv6',
            'punycode'          : URL_OPT_DIR + 'bin/quiqqer-asset/urijs/urijs/src/punycode',
            'SecondLevelDomains': URL_OPT_DIR + 'bin/quiqqer-asset/urijs/urijs/src/SecondLevelDomains'
        },
        waitSeconds : 0,
        locale      : QUIQQER_USER.lang +"-"+ QUIQQER_USER.lang,
        catchError  : true,
        urlArgs     : "update={$lastUpdate}&locale={$localePublishVersion}",

        map : {
            '*': {
                'css'    : URL_OPT_DIR +'bin/qui/qui/lib/css.min.js',
                'image'  : URL_OPT_DIR +'bin/qui/qui/lib/image.min.js',
                'text'   : URL_OPT_DIR +'bin/qui/qui/lib/text.min.js'
            }
        },

        shim: {
            URI : {
                deps: ['IPv6', 'punycode', 'SecondLevelDomains']
            },
            IPv6 : {
                exports: 'IPv6'
            },
            punycode : {
                exports: 'punycode'
            },
            SecondLevelDomains: {
                exports: 'SecondLevelDomains'
            },
            MooFX: {
                exports: 'moofx'
            },
            MooTools: {
                exports: 'MooTools',
                deps: ["MooToolsCore", "MooToolsMore", "MooFX"]
            },
            MooToolsCore: {
                exports: 'MooTools'
            },
            MooToolsMore: {
                deps: [
                    'MooToolsCore'
                ]
            }
        }
    });

    define('MooTools', ["MooToolsCore", "MooToolsMore", "MooFX"], function() {
        return MooTools;
    });
</script>

<script>
    (function() {
        var quiIsLoaded = false;

        window.whenQuiLoaded = function() {
            if (quiIsLoaded) {
                return Promise.resolve();
            }

            return new Promise(function(resolve) {
                setTimeout(function () {
                    whenQuiLoaded().then(resolve);
                }, 100);
            });
        };

        window.loadMootools = function() {
            return new Promise(function (resolve, reject) {
                require(['MooTools'], resolve, reject)
            });
        };

        // workaround for slower pcs
        whenQuiLoaded().then(function () {
            require(['qui/QUI'], function (QUI) {
                QUI.parse(document.body);
            });
        });


        var ready = function () {
            "use strict";

            loadMootools().then(function() {
                var needle = ['Locale'].concat(QUIQQER_LOCALE);

                require(needle, function (QUILocale) {
                    QUILocale.setCurrent(QUIQQER_PROJECT.lang);

                    if (window.location.toString().indexOf('lang=false') !== -1) {
                        QUILocale.no_translation = true;
                    }

                    // Load QUI
                    require(["qui/QUI"], function (QUI) {
                        quiIsLoaded = true;

                        QUI.addEvent("onError", function (msg, url, linenumber) {
                            console.error(msg);
                            console.error(url);
                            console.error("LineNo: " + linenumber);
                        });
                    });
                });
            });
        };

        if (document.readyState === 'complete') {
            ready();
        } else {
            document.addEventListener("DOMContentLoaded", ready);
        }
    })();
</script>
{/if}

<!-- canonical -->
{$Canonical->output()}

<!-- quiqqer css -->


{if $Template->getAttribute('rel_next')}
<link rel="next" href="{url site=$Smarty->getHeaderAttribute('rel_next')}" />
{/if}

{if $Template->getAttribute('rel_prev')}
<link rel="prev" href="{url site=$Smarty->getHeaderAttribute('rel_prev')}" />
{/if}

{$Hreflang->output()}


{if isset($siteStyle)}
<link href="{$siteStyle}" rel="stylesheet" />
{/if}

{if isset($siteScript)}
<script src="{$siteScript}" type="text/javascript"></script>
{/if}

{$headerExtend}
