{include file="$admingentemplates/admin_top.tpl"}
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.banners.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.banners_rotate}
    </div>
</div>
<ul class="tabs">
    <li>
        <a href="admin_banners.php">{$lang.admin_menu.banners_list}</a>
    </li>
    <li>
        <a href="admin_banners.php?sel=user_banners">{$lang.admin_menu.user_banners}</a>
    </li>
    <li>
        <a class="current">{$lang.admin_menu.banners_settings}</a>
    </li>
</ul>
<div class="user_operation_line" style="height: 5px;"></div>
<div class="cr"></div>
    <div class="user_status_line">
        <div id="tab_feeds" class="user_status_elem_active" onclick="show_block();">
            {$lang.admin_menu.banners_settings}
        </div>
        <div id="tab_news" class="user_status_elem" onclick="show_block_gen();">
            <a>{$lang.admin_menu.settings_general}</a>
        </div>
        <div id="tab_partner" class="user_status_elem" onclick="show_part();">
            <a>{$lang.admin_menu.partners}</a>
        </div>

        <div class="cr"></div>

{if $form.error}<div class="main_error_text" align="left">* {$form.error}</div>{/if}
<div id="show_block" style="display:block;">
	<div class="panel_subtabs" style="width: 100%">
		<div class="panel_content" style="width: 97%">
<table border="0" cellspacing="1" cellpadding="5" width="100%">
<form name="edit_prices" enctype="multipart/form-data" method="post" action="{$file_name}">
	{$form.hiddens}
	<tr>
		<td>
			{$lang.banners.choose_period}:
			<input type="text" name="amount" id="id_amount" value="{$settings.banner_period_amount}" size="5"/>
			<select name="period">
				<option value="day" {if $settings.banner_period=='day'}selected{/if}>{$lang.banners.period.day}</option>
				<option value="month" {if $settings.banner_period=='month'}selected{/if}>{$lang.banners.period.month}</option>
				<option value="year" {if $settings.banner_period=='year'}selected{/if}>{$lang.banners.period.year}</option>
			</select>
		</td>
	</tr>
	<tr>
		<td>
			<table cellspacing=0 cellpadding=0>
			{*<tr>
				<th colspan="2">{$lang.banners.banners_arrea}</th>
			</tr>*}
			<tr>
				{foreach name=a from=$areas item=item}
				<td width="50%" style="padding: 2px 5px;">
					<input type="text" id="pr{$smarty.foreach.a.iteration}" name="price[{$item.id}]" value="{$item.price}" size="5"> {$settings.site_unit_costunit} {$lang.banners.for} {$item.description}
				</td>
				{if $smarty.foreach.a.last && $smarty.foreach.a.iteration is div by 1}
				<td width="50%" style="padding: 2px 5px;"></td>
				{/if}
				{if $smarty.foreach.a.iteration is div by 2 }
				</tr><tr>
				{/if}
				{/foreach}
				<input type="hidden" id="count" value="{$smarty.foreach.a.iteration}" />
			</tr>	
			</table>
		</td>
	</tr>
{*	<tr>
		<td width="100%">*}
{*			<input id="submit_butt" type="button" value="{$lang.button.save}" class="button" onclick="javascript: CheckForm();">*}
{*			<a class="admin_button_major" id="submit_butt" onclick="javascript: CheckForm();show_block();">{$lang.button.save}<span>&nbsp;</span></a>
		</td>
	</tr>*}
	</td>
</form>
</table>
</div></div><a class="admin_button_major" id="submit_butt" onclick="javascript: CheckForm();show_block();">{$lang.button.save}<span>&nbsp;</span></a>
</div>
<div id="show_block_gen" style="display:none;">
	<div  style="width: 100%;border-top: 3px solid #29B43D;">
		<div class="panel_content" style="margin-left: 0px; margin-right: 0px; margin-top:0px; width: 100%;">
{*	<font class=red_sub_header>{$lang.banners.parameters}</font>
	<div class="help_text"><span class="help_title">{$lang.help}:</span>{$lang.admin_help.banners_rotate}</div>*}
        <form method="post" action="{$file_name}?sel=save_rotate" name="banner_form">
        <table border=0 cellspacing=0 cellpadding=0 width="100%">
              <tr class="table_header">
                <td class="main_header_text" align="left">{$lang.banners.rotate_status}</td>
                <td class="main_header_text" align="left">{$lang.banners.rotate_area}</td>
                <td class="main_header_text" align="left">{$lang.banners.rotate_time}</td>
              </tr>
              <tr class="table_row even">
                <td class="main_content_text" align="left">
                 <input type="checkbox" name="rotate_left_flag" {if $rotate_left_flag eq 1}checked="checked"{/if}>
                </td>
                <td class="main_content_text" align="left">{$lang.banners.position_left}</td>
                <td class="main_content_text" align="left">
                 <input type="text" name="rotate_left_time" value="{$rotate_left_time}" size="10"> {$lang.banners.ms}
                </td>
              </tr>
              <tr class="table_row odd">
                <td class="main_content_text" align="left">
                 <input type="checkbox" name="rotate_bottom_flag" {if $rotate_bottom_flag eq 1}checked="checked"{/if}>
                </td>
                <td class="main_content_text" align="left">{$lang.banners.position_bottom}</td>
                <td class="main_content_text" align="left">
                 <input type="text" name="rotate_bottom_time" value="{$rotate_bottom_time}" size="10"> {$lang.banners.ms}
                </td>
              </tr>
              <tr class="table_row even">
                <td class="main_content_text" align="left">
                 <input type="checkbox" name="rotate_top_flag" {if $rotate_top_flag eq 1}checked="checked"{/if}>
                </td>
                <td class="main_content_text" align="left">{$lang.banners.position_top}</td>
                <td class="main_content_text" align="left">
                 <input type="text" name="rotate_top_time" value="{$rotate_top_time}" size="10"> {$lang.banners.ms}
                </td>
              </tr>
              <tr class="table_header">
                <td colspan="3">&nbsp;</td>
              </tr>
{*              <tr>
                <td colspan="3" align="left">
					<a class="admin_button_major" onclick="javascript: document.banner_form.submit();show_block_gen();">{$lang.button.save}<span>&nbsp;</span></a>
				</td>
              </tr>*}
        </table>
        </form>
