<script type="text/javascript">
<!--
    /* <![CDATA[ */
        MT.App.categoryList = <$mt:if name="category_tree"><$mt:var name="category_tree" to_json="1" regex_replace="/(s)(cript)/ig","$1\\$2"$><mt:else>[]</mt:if>;
        Template.templates.categorySelectorList = '<mt:section encode_js="1">
                [# if ( item.path == null ) item.path = [] #]
                <div style="text-align:left; margin-left:[#= item.path.length * 10 #]px">
                <mt:if name="can_edit_categories">
                    <a href="javascript:void(0);" mt:id="[#= item.id #]" mt:command="show-add-category" class="add-category-new-link"><span>Add</span>&nbsp;</a>
                </mt:if>
                    <div style="width: [#= 165 - (item.path.length * 10) #]px;">
                        <input type="<mt:if name="object_type" eq="page">radio<mt:else>checkbox</mt:if>" name="<mt:if name="object_type" eq="entry">add_</mt:if>category_id<mt:if name="object_type" eq="entry">_[#= item.id #]</mt:if>" class="add-category-checkbox" <mt:if name="category_is_selected">checked="checked"</mt:if> /> [#|h item.label #]
                    </div>
                </div>
        </mt:section>';
        Template.templates.categorySelectorAddForm = '<mt:section encode_js="1">
<mt:if name="object_type" eq="entry">
        [# div.className="add-category-form hidden" #]<input id="add-category-input-movable" class="add-category-input input-hint" type="text" value="[#|h trans( "Add sub category" ) #]" mt:default="[#|h trans( "Add sub category" ) #]" mt:delegate="default-value" /> <a href="javascript:void(0);" mt:command="add" class="add-category-save-link"><span>Add</span>&nbsp;&nbsp;&nbsp;</a><a href="javascript:void(0);" mt:command="cancel" class="add-category-cancel-link"><span>[#|h trans( "Cancel" ) #]</span>&nbsp;&nbsp;&nbsp;</a>
<mt:else>
        [# div.className="add-category-form hidden" #]<input id="add-category-input-movable" class="add-category-input input-hint" type="text" value="[#|h trans( "Add sub folder" ) #]" mt:default="[#|h trans( "Add sub folder" ) #]" mt:delegate="default-value" /> <a href="javascript:void(0);" mt:command="add" class="add-category-save-link"><span>Add</span>&nbsp;&nbsp;&nbsp;</a><a href="javascript:void(0);" mt:command="cancel" class="add-category-cancel-link"><span>[#|h trans( "Cancel" ) #]</span>&nbsp;&nbsp;&nbsp;</a>
</mt:if>
        </mt:section>';
    <mt:ignore>
        <__trans phrase="Add sub category">
        <__trans phrase="Cancel">
    </mt:ignore>
    /* ]]> */
-->
</script>

<div id="<$mt:var name="container_type" lower_case="1"$>-selector" class="category-selector hidden">
<mt:if name="object_type" eq="entry">
    <mt:if name="can_edit_categories">
    <div class="category-selector-header">
        <a class="add-category-new-parent-link" mt:command="show-add-category" href="javascript:void(0);" title="<$mt:var name="add_new_container_label_parent"$>"><__trans phrase="Add"></a>
    </div>
    </mt:if>
</mt:if>
<mt:if name="can_edit_categories">
    <div id="add-category-form" class="add-category-form hidden">
        <input id="add-category-input" class="add-category-input input-hint" type="text" value="<$mt:var name="add_container_label"$>" mt:default="<$mt:var name="add_container_label_name"$>" mt:delegate="default-value" />
        <a href="javascript:void(0);" mt:command="add" class="add-category-save-link"><span>Add</span></a>
        <a href="javascript:void(0);" mt:command="cancel" class="add-category-cancel-link"><span>Cancel</span></a>
    </div>
</mt:if>
    <div id="<$mt:var name="container_type" lower_case="1"$>-selector-list" class="category-selector-list"></div>
</div><!-- /category-selector -->
