{if !$elem_html}
    {assign var=elem_html value=$item.elem_html}
{/if}
{strip}
    <div cat="{$item.category}" id="div_{$item.name_for_lang}{if $couple}_couple{/if}" class="div_name_for_lang" name_for_lang="{$item.name_for_lang}" style="padding-left: 5px; padding-right: 5px; width: 100%; {if $background}background:{if $smarty.foreach.elements.iteration is div by 2}#ffffff{else}#f9f9f9{/if}{/if};">

        {if $item.name_for_lang eq 'id_within'}
        {else}
            <div class="reg_field_title">
                {if $item.position_text == 'top' || $item.position_text == 'left'}
                    {if $item.category eq 'custom'}
                        {if $lang.userspr[$item.name_for_lang] ne ''}
                            {$lang.userspr[$item.name_for_lang]}
                        {else}
                            {$item.name_for_lang}
                        {/if}
                    {else}
                        {if $lang.profile[$item.name_for_lang] ne ''}
                            {$lang.profile[$item.name_for_lang]}
                        {else}
                            {$item.name_for_lang}
                        {/if}
                    {/if}
                {else}
                    {$elem_html}
                {/if}
            {if $item.mandatory == '1'}<font class="error_msg">*</font>{/if}
        </div>
    {/if}
{/strip}

