{if $ajax eq 0}
{include file="$admingentemplates/admin_top.tpl"}
<div class="back">
    <a href="{$site_url}{$site_root}/admin/admin_settings.php">{$lang.button.back}</a>
</div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.admin_menu.custom}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
<div class="help_text" style="display:block;">
    <div class="close_help">
        <img src="{$site_root}{$template_root}/images/close_help.png" alt="">
    </div>
    <div class="help_body">
        <span class="help_title">{$lang.help}:</span>{$lang.admin_help.help_list_ref}
    </div>
</div>
<ul class="tabs" style="line-height:0px;width: 100.5%;">
		<li>
			<a href="admin_builder.php?tabs=0">
                   {$lang.builder.register_link}
            </a>
        </li>
		<li>
			<a href="admin_builder.php?tabs=1">
                   {$lang.builder.qsearch_link}
            </a>
        </li>
		<li>
			<a href="admin_builder.php?tabs=2">
                   {$lang.builder.asearch_link}
            </a>
        </li>
		<li>
			<a href="admin_builder.php?tabs=3">
                   {$lang.builder.perfect_link}
            </a>
        </li>
        <li>
			<a class="current">
                   {$lang.admin_menu.custom}
            </a>
        </li>
        <li>
			<a href="admin_reference.php?ref=23">
                   {$lang.admin_menu.ref_user_types}
            </a>
        </li>
	</ul>
<div class="user_operation_line" style="width: 100%;">
	<div onclick="javascript: document.ref_del.submit();" class="uol_item">
		<div class="uol_in_item">{$lang.button.delete}</div>
	</div>               
</div>
<div class="cr"></div>

<div style="float: left; width: 100%;">
<form method="POST" action="admin_reference.php" name=add_form>
<input type="hidden" name="sel" value="addcustcat">
<input type="hidden" name="ref" value="{$ref}">

<table border=0 cellspacing=0 cellpadding=5>
{*    <tr class="table_header">
        <td colspan=3 align="left"><font class="main_header_text">{$lang.ref.add_custfield}</font></td>
    </tr>*}
    <tr >
        <td align="left" width="auto" class="main_header_text">{$lang.ref.custfield}&nbsp;</td>
        <td width="400px" class="main_content_text" align="left">
            <input style="width: 400px;" type="text" name="name" value="" size=60>
        </td>
        <td align="left" width="">
            <a class="admin_button_major" onclick="javascript: document.add_form.submit();" >{$lang.button.add}<span>&nbsp;</span></a>    
        </td>
    </tr>