</div></div><a class="admin_button_major" onclick="javascript: document.banner_form.submit();show_block_gen();">{$lang.button.save}<span>&nbsp;</span></a>
</div>
<div id="show_partner" style="display:none;">
    <div class="panel_subtabs" style="width: 100%">
        <div class="panel_content" style="width: 97%">   
        <div >{$lang.admin_menu.part_question}</div>
        <div style="float: left; padding-top: 10px; padding-right: 20px;">
            <a href="http://stats.wmadv.com/www/images/img/dating_websites/form.html"> <img height="100px;" src="{$site_root}{$template_root}/images/webMedia_logo.jpg" /></a>
        </div>
        <div>
            <dl>-&nbsp;{$lang.admin_menu.line_1}</dl>
            <dl>-&nbsp;{$lang.admin_menu.line_2}</dl>
            <dl>-&nbsp;{$lang.admin_menu.line_3}</dl>
            <dl>-&nbsp;{$lang.admin_menu.line_4}</dl>
        </div>
        <a href="http://stats.wmadv.com/www/images/img/dating_websites/form.html">{$lang.admin_menu.line_5}</a>
        </div>
    </div>
</div>
<script>
{literal}
function show_block(){
    if($("#tab_feeds").attr("class") == "user_status_elem_active") return false;
	$('#tab_news').html("<a>"+$('#tab_news').text()+"<\/a>");
    $('#tab_partner').html("<a>"+$('#tab_partner').text()+"<\/a>");
	$('#tab_feeds').html($('#tab_feeds').find('a').text());
	$("#show_block_gen").css('display','none');
	$("#show_block").css('display','block');
    $("#show_partner").css('display','none');
	$('#tab_feeds').removeClass('user_status_elem');
	$('#tab_feeds').addClass('user_status_elem_active');
	$('#tab_news').removeClass('user_status_elem_active');
	$('#tab_news').addClass('user_status_elem');
    $('#tab_partner').removeClass('user_status_elem_active');
	$('#tab_partner').addClass('user_status_elem');
}
function show_block_gen(){
    if($("#tab_news").attr("class") == "user_status_elem_active") return false;
	$('#tab_feeds').html("<a>"+$('#tab_feeds').text()+"<\/a>");
    $('#tab_partner').html("<a>"+$('#tab_partner').text()+"<\/a>");
	$('#tab_news').html($('#tab_news').find('a').text());
	$("#show_block_gen").css('display','block');
	$("#show_block").css('display','none');
    $("#show_partner").css('display','none');
	$('#tab_news').removeClass('user_status_elem');
	$('#tab_news').addClass('user_status_elem_active');
	$('#tab_feeds').removeClass('user_status_elem_active');
	$('#tab_feeds').addClass('user_status_elem');
    $('#tab_partner').removeClass('user_status_elem_active');
	$('#tab_partner').addClass('user_status_elem');
}
function show_part(){
    if($("#tab_partner").attr("class") == "user_status_elem_active") return false;
    $('#tab_feeds').html("<a>"+$('#tab_feeds').text()+"<\/a>");
    $('#tab_news').html("<a>"+$('#tab_news').text()+"<\/a>");
	$('#tab_partner').html($('#tab_partner').find('a').text());
	$("#show_block").css('display','none');
    $("#show_block_gen").css('display','none');    
	$("#show_partner").css('display','block');
	$('#tab_news').removeClass('user_status_elem_active');
	$('#tab_news').addClass('user_status_elem');
	$('#tab_feeds').removeClass('user_status_elem_active');
	$('#tab_feeds').addClass('user_status_elem');
    $('#tab_partner').removeClass('user_status_elem');
	$('#tab_partner').addClass('user_status_elem_active');
}

function CheckForm(){
	
	amount = parseInt(document.getElementById('id_amount').value);
	if(isNaN(amount)) amount = 0;
	if (amount == 0) return alert("{/literal}{$lang.banners.zero_period_amount|escape:javascript}{literal}");
	
	count = document.getElementById('count').value;
	check = true;
	for(i=1;i<=count;i++){
		price = parseFloat(document.getElementById('pr'+i).value);
		if (isNaN(price)) document.getElementById('pr'+i).value = 0;
		if (document.getElementById('pr'+i).value == 0) check = false;
	}
	if (check) document.edit_prices.submit();
	else{
		if (confirm("{/literal}{$lang.banners.zero_price|escape:javascript}{literal}")) document.edit_prices.submit(); 
	};
}  

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