{if $item.name_for_lang eq 'id_within'}
{else}
    <div class="reg_field_input2">
        {if isset($item.user_types)}
            {literal}
                <script type="text/javascript">
                    function Show{/literal}{$item.name_for_lang}{literal}Subtypes(id_div) {
                        {/literal}
                        {foreach item=subitem from=$item.user_types}
                            {if isset($subitem.subtypes)}
                                document.getElementById('{$subitem.id}_{$item.name_for_lang}').style.display = 'none';
                            {/if}
                        {/foreach}
                        {literal}
                        if (document.getElementById(id_div)) {
                                document.getElementById(id_div).style.display = 'block';
                        }
                        return false;
                    }
                </script>
            {/literal}
            {foreach item=subitem from=$item.user_types}
                <input type="radio" {if $subitem.sel eq 1}checked{/if} name="{$item.name_for_lang}[]" value="{$subitem.id}" id="{$item.name_for_lang}{$subitem.id}" onclick="{if $item.name_for_lang eq 'im'}Change('{$subitem.pair}');{/if} Show{$item.name_for_lang}Subtypes('{$subitem.id}_{$item.name_for_lang}');">&nbsp;<label for="{$item.name_for_lang}{$subitem.id}">{$subitem.name}</label>&nbsp;&nbsp;&nbsp;
            {/foreach}
            {foreach item=subitem from=$item.user_types}
                {if isset($subitem.subtypes)}
                    {if $item.name_for_lang eq 'im'}
                        <div id="{$subitem.id}_{$item.name_for_lang}" style="{if $subitem.sel ne 1}display: none;{/if} padding-top: 5px;">
                            <select name="sub_{$item.name_for_lang}">
                                <option value="">{$lang.button.nothing}</option>
                                {foreach item=subitem2 from=$subitem.subtypes}
                                    <option value="{$subitem2.id}" id="sub_{$item.name_for_lang}{$subitem2.id}" {if $subitem2.sel eq 1}selected{/if}>{$subitem2.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    {else}    
                    <div id="{$subitem.id}_{$item.name_for_lang}" style="{if $subitem.sel ne 1}display: none;{/if} padding-top: 5px;">
                        {foreach item=subitem2 from=$subitem.subtypes}
                            <input type="checkbox" name="sub_{$item.name_for_lang}[]" value="{$subitem2.id}" id="sub_{$item.name_for_lang}{$subitem2.id}" {if $subitem2.sel eq 1}checked{/if}>&nbsp;<label for="sub_{$item.name_for_lang}{$subitem2.id}">{$subitem2.name}</label>&nbsp;&nbsp;&nbsp;
                        {/foreach}
                    </div>
                    {/if}
                {/if}
            {/foreach}
        {elseif $item.name_for_lang eq 'id_city'}
            <select name="id_city">
                <option value="">{$lang.mobile.other_city}</option>
                {foreach item=subitem from=$item.values}
                    <option value="{$subitem.id}" {if $subitem.sel eq 1}selected{/if}>{$subitem.name}</option>
                {/foreach}
            </select>
        {else}
            {strip}
                {if $item.position_text == 'left'}
                    {$elem_html}
                {elseif $item.position_text == 'right'}
                    {if $item.category eq 'custom'}
                        {if $lang.userspr[$item.name_for_lang] ne ''}
                            {$lang.userspr[$item.name_for_lang]}
                        {else}
                            {$item.name_for_lang}
                        {/if}
                    {else}
                        {if $lang.profile[$item.name_for_lang] ne ''}
                            {$lang.profile[$item.name_for_lang]}
                        {else}
                            {$item.name_for_lang}
                        {/if}
                    {/if}
                {/if}
            {/strip}
        {/if}
        {if $item.name_for_lang eq 'looking_for'}
            {strip}
                <div style="margin-top: 10px;">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td style="padding-left: 5px;" class="text">{$lang.users.from_big}</td>
                            <td style="padding-left: 5px;">
                                <select name="looking_for[]" {if $data.root eq 1}disabled{/if}>
                                    {foreach item=item from=$age_min}
                                        <option value="{$item}" {if $min_age_sel eq $item}selected{/if}>{$item}</option>
                                    {/foreach}
                                </select>
                            </td>
                            <td style="padding-left: 10px;" class="text">{$lang.users.to_big}</td>
                            <td style="padding-left: 5px;">
                                <select name="looking_for[]" {if $data.root eq 1}disabled{/if}>
                                    {foreach item=item from=$age_max}
                                        <option value="{$item}" {if $max_age_sel eq $item}selected{/if}>{$item}</option>
                                    {/foreach}
                                </select>
                            </td>
                        </tr>
                    </table>
                </div>
            {/strip}
        {/if}
    </div>
{/if}
    
    
    {*
    <table cellpadding="{if $item.position_text == 'inline'}0{else}0{/if}" cellspacing="0" width="100%">
    <tr>
    {if $item.position_text == 'inline' || $item.category eq 'text_del'}
    {if $item.category ne 'text_del'}
    <td id="preview_1"  class="element" style="width: 10px;">
    {$elem_html}
    </td>
    {/if}
    <td {if $item.category eq 'text_del'}colspan="2"{/if} id="preview_2" mandatory="0" couple='0' enable_couple="0" enable_mandatory="0" class="name_for_lang" valign="top">
    {if $lang.profile[$item.name_for_lang] ne ''}
    {$lang.profile[$item.name_for_lang]}
    {else}
    {$item.name_for_lang}
    {/if}
    </td>
    {else}
    <td id="preview_1" {if $item.position_text == 'top' || $item.position_text == 'left'}class="name_for_lang"  valign="top" width="160px" {if $item.mandatory == '1'}mandatory="1"{/if}{else}class="element"{/if}>

    </td>
    <td id="preview_2" {if $item.position_text == 'left'}class="element"{elseif $item.position_text == 'right'}class="name_for_lang"  valign="top" {if $item.mandatory == '1'}mandatory="1"{/if}{/if}>
    {if $item.position_text == 'left'}
    {$elem_html}
    {elseif $item.position_text == 'right'}
    {if $item.category eq 'custom'}
    {if $lang.userspr[$item.name_for_lang] ne ''}
    {$lang.userspr[$item.name_for_lang]}
    {else}
    {$item.name_for_lang}
    {/if}
    {else}
    {if $lang.profile[$item.name_for_lang] ne ''}
    {$lang.profile[$item.name_for_lang]}
    {else}
    {$item.name_for_lang}
    {/if}
    {/if}
    {/if}
    </td>
    </tr>
    <tr>
    <td id="preview_3"{if $item.position_text == 'top'}class="element"{elseif $item.position_text == 'bottom'}class="name_for_lang"  valign="top" {if $item.mandatory == '1'}mandatory="1"{/if}{/if} style="{if $item.position_text == 'top' || $item.position_text == 'bottom'}padding-top:10px; padding-bottom:10px;{else}padding-top:0px; padding-bottom:0px;{/if}">
    {if $item.position_text == 'top'}
    {$elem_html}
    {elseif $item.position_text == 'bottom'}
    {if $item.category eq 'custom'}
    {if $lang.userspr[$item.name_for_lang] ne ''}
    {$lang.userspr[$item.name_for_lang]}
    {else}
    {$item.name_for_lang}
    {/if}
    {else}
    {if $lang.profile[$item.name_for_lang] ne ''}
    {$lang.profile[$item.name_for_lang]}
    {else}
    {$item.name_for_lang}
    {/if}
    {/if}
    {/if}
    </td>
    <td style="{if $item.position_text == 'top' || $item.position_text == 'bottom'}padding-top:10px; padding-bottom:10px;{else}padding-top:0px; padding-bottom:0px;{/if}">
    </td>
    </tr>
    {/if}
    </table>
    *}
</div>