{if $ajax eq 0}
{include file="$admingentemplates/admin_top.tpl"}
<script language="JavaScript" type="text/javascript" src="{$site_root}{$index_theme_path}/js/jquery.form.js"></script>
<script language="JavaScript" type="text/javascript" src="{$site_root}{$template_root}/js/area-editor.js"></script>
<script>
{literal}
var tab_last = 'news';
var tab_link = 'admin_news.php?ajax=1';
var options = { 
	success: function(data){
		ajaxIndicator(0, 'error_box');
		data = data.replace(/\<\/?(head|body)\>/g,'');
		if (data == 'saved'){
			ShowBlock('show_block', tab_link);
		} else {
			$('.error').html(data).fadeIn(100);
			if ( $.browser.msie) {
    			DD_roundies.addRule('div.error', '10px');
			} else {
    			$('div.error').corner();
			}
			$("body").animate({"scrollTop":0},"slow");
			$('.error').oneTime(15000, function() {
				$('.error').fadeOut(500);
			});
		}
		$('#cr').html('eeeee');
		return false;
	},
	beforeSubmit: function() { 
		ajaxIndicator(1, 'error_box');
	}
};
{/literal}
</script>
<div class="cr"></div>
	<div class="error" style="border: 1px solid #E2EFE4;margin-top: 5px;padding: 10px;display: none;">
	</div>
</div>
<div class="back">
    <a href="{$site_url}{$site_root}/admin/admin_settings.php">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.news.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.news}
    </div>
</div>
<div class="cr">&nbsp;</div>
<ul class="tabs">
	<li>
        <a {if $tab eq '3'}class="current"{else}href="admin_settings.php?section=3"{/if}>{$lang.admin_menu.ref_languages}</a>
    </li>
    <li>
        <a {if $tab eq '1'}class="current"{else}href="admin_addition_info.php"{/if}>{$lang.admin_menu.area_editor}</a>
    </li>
    <li>
        <a {if $tab eq '2'}class="current"{else}href="admin_news.php"{/if}>{$lang.news.razdel_name}</a>
    </li>
    <li style="padding-right:0px;">
        <a {if $ref eq '16'}class="current"{else}href="admin_reference.php?ref=16"{/if}>{$lang.admin_menu.ref_hotlist_types}</a>
    </li>
    <li style="padding-right:0px;">
        <a {if $ref eq '22'}class="current"{else}href="admin_reference.php?ref=22"{/if}>{$lang.admin_menu.uploads_gallery_categories}</a>
    </li>
    <li style="padding-right:0px;">
        <a href="admin_kisses.php">{$lang.admin_menu.ref_kiss_types}</a>
    </li>
</ul>
{/if}
		<div id="show_block">
<div class="panel">
    <div class="user_operation_line">
		<div class="uol_item" onclick="ShowBlock('show_block','{$add_link}');return false;">
            <div class="uol_in_item">{$lang.news.add}</div>
        </div>        
    </div>
    <div class="cr" id="cr">&nbsp;</div>
    <div id="num_news">
            <input type="hidden" name="sel" value="change_num_news"/>
            <div >
                {$lang.settings.num_news_index}: <input style="margin-left: 10px;" type="text" id="num_news_index" name="num_news_index" size="10" value="{$num_news}" />
                 <a href="#" style="margin-left: 30px;" class="admin_button_major" onclick="Change_news(); return false;">{$lang.button.save}<span>&nbsp;</span></a>
            </div>
    </div>
<script type="text/javascript">
{literal}
function Change_news(){
    var num = $("#num_news_index").val();
    $.post("admin_settings.php", 'sel=change_num_news&num_news_index='+num, function(data){});
}

