{TEMPLATE add}
    {INCLUDE top}
    {INCLUDE menu}

    {INCLUDE js_calendar}
    <script type="text/javascript" src="{$CNCAT[abs]}{$CNCAT[system][dir_engine_scripts]}tinymce/tiny_mce.js"></script>

    <table class="pagetitle" style="margin: 10px auto 0 auto;" width="600">
        <tr><td class="title">
            {$CNCAT[lang][menu_add_item]}
        </td><td class="clear"></td></tr>
    </table>
    <table id="add_table" align="center">
    	<tr class="top"><td></td></tr>
        {DISPLAY FORM}
    </table>
    <table style="margin: 0 auto;" width="600">
        <tr><td>
            {cn_copyright(1)}
        </td></tr>
    </table>
    {INCLUDE bottom}
{/TEMPLATE}

{TEMPLATE final}
	<tr>
		<td colspan="2" class="text">{$CNCAT[lang][thanks_for_add]}
        {IF $CNCAT[config][display_ext]}
            {$CNCAT[lang][ext_after_submit]}
        {ENDIF}
	    <p><a href="{$CNCAT[abs]}">{$CNCAT[lang][return_to_main]}</a></p>
    </tr>
	{IF $CNCAT[config][add_mode] == 0}{DISPLAY BACKLINKS}{ENDIF}
{/TEMPLATE}

{TEMPLATE form}
    {IF $CNCAT[config][add_show_message] == 1}<tr><td colspan="2" class="text">{$CNCAT[config][add_message]}</td></tr>{ENDIF}
    <tr>
        <td colspan="2" class="text">{DISPLAY ERRORS}</td>
    </tr>
    {IF $CNCAT[config][add_accept_to_add] == 1}<tr><td colspan="2" class="text">{$CNCAT[lang][accept_work]}</td></tr>{ENDIF}
    {IF $CNCAT[config][add_accept_to_add] == 2}<tr><td colspan="2" class="text">{$CNCAT[lang][accept_work_with_back]}</td></tr>{ENDIF}
    {IF $CNCAT[config][add_check_link]}<tr><td colspan="2" class="text">{$CNCAT[lang][first_check_link]}</td></tr>{ENDIF}
    <form action="?submit" method="post">
        {INCLUDE field_link_url}
        {INCLUDE field_back_link}
        {INCLUDE field_site_title}
        {INCLUDE field_cats}
        {INCLUDE field_email}
        {INCLUDE field_author}
        {INCLUDE field_descr}
        {INCLUDE field_descr_full}
        {INCLUDE field_meta_keywords}
        {INCLUDE field_meta_descr}
		{DISPLAY FILTERS}
		{DISPLAY EXTFIELDS}
        {INCLUDE field_captcha}
        {INCLUDE field_submit}
    </form>
{/TEMPLATE}

{TEMPLATE step1}
    {IF $CNCAT[config][add_show_message] == 1}<tr><td colspan="2" class="text">{$CNCAT[config][add_message]}</td></tr>{ENDIF}
    <tr>
        <td colspan="2" class="text">{DISPLAY ERRORS}</td>
    </tr>
    {IF $CNCAT[config][add_accept_to_add] == 1}<tr><td colspan="2" class="text">{$CNCAT[lang][accept_work]}</td></tr>{ENDIF}
    {IF $CNCAT[config][add_accept_to_add] == 2}<tr><td colspan="2" class="text">{$CNCAT[lang][accept_work_with_back]}</td></tr>{ENDIF}
	{IF $CNCAT[config][add_check_link]}<tr><td colspan="2" class="text">{$CNCAT[lang][first_check_link]}</td></tr>{ENDIF}
    <form action="?submit" method="post">
		{INCLUDE field_site_title}
        {INCLUDE field_link_url}
        {INCLUDE field_captcha}
        <tr><td colspan="2" class="submit"><input type="submit" name="next" value="{$CNCAT[lang][do_next]}" /></td></tr>
    </form>
{/TEMPLATE}

