{* Build the category selection *}
{strip}

{if $smarty.const.CAT_SELECTION_METHOD eq 1}
   {if !empty ($CategoryTitle)}{$CategoryTitle}{else}{l}Please select a category!{/l}{/if}
   <input type="hidden" id="CATEGORY_ID" name="CATEGORY_ID" value="{$CATEGORY_ID}" />
   
{elseif $smarty.const.CAT_SELECTION_METHOD eq 2 && $link_type_details.MULTIPLE_CATEGORIES<=1}
   <div id="catTitle">
      {if !empty ($CategoryTitle)}{$CategoryTitle}{else}{l}Please select a category!{/l}{/if}
   </div>
   <span id="toggleCategTree">{l}Change category{/l}</span>
   <input type="hidden" id="CATEGORY_ID" name="CATEGORY_ID" value="{$CATEGORY_ID}" />
   <div id="categtreebox"></div>

{else}
   {*html_options options=$categs selected=$CATEGORY_ID name="CATEGORY_ID"*}
   {if $additional_categs}
   <select name="ADD_CATEGORY_ID[]" id="ADD_CATEGORY_ID{math equation='rand(10,100)'}">
   {else}
   <select name="CATEGORY_ID" id="CATEGORY_ID">
    {/if}
    {foreach from=$categs key=k item=v}
    {if !$additional_categs}
        <option value="{$k}" {if (($CATEGORY_ID eq $k) && ($CATEGORY_ID neq 0))} selected="selected" {/if} {if $v.closed eq 1}disabled = "disabled" {/if}>{$v.val}</option>
        {else}
        <option value="{$k}" {if (($selected eq $k) && ($selected neq 0) && $additional_categs)} selected="selected" {/if} {if $v.closed eq 1}disabled = "disabled" {/if}>{$v.val}</option>
       {/if}
    {/foreach}
   </select>
{/if}
{/strip}