{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="{$site_url}{$site_root}/admin/admin_modules.php">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.forms.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.patterns_hint}
    </div>
</div>
<div class="cr">&nbsp;</div>
<ul class="tabs">
    <li>
        <a href="admin_classified.php">{$lang.admin_menu.cat_manager}</a>
    </li>
    <li>
        <a href="admin_form_blocks.php">{$lang.admin_menu.form_blocks}</a>
    </li>
    <li>
        <a class="current">{$lang.admin_menu.patterns}</a>
    </li>
    <li>
        <a href="admin_datasources.php">{$lang.admin_menu.ref_datasources}</a>
    </li>
</ul>
		<div class="user_operation_line" style="height:5px;">

		</div>
		<div class="cr"></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}
		
<table border=0 cellspacing=0 cellpadding=0 width="100%" style="margin-bottom: 10px">
{*	<tr class="table_header">
		<td colspan="5" class="main_header_text"  align="left">
			{$lang.forms.add_new}
		</td>
	</tr>*}
	<tr >
		<form name='add_form' action="{$form_add.action}" method="POST">
			<td class="main_header_text" width="auto">
				{$lang.forms.add_new}
			</td>
			<td class="main_content_text" width="200px">
				<input type="text" name="new_name" style="width:200px">
			</td>
			<td align="right" class="main_header_text" width="80px">
				{$lang.forms.new_pattern}
			</td>
			<td class="main_content_text" width="500px">
				<input type="text" name="new_regexp" value="" style="width:500px">
			</td>
			<td class="main_content_text" align="left">
				<a class="admin_button_major" onclick="javascript: document.add_form.submit();">{$lang.button.add_new}<span>&nbsp;</span></a>
			</td>
		</form>
	</tr>
</table>

<form name='save_censors' action="{$form_save.action}" method="POST">
<table border=0 cellspacing=0 cellpadding=0 width="100%">
	<tr class="table_header">
		<td class="main_header_text" width="20px" align="center" >{$lang.forms.id}</td>
		<td class="main_header_text" width="250px" align="center">{$lang.forms.name}</td>
		<td class="main_header_text" width="600px" align="center">{$lang.forms.pattern}</td>
		<td class="main_header_text" align="right">{$lang.button.action}</td>
	</tr>
	{foreach from=$regs name=s item=reg key=id_reg}
		<tr {if $smarty.foreach.s.iteration mod 2 eq 1} class="odd" {else} class="even" {/if}>
			<td class="main_content_text" align="center">{$smarty.foreach.s.iteration}</td>
			<td class="main_content_text" align="center">{$reg.name}</td>
			<td class="main_content_text" align="left" align="center">
				<input type="text" name="regs[{$id_reg}]" value="{$reg.pattern}" style="width:600px">
			</td>
			<td class="main_content_text" align="center">
{*				<a class="admin_button" onclick="javascript: if(window.confirm('{$lang.forms.really_delete_reg|escape:javascript}')) location.href='{$reg.del_link}';">{$lang.button.delete}<span>&nbsp;</span></a>
									<img height="16" alt="" src="{$site_root}{$template_root}/images/photo_delete.png" onclick="javascript: if(window.confirm('{$lang.forms.really_delete_reg|escape:javascript}')) location.href='{$reg.del_link}';">*}
							<div class="block_action fr" style="display: none;">
								<div class="action_del" style="display: block;">
									<img height="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: if(window.confirm('{$lang.forms.really_delete_reg|escape:javascript}')) location.href='{$reg.del_link}';">
								</div>
							</div>
			</td>
		</tr>
	{foreachelse}
		<tr bgcolor="#ffffff">
			<td colspan="4" class="main_error_text" align="center">{$lang.forms.empty_patterns}</td>
		</tr>
	{/foreach}
	<tr class="table_header"><td colspan="4">&nbsp;</td></tr>	
	<tr >
		<td colspan="4" align="left">
			<a class="admin_button_major" onclick="javascript: document.save_censors.submit();">{$lang.button.save}<span>&nbsp;</span></a>
		</td>
	</tr>
</table>
</form>
<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"}