<script id="main_template" type="text/x-handlebars-template">
    <style type="text/css">
        #nav-dropdown-search-input:focus{
            outline: none;
        }
    </style>

    <ul id="items-container-mobile" class="nav hidden-desktop">
    <%--menu items will be loaded here--%>
    </ul>
    <ul class="nav visible-desktop">
    <li class="dropdown visible-desktop">
    <a id="drop1" class="dropdown-toggle brand" data-toggle="dropdown" style="cursor:pointer;">
    <asp:Localize runat="server" meta:resourcekey="menu_title" /><b class="caret"></b>
    </a>
    <ul class="dropdown-menu" role="menu" aria-labelledby="drop1" id="items-container-desktop">
        <%--<li>
            <form onsubmit="return false;" style="margin-bottom:0px;padding-top:5px;">
                <div style="padding-left:10px; display:inline-block">
                    <label class="pull-left" for="nav-dropdown-search-input"><i class="icon-search"></i></label>
                    <input id="nav-dropdown-search-input" class="pull-left input-small" style="border:none;border-bottom:1px solid #ccc; margin-left:10px;" />
                </div>
            </form>
        </li>--%>
        <%--menu items will be loaded here--%>
    </ul>
    </li>

    </ul>
</script>

<script id="menu_options_template" type="text/x-handlebars-template">
    {{#each items}}
        {{#if OpenSideSubmenu}}
        <li class="dropdown-submenu">
            <a class="stop-propag" tabindex="-1">{{Name}}</a>
            {{#if children}}
                <ul class="dropdown-menu">
                {{#each children}}
                    
                    {{#if OpenSideSubmenu}}
                    <li class="dropdown-submenu">
                        <a class="stop-propag" tabindex="-1">{{Name}}</a>
                        {{#if children}}
                            <ul class="dropdown-menu">
                            {{#each children}}
                                <li {{#if children}}class="nav-header"{{/if}}>
                                    {{#if URL}}
                                        <a href="{{URL}}">{{Name}}</a>
                                    {{else}}
                                        {{Name}}
                                    {{/if}}
                                </li>       
                                {{#each children}}
                                <li>
                                    <a href="{{URL}}">{{Name}}</a>
                                </li>
                                {{/each}}

                            {{/each}}
                            </ul>
                        {{/if}}
                    </li>
                    {{else}}
                    <li {{#if children}}class="nav-header"{{/if}}>
                        {{#if URL}}
                            <a href="{{URL}}">{{Name}}</a>
                        {{else}}
                            {{Name}}
                        {{/if}}
                    </li>
                    {{#each children}}
                    <li>
                        <a href="{{URL}}">{{Name}}</a>
                    </li>
                    {{/each}}
                    {{/if}}
                    

                {{/each}}
                </ul>
            {{/if}}
        </li>
        {{else}}
        <li {{#if children}}class="nav-header"{{/if}}>
            {{#if URL}}
                <a href="{{URL}}">{{Name}}</a>
            {{else}}
                {{Name}}
            {{/if}}
        </li>
        {{#each children}}
        {{#if OpenSideSubmenu}}
        <li class="dropdown-submenu">
            <a class="stop-propag" tabindex="-1">{{Name}}</a>
            {{#if children}}
                <ul class="dropdown-menu">
                {{#each children}}
                    
                    {{#if OpenSideSubmenu}}
                    <li class="dropdown-submenu">
                        <a class="stop-propag" tabindex="-1">{{Name}}</a>
                        {{#if children}}
                            <ul class="dropdown-menu">
                            {{#each children}}
                                <li {{#if children}}class="nav-header"{{/if}}>
                                    {{#if URL}}
                                        <a href="{{URL}}">{{Name}}</a>
                                    {{else}}
                                        {{Name}}
                                    {{/if}}
                                </li>       
                                {{#each children}}
                                <li>
                                    <a href="{{URL}}">{{Name}}</a>
                                </li>
                                {{/each}}

                            {{/each}}
                            </ul>
                        {{/if}}
                    </li>
                    {{else}}
                    <li {{#if children}}class="nav-header"{{/if}}>
                        {{#if URL}}
                            <a href="{{URL}}">{{Name}}</a>
                        {{else}}
                            {{Name}}
                        {{/if}}
                    </li>
                    {{#each children}}
                    <li>
                        <a href="{{URL}}">{{Name}}</a>
                    </li>
                    {{/each}}
                    {{/if}}
                    

                {{/each}}
                </ul>
            {{/if}}
        </li>
        {{else}}
        <li {{#if children}}class="nav-header"{{/if}}>
            {{#if URL}}
                <a href="{{URL}}">{{Name}}</a>
            {{else}}
                {{Name}}
            {{/if}}
        </li>
        {{#each children}}
        <li>
            <a href="{{URL}}">{{Name}}</a>
        </li>
        {{/each}}
        {{/if}}
        {{/each}}
        {{/if}}
    {{/each}}
</script>