{TEMPLATE step2}
    <tr>
        <td colspan="2" class="text">{DISPLAY ERRORS}</td>
    </tr>
	<tr><td colspan="2" class="text">
    {IF $CNCAT[config][add_accept_to_add] > 1}
        {$CNCAT[lang][first_check_back_link]}
    {ELSE}
        {$CNCAT[lang][back_link_not_required]}
    {ENDIF}
    </td></tr>
    <script type="text/javascript">
    function prev() {
        var addform = document.getElementById('addform');
        var prev = document.createElement('input');
        prev.setAttribute('type', 'hidden');
        prev.setAttribute('name', 'prev');
        prev.setAttribute('value', '1');
        addform.appendChild(prev);
        addform.submit();
    }
    </script>
    <form action="?submit" method="post" id="addform">
        {INCLUDE field_link_url}
        {IF $CNCAT[config][add_use_back_link]}{INCLUDE field_back_link}{ENDIF}
        {DISPLAY BACKLINKS}
        <tr><td colspan="2" class="submit"><input type="button" value="{$CNCAT[lang][do_back]}" onclick="prev()" /> <input type="submit" name="next" value="{$CNCAT[lang][do_next]}" /></td></tr>
    </form>
{/TEMPLATE}

{TEMPLATE step3}
    <tr>
        <td colspan="2" class="text">{DISPLAY ERRORS}</td>
    </tr>
    <script type="text/javascript">
    function prev() {
        var addform = document.getElementById('addform');
        var prev = document.createElement('input');
        prev.setAttribute('type', 'hidden');
        prev.setAttribute('name', 'prev');
        prev.setAttribute('value', '1');
        addform.appendChild(prev);
        addform.submit();
    }
    </script>
    <form action="?submit" method="post" id="addform">
        {INCLUDE field_link_url}
        {IF $CNCAT[config][add_use_back_link]}{INCLUDE field_back_link}{ENDIF}
        {INCLUDE field_site_title}
        {INCLUDE field_cats}
        {INCLUDE field_email}
        {INCLUDE field_author}
        {INCLUDE field_descr}
        {INCLUDE field_descr_full}
        {INCLUDE field_meta_keywords}
        {INCLUDE field_meta_descr}
		{DISPLAY FILTERS}
		{DISPLAY EXTFIELDS}
        <tr><td colspan="2" class="submit"><input type="button" value="{$CNCAT[lang][do_back]}" onclick="prev()" /> <input type="submit" name="next" value="{$CNCAT[lang][do_next]}" /></td></tr>
    </form>
{/TEMPLATE}

{TEMPLATE field_link_url}
        <tr>
            <td class="name">{$CNCAT[lang][field_link_url]}:</td>
            <td class="field">
                <input type="text" class="{IF $CNCAT[add][readonly_link_url]}read{ELSE}text{ENDIF}" name="link_url" value="{cn_str($CNCAT[add][link_url])}" {IF $CNCAT[add][readonly_link_url]}readonly="readonly"{ENDIF} />
            </td>
        </tr>
{/TEMPLATE}

{TEMPLATE field_back_link}
        {IF $CNCAT[config][add_use_back_link]}
        <tr>
            <td class="name">{$CNCAT[lang][field_back_link]}:</td>
            <td class="field">
                <input type="text" class="{IF $CNCAT[add][readonly_back_link]}read{ELSE}text{ENDIF}" name="back_link" value="{cn_str($CNCAT[add][back_link])}" {IF $CNCAT[add][readonly_back_link]}readonly="readonly"{ENDIF} />
            </td>
        </tr>
        {ENDIF} 
{/TEMPLATE}

{TEMPLATE field_site_title}
        <tr>
            <td class="name">{$CNCAT[lang][field_site_title]}:</td>
            <td class="field"><input type="text" class="text" name="site_title" value="{cn_str($CNCAT[add][site_title])}" /></td>
        </tr>
{/TEMPLATE}

{TEMPLATE field_cats}
        <script type="text/javascript">
        //<![CDATA[
            var count = 0;
    
            function checkCats(c) {
                if (c.checked) {
                    count++;

                    if (count > {$CNCAT[config][add_max_cats]}) {
                        c.checked = false;
                        count = {$CNCAT[config][add_max_cats]};
                        alert("{$CNCAT[lang][cats_to_long]}");
                    }
                } else {
                    count--;
                }
            }
        //]]>
        </script>
        <tr><td colspan="2" class="name">{$CNCAT[lang][field_cats]}:</td></tr>
        <tr><td colspan="2" class="text">
            <div class="categories">{DISPLAY CATEGORIES}</div>
        </td><tr> 
{/TEMPLATE}

