{include file="$admingentemplates/admin_top.tpl"}
<script language="JavaScript" type="text/javascript" src="{$site_root}{$template_root}/js/classifieds.js"></script>
<div class="back">
    <a href="./admin_datasources.php">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.datasource.razdel_name}</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.ds_values_hint}
    </div>
</div>
<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}

<!--LANG LINKS-->
	<table cellSpacing="3" cellPadding="0">
		<tr>
			<td>
			<select onchange="javascript:window.open(this.value,'lang_edit', 'height=750, width=1050, left=10, top=50, resizable=yes, scrollbars=yes, menubar=no,status=no'); return false;">
			{section name=s loop=$lang_link}
				<option value="{$lang_link[s].link}">{$lang_link[s].name}</option>
				{/section}
			</select>
		</td>
			{*section name=s loop=$lang_link}
				<td align="center">
					<a href="#" onclick="javascript:window.open('{$lang_link[s].link}','lang_edit', 'height=600, resizable=yes, scrollbars=yes,width=800, menubar=no,status=no'); return false;" class=privacy_link>{$lang_link[s].name}</a>
				</td>
				{if !$smarty.section.s.last}
					<td align="center" valign="middle" class="main_content_text">&nbsp;|&nbsp;</td>
				{/if}
			{/section*}
		</tr>
	</table>
<!--/LANG LINKS-->

<!--ADD FORM-->
	{if isset($form_save)}
	<form method="post" action="{$form_save.action}"  enctype="multipart/form-data" name=add_form>
	{$form_save.hiddens}
	<table cellSpacing="3" cellPadding="0" style="margin-top: 5px;">
		<tr>
			<td align="right" class="main_header_text">
				&nbsp;{$lang.datasource.add_value}:&nbsp;
			</td>
			<td class="main_content_text" align="left"><input type="text" name="name" maxlength="30"></td>
			<td class="main_content_text" align="left">
				<a class="admin_button_major" onclick="javascript: document.add_form.submit();">{$lang.button.add}<span>&nbsp;</span></a>
			</td>
		</tr>
	</table>
	</form>
	{/if}
<!--/ADD FORM-->

<!--VALUES LIST-->
	<form name="form_update" action="{$form_upd.action}" method="POST">
	{$form_upd.hiddens}
	<table border=0 class="table_main" cellspacing=0 cellpadding=0 width="100%">
		{if $links}
			<tr style="background-color:white;">
				<td height="20"  colspan=3 align="left"  class="main_content_text" >{$links}</td>
			</tr>
		{/if}
		<tr class="table_header">
			<td class="main_header_text" align="center" width="20px">{$lang.datasource.number}</td>
			<td class="main_header_text" align="center">{$lang.datasource.old_value}</td>
			<td class="main_header_text" align="center" width="400px">{$lang.datasource.new_value}</td>
			<td class="main_header_text" align="center" width="100px">{$lang.button.action}</td>
		</tr>
		{section name=s loop=$values}
			<tr {if $smarty.section.s.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if}>
				<td class="main_content_text" align="center">{$smarty.section.s.iteration}</td>
				<td class="main_content_text" align="center">{$values[s].name}</td>
				<td class="main_content_text" align="center">
					<input type="text" name="ref[{$values[s].id}]" value="{$values[s].name}" style="width: 400px" maxlength="30">
				</td>
				<td class="main_content_text" align="center">
							<div class="block_action fr" style="display: none;">
								<div class="action_del" style="display: block;">
									<img height="16" alt="" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false" src="{$site_root}{$template_root}/images/photo_delete.png" onclick="javascript: if(confirm('{$lang.datasource.del_value_cnf|escape:javascript}')) location.href='{$values[s].dellink}';">
								</div>
							</div>
				</td>
			</tr>
		{sectionelse}
			<tr height="20">
				<td class="main_error_text" align="left" colspan="4">{$lang.datasource.values_empty}</td>
			</tr>
		{/section}
		<tr class="table_header"><td colspan="4">&nbsp;</td></tr>
		<tr style="background-color:white;">
			<td class="main_content_text" align="left" colspan="4">
				<a class="admin_button_major" onclick="javascript: document.form_update.submit();">{$lang.button.save}<span>&nbsp;</span></a>
			</td>
		</tr>
		{if $links}
			<tr style="background-color:white;">
				<td height="20"  colspan=3 align="left"  class="main_content_text" >{$links}</td>
			</tr>
		{/if}
	</table>
	</form>
<!--/VALUES LIST-->
<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>

{include file="$admingentemplates/admin_bottom.tpl"}