</table>
</form>
</div>
{/if}
<div style="float: left; width: 100%;" id="users_table_div">
<form action="{$form.action}" method="POST" name="ref_del">
<input type=hidden name="sel" value="delcustcat">
<input type=hidden name="ref" value="{$ref}">
<table border=0  cellspacing=0 cellpadding=5 width="100%">
<div id="tooltip" onclick="hideToolTip()" style="text-align:center; background-color: #FFFFFF; border: 1px dotted; text-align: {$default_left}; position:absolute; display:none; padding:5px;"></div>
{literal}
<script type="text/javascript">
$(function() {
$('#tool_tip_4 *').tooltip();
});
</script>
{/literal}
	<tr class="table_header">
		<td class="main_header_text" align="center" width="30px" style="padding-right: 5px; padding-left: 5px;">
			<input type="checkbox" id="select_all" name="select_all" onclick="PutAll()">
		</td>
		<td class="main_header_text" align="left">{$lang.ref.table_header}</td>
{*		<td class="main_header_text" align="center" width="140px">{$header.option}</td>
        <td class="main_header_text" align="center" width="100px">{$header.delete}</td>*}
        <td class="main_header_text" align="right" width="240px">{$lang.button.action}</td>
	</tr>
	{if $types}
	{section name=spr loop=$types}
	<tr {if $smarty.section.spr.index mod 2 eq 1}class="even"{else}class="odd"{/if}>					
		<td class="main_content_text" align="center" width="20">
			<input type="checkbox" name="id[]" value="{$types[spr].id_spr}">
		</td>
		<td class="main_content_text" align="left">
            <a href="{$types[spr].editoptionlink}">
                {assign var="name_for_lang" value=$types[spr].name_for_lang}
                {if $lang.userspr[$name_for_lang] ne ''}
    				{$lang.userspr[$name_for_lang]}
                {else}
                    {if $lang.profile[$name_for_lang] ne ''}
                        {$lang.profile[$name_for_lang]}
                    {else}
                        {$types[spr].name_for_lang}
                    {/if}
                {/if}
            </a>
        </td>
		<td class="main_content_text" align="center">
					<div class="block_action fr" style="display: none;cursor:pointer;">
						<div class="action_del" style="display: block;">
							<img width="16" alt="" src="{$site_root}{$template_root}/images/photo_delete.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false" onclick="javascript: document.location.href='{$types[spr].dellink}'">
						</div>
					</div>										
			<div style="width:10px;float:right;" class="fl">&nbsp;</div>
            {if $types[spr].options}
                {*<a class="admin_button_major" onclick="javascript: document.location.href='{$types[spr].editoptionlink}'" >{$lang.ref.options}<span>&nbsp;</span></a>*}
					<div class="block_action fr" style="display: none;cursor:pointer;">
						<div class="action_del" style="display: block;">
							<img width="16" alt="" src="{$site_root}{$template_root}/images/edit.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.edit}');return false" onclick="javascript: document.location.href='{$types[spr].editlink}'">
						</div>
					</div>			
            {/if}
{*        </td>
        <td class="main_content_text" align="center">
            <a class="admin_button_major" onclick="javascript: document.location.href='{$types[spr].dellink}'" >{$lang.button.delete}<span>&nbsp;</span></a>*}
        </td>
	</tr>
	{/section}
	{else}
	<tr height="40">
		<td class="main_error_text" align="left" colspan="4" bgcolor="#FFFFFF">{$lang.ref.empty}</td>
	</tr>
	{/if}
    
    <tr class="table_header">
                        <td colspan="11">
                            &nbsp;&nbsp;
                            {if $links}
                            {foreach item=item from=$links.pages}
                                &nbsp;<a onclick="PageList('users_table_div', 'ajax=1&{$item.link}');" class="page_link" {if $item.selected} style=" font-weight: bold; text-decoration: none;" {/if}>{$item.name}</a>&nbsp;
                            {/foreach}
                            {/if}
                            <div class="page_navigation">
                            {if $links.previous}
                                <a onclick="PageList('users_table_div', 'ajax=1&{$links.previous}');">< {$lang.content.previous} {$per_page}</a>
                            {/if}
                            {if $links.next}
                                <a onclick="PageList('users_table_div', 'ajax=1&{$links.next}');">{$lang.content.next} {$per_page} ></a>
                            {/if}
                            </div>
                        </td>
                    </tr>
</table>
<script type="text/javascript">
{literal}
		function showToolTip(e,text){
			if(document.all)e = event;
			var obj = document.getElementById('tooltip');
			obj.innerHTML = text;
			obj.style.display = 'block';
			var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
			if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;
			var leftPos = e.clientX - $('#tooltip').width()-10;
			if(leftPos<0)leftPos = 0;
			obj.style.left = leftPos + 'px';
			obj.style.top = e.clientY - obj.offsetHeight -10 + st + 'px';
		}
		function hideToolTip(){
			document.getElementById('tooltip').style.display = 'none';
		}
{/literal}		
</script>
</form>
</div>
{* <!--<table>
	<tr height="40">
		<td><input type="button" value="{$lang.button.add}" class="button" onclick="javascript: location.href='{$form.add_link}'"></td>
	</tr>
</table>--> *}
{literal}
<script language="JavaScript" type="text/javascript" >   
function PutAll() {
         var o=document.getElementsByName('select_all')	
         var i
         if (o[0].checked){                    
            o=document.getElementsByName('id[]')
            for (i=0; i<o.length; i++){                
                if (!o[i].disabled)
                    o[i].checked = true
            }            
         }
         else{
            o=document.getElementsByName('id[]')
            for (i=0; i<o.length; i++){                
                o[i].checked = false
            }            
         }             
}
    
function PageList(id_div, par) {
    ajaxLoadingImage(1, 'users_table_div');
    $.post("admin_reference.php", par, function(data){
        ajaxLoadingImage(0, 'users_table_div');
        $('#users_table_div').html(data);
    });

}
</script>
{/literal}
{if $ajax eq 0}
{include file="$admingentemplates/admin_bottom.tpl"}
{/if}