{TEMPLATE field_email}
        <tr>
            <td class="name">{$CNCAT[lang][field_email]}:</td>
            <td class="field"><input type="text" class="text" name="email" value="{cn_str($CNCAT[add][email])}" /></td>
        </tr>
{/TEMPLATE}

{TEMPLATE field_author}
    {IF $CNCAT[config][add_use_author]}
        <tr>
            <td class="name">{$CNCAT[lang][field_author]}:</td>
            <td class="field">
                <input type="text" class="text" name="author" value="{cn_str($CNCAT[add][author])}" />
            </td>
        </tr>
    {ENDIF}
{/TEMPLATE}

{TEMPLATE field_descr}
        <tr><td colspan="2" class="name">{$CNCAT[lang][field_descr]}:</td></tr>
        <tr>
            <td colspan="2" class="text">
                <textarea name="descr">{cn_str($CNCAT[add][descr])}</textarea>
            </td>
        </tr>
{/TEMPLATE}

{TEMPLATE field_descr_full}
        {IF $CNCAT[config][add_use_descr_full]}
        <tr><td colspan="2" class="name">{$CNCAT[lang][field_descr_full]}:</td></tr>
        <tr><td colspan="2" class="name">
                {DISPLAY EDITOR}
        </td></tr>
        {ENDIF}
{/TEMPLATE}

{TEMPLATE field_meta_keywords}
        {IF $CNCAT[config][add_use_meta_keywords]}
        <tr>
            <td class="name">{$CNCAT[lang][field_meta_keywords]}:</td>
            <td class="field"><input type="text" class="text" name="meta_keywords" value="{cn_str($CNCAT[add][meta_keywords])}" /></td>
        </tr>
        {ENDIF}
{/TEMPLATE}

{TEMPLATE field_meta_descr}
        {IF $CNCAT[config][add_use_meta_descr]}
        <tr>
            <td class="name">{$CNCAT[lang][field_meta_descr]}:</td>
            <td class="field"><input type="text" class="text" name="meta_descr" value="{cn_str($CNCAT[add][meta_descr])}" /></td>
        </tr>
        {ENDIF}
{/TEMPLATE}

{TEMPLATE field_captcha}
        {IF $CNCAT[config][add_use_captcha]}
        <tr><td colspan="2" class="name">{$CNCAT[lang][input_image_code]}:</td></tr>
        <tr>
            <td class="name"><img src="cncat_code.php?{$CNCAT[add][rand]}" alt="" onclick="this.src='cncat_code.php?'+Math.random();"></td>
            <td class="field"><input type="text" class="text" name="captcha_code" value="{cn_str($CNCAT[add][captcha_code])}" /></td>
        </tr>
        {ENDIF}
{/TEMPLATE}

{TEMPLATE field_submit}
        <tr>
            <td class="submit" colspan="2"><input type="submit" name="next" value="{$CNCAT[lang][do_submit]}" /></td>
        </tr>
{/TEMPLATE}

{TEMPLATE add_filter_top}
        <tr>
			<td class="name">{cn_str($CNCAT[filter][title])}:</td>
			<td class="field">
{/TEMPLATE}
{TEMPLATE add_filtval}
                <input type="checkbox" name="filters[{$CNCAT[filter][id]}][]" value="{cn_str($CNCAT[filtval][id])}" id="filtval_{$CNCAT[filtval][id]}"  {IF $CNCAT[filtval][_checked]}checked="checked"{ENDIF} /> <label for="filtval_{$CNCAT[filtval][id]}">{cn_str($CNCAT[filtval][title])}</label><br />
{/TEMPLATE}
{TEMPLATE add_filter_bottom}
			</td>
		</tr>
{/TEMPLATE}

{TEMPLATE add_backlinks_top}
        <tr><td colspan="2" class="text">{$CNCAT[lang][backlinks_list]}:</td></tr>
        <tr><td colspan="2" class="text">
            <table width="100%" class="backlinks">
{/TEMPLATE}