{/literal}
</script>
    <div class="cr" id="cr">&nbsp;
		<form id="settings_form" name="settings_form" class="settings_form" action="{$site_url}{$site_root}/admin/admin_news.php?sel=save" method="POST" style="display:none;">
		<table border=0 cellspacing=0 cellpadding=5>
			<tr bgcolor="#FFFFFF">
				<td align="left" nowrap class="main_header_text" width="auto" style="margin-right:10px;">{$header2.use_horoscope_feature}:&nbsp;</td>
				<td class="main_content_text" align="center"><input type="checkbox" name="use_horoscope_feature" id="use_horoscope_feature" value="1" {if $data.use_horoscope_feature}checked{/if}></td>
				<td align="left">
					<div id="error_box" class="error_box_blue"></div>
				</td>
			</tr>
		</table>
		</form>
		<script language="JavaScript" type="text/javascript">
		{literal}
			var options = { 
				success: function(data){
					ShowAjaxError(data, '', 'success');
					return false;
				},
				beforeSubmit: function() { 
					ajaxIndicator(1, 'error_box');
				}
			};
			$(document).ready(function(){
				$("#use_horoscope_feature").change(function (){
					$('.settings_form').ajaxSubmit(options);
					return false;
				});
			});
		{/literal}
		</script>
	</div>
    <div class="user_status_line">
        <div id="tab_news" class="user_status_elem_active" onclick="ShowEditor('news','admin_news.php?ajax=1');form_undisp();">
            {$lang.news.list}
        </div>
        <div id="tab_feeds" class="user_status_elem" onclick="ShowEditor('feeds','admin_news.php?par=feeds&ajax=1');form_undisp();">
            <a>{$lang.news.rss_list}</a>
        </div>
        <div id="tab_horoscope" class="user_status_elem" onclick="ShowEditor('horoscope','admin_news.php?sel=horoscope&ajax=1');form_disp();">
            <a>{$lang.news.rss_horoscope}</a>
        </div>
		<script type="text/javascript">
			{literal}
				function form_disp(){
					$('#settings_form').css('display', '');
				}
				function form_undisp(){
					$('#settings_form').css('display', 'none');
				}
			{/literal}
		</script>

        <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%">
					<tr class="table_header">
						<td align="center" width="20">{$lang.news.number}</td>
						<td align="left">{$lang.news.date}</td>
						<td align="left">{$lang.news.title}</td>
						<td align="center">{$lang.news.status}</td>
						<td align="right" width="100">{$lang.button.action}</td>
					</tr>
					{if $news}
					{section name=spr loop=$news}
					<tr {if $smarty.section.spr.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if}>
						<td align="center">{$news[spr].number}</td>
						<td align="left"><a href="{$news[spr].editlink}" onclick="ShowBlock('show_block','{$news[spr].editlink}');return false;">{$news[spr].date}</a></td>
						<td align="left"><a href="{$news[spr].editlink}" onclick="ShowBlock('show_block','{$news[spr].editlink}');return false;">{$news[spr].title}</a></td>
						<td align="center">{$news[spr].status}</td>
						<td align="right">
							<div style="width:10px;float:right;" class="fl">&nbsp;</div>
							<div class="block_action fr" style="display: none;">
								<div class="action_del" style="display: block;">
									<img width="16" alt="" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false" src="{$site_root}{$template_root}/images/photo_delete.png" onclick="ShowBlock('show_block','{$news[spr].deletelink}');return false;">
								</div>
							</div>			
							{*<a class="admin_button" onclick="ShowBlock('show_block','{$news[spr].deletelink}');return false;">{$lang.button.delete}<span>&nbsp;</span></a>
							<input type="button" value="{$lang.button.delete}" class="button" onclick="{literal}javascript: if(confirm({/literal}'{$form.confirm|escape:javascript}'{literal})){location.href={/literal}'{$news[spr].deletelink}'{literal}}{/literal}">*}
						</td>
					</tr>
					{/section}
					{else}
					<tr height="40">
						<td class="main_error_text" align="left" colspan="5" bgcolor="#FFFFFF">{$lang.news.empty}</td>
					</tr>
					{/if}
					<tr class="table_header">
						<td colspan="5">
							{if $links}
							{foreach item=item from=$links.pages}
							&nbsp;<a onclick="ShowBlock('show_block', '{$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="ShowBlock('show_block', '{$links.previous}');">< {$lang.content.previous} {$per_page}</a>
							{/if}
							{if $links.next}
							<a onclick="ShowBlock('show_block', '{$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>
{*				<table>
					<tr height="40">
						<td>
							<a style="margin-top: 20px;" class="admin_button_major" onclick="ShowBlock('show_block','{$add_link}');return false;">{$lang.news.add}<span>&nbsp;</span></a>*}
						{*<input type="button" value="{$lang.news.add}" class="button" onclick="javascript: location.href='{$add_link}'">*}
{*						</td>
					</tr>
				</table>*}
	</div>
</div>
			</div>
<script type="text/javascript">
	tab_link = 'admin_news.php?ajax=1';
</script>
{if !$ajax}
{include file="$admingentemplates/admin_bottom.tpl"}
{/if}