{TEMPLATE add_backlink}
                <tr><td class="left" width="50%">
                    <div class="user_code">{cn_str($CNCAT[backlink][user_code])}</div>
                </td><td class="right" width="50%">
                    {$CNCAT[backlink][user_code]}
                </td></tr>
{/TEMPLATE}

{TEMPLATE add_backlinks_bottom}
            </table>
        </td></tr>
{/TEMPLATE}

{TEMPLATE add_errors_top}
    <tr>
        <td colspan="2" class="text">
            <strong>{$CNCAT[lang][add_errors_occurred]}</strong><br />
            <ul class="errors">
{/TEMPLATE}

{TEMPLATE add_error}
                <li>{$CNCAT[error][text]}</li>
{/TEMPLATE}

{TEMPLATE add_errors_bottom}
            <ul>
        </td>
    </tr>
{/TEMPLATE}

{TEMPLATE add_cat_next_level}
    <ul class="catmap_level{$CNCAT[cat][tree_level]}">
{/TEMPLATE}

{TEMPLATE add_cat
    (CAT[id, title, disable_add])
}
    <li style="color: {IF $CNCAT[cat][disable_add]}gray{ELSE}black{ENDIF};">
        {IF !$CNCAT[cat][disable_add]}
            <input type="checkbox" name="cats[]" value="{$CNCAT[cat][id]}" id="cat_{$CNCAT[cat][id]}" {IF $CNCAT[cat][_checked]}checked="checked"{ENDIF} onclick="checkCats(this)" /> <label for="cat_{$CNCAT[cat][id]}">{cn_str($CNCAT[cat][title])}</label>
        {ELSE}
            {cn_str($CNCAT[cat][title])}
        {ENDIF}
    </li>
{/TEMPLATE}

{TEMPLATE add_cat_prev_level}
    </ul>    
{/TEMPLATE}

{TEMPLATE extfield_ext_int1}
        <tr>
            <td>{$CNCAT[lang][extfield_ext_int1]}:</td>
            <td><input type="text" class="text" name="ext_int1" value="{cn_str($CNCAT[add][ext_int1])}" /></td>
        </tr>
{/TEMPLATE}

{TEMPLATE extfield_ext_double1}
        <tr>
            <td>{$CNCAT[lang][extfield_ext_double1]}:</td>
            <td><input type="text" class="text" name="ext_double1" value="{cn_str($CNCAT[add][ext_double1])}" /></td>
        </tr>
{/TEMPLATE}

{TEMPLATE extfield_ext_varchar1}
        <tr>
            <td>{$CNCAT[lang][extfield_ext_varchar1]}:</td>
            <td><input type="text" class="text" name="ext_varchar1" value="{cn_str($CNCAT[add][ext_varchar1])}" /></td>
        </tr>
{/TEMPLATE}

{TEMPLATE extfield_ext_datetime1}
        <tr>
            <td class="name">{$CNCAT[lang][extfield_ext_datetime1]}:</td>
            <td class="field">
                <div id="ext_datetime1_calendar" class="calendar"></div>
                <input type="text" class="text" style="width: 70%;" id="ext_datetime1" name="ext_datetime1" value="{cn_str($CNCAT[add][datetime])}" readonly="readonly" />
                <a href="javascript: ShowCalendarE('ext_datetime1_calendar', 'ext_datetime1', 0);"><img src="{$THEMEURL}images/calendar.gif" alt="" /></a>
            </td>
        </tr>
{/TEMPLATE}

{TEMPLATE extfield_ext_text1}
        <tr>
            <td>{$CNCAT[lang][extfield_ext_text1]}:</td>
            <td><textarea name="ext_text1">{cn_str($CNCAT[add][ext_text1])}</textarea></td>
        </tr>
{/TEMPLATE}

{TEMPLATE extfield_ext_text2}
        <tr>
            <td>{$CNCAT[lang][extfield_ext_text2]}:</td>
            <td><textarea name="ext_text2">{cn_str($CNCAT[add][ext_text2])}</textarea></td>
        </tr>
{/TEMPLATE}

{TEMPLATE extfield_ext_text3}
        <tr>
            <td>{$CNCAT[lang][extfield_ext_text3]}:</td>
            <td><textarea name="ext_text3">{cn_str($CNCAT[add][ext_text3])}</textarea></td>
        </tr>
{/TEMPLATE}
