{if $ajax eq 0}
{include file="$admingentemplates/admin_top.tpl"}{/if}
<script>
{literal}
var tab_last = '1';
{/literal}
</script>
{if $ajax eq 0}
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$info.name}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
{if $info.help != ''}
    <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>{$info.help}
        </div>
    </div>
{/if}
<ul class="tabs">
    <li>
        <a {if $info.active == "reports"} class="current" {else} href="admin_abuse_reports.php"  {/if}>{$lang.admin_abuse_reports.razdel_name} ({$count.new_abuse}/{$count.all_abuse})</a>
    </li>
    <li>
        <a {if $info.active == "bad_words"} class="current" {else} href="admin_badwords.php" {/if}>{$lang.admin_menu.bad_words} ({$count.badwords})</a>
    </li>
    <li>
        <a {if $info.active == "ip_check"} class="current" {else} href="admin_block_ip.php" {/if}>{$lang.admin_menu.block_ip} ({$count.ip})</a>
    </li>
    <li>
        <a {if $info.active == "approve"} class="current" {else} href="admin_upload.php" {/if}>{$lang.admin_menu.uploads_approve} ({$count.approve})</a>
    </li>
</ul>{/if}
<div id="show_block">
<div class="user_operation_line">       
    {if $info.active ne "ip_check"}
            <div class="uol_item" onclick="changeUserStatusAll(0)">
                <div class="uol_in_item">{$lang.button.make_inactive}</div>
            </div>
            <div class="uol_item" onclick="changeUserStatusAll(1)">
                <div class="uol_in_item">{$lang.button.make_active}</div>
            </div>                 
            <div class="uol_item" onclick="delReportAll();">
                <div class="uol_in_item">{$lang.button.delete_report}</div>
            </div>        
    {/if}
</div>
<div class="cr"></div>
 
<div id="info">    
<div align="right">
    <form name="areas_form" action="{$form.action}" method="post" style="padding-right: 10px;">
				{$form.hiddens}
					{$lang.badwords.areas}:&nbsp;
					<select id="area" name="area" onchange="javascript: document.areas_form.submit();">
					<option value="1" {if $data.area eq 1}selected{/if}>{$lang.badwords.area1} ({$area_count.1})</option>
					<option value="3" {if $data.area eq 3}selected{/if}>{$lang.badwords.area3} ({$area_count.3})</option>
					<option value="4" {if $data.area eq 4}selected{/if}>{$lang.badwords.area4} ({$area_count.4})</option>
					<option value="5" {if $data.area eq 5}selected{/if}>{$lang.badwords.area5} ({$area_count.5})</option>
					<option value="6" {if $data.area eq 6}selected{/if}>{$lang.badwords.area6} ({$area_count.6})</option>
					{if $use_pilot_module_blog eq 1}<option value="7" {if $data.area eq 7}selected{/if}>{$lang.badwords.area7} ({$area_count.7})</option>{/if}
					{if $use_pilot_module_club eq 1}<option value="8" {if $data.area eq 8}selected{/if}>{$lang.badwords.area8} ({$area_count.8})</option>{/if}
					{if $use_pilot_module_giftshop eq 1}<option value="9" {if $data.area eq 9}selected{/if}>{$lang.badwords.area9} ({$area_count.9})</option>{/if}
					{if $use_pilot_module_events eq 1}<option value="10" {if $data.area eq 10}selected{/if}>{$lang.badwords.area10} ({$area_count.10})</option>{/if}
					{if $use_pilot_module_forum eq 1}<option value="11" {if $data.area eq 11}selected{/if}>{$lang.badwords.area11} ({$area_count.11})</option>{/if}
					<option value="12" {if $data.area eq 12}selected{/if}>{$lang.badwords.area12} ({$area_count.12})</option>
					<option value="13" {if $data.area eq 13}selected{/if}>{$lang.badwords.area13} ({$area_count.13})</option>
					<option value="14" {if $data.area eq 14}selected{/if}>{$lang.badwords.area14} ({$area_count.14})</option>
					</select>
				</form>
</div>

<div onclick="ShowEditor('1','admin_badwords.php?ajax=1');" id="tab_1" class="user_status_elem_active" width="80px">
    {$lang.admin_menu.bad_words_alert} ({$badwords_count})
</div>
<div onclick="ShowEditor('2','admin_badwords.php?sel=fileform&ajax=1');" id="tab_2" class="user_status_elem" width="80px">
    <a>{$lang.admin_menu.bad_words_file} </a>
</div>
        
        
<div align="right" style="padding-right: 10px;margin-top: 5px;">    
    <form name="num_on_page" action="{$file_name}" method="POST" >
    {$lang.admin_menu.num_on_page} 
    <select id="num_on_page" name="num_on_page" onchange="NumUsers()">
                                    <option value="10" {if $num eq 10}selected=""{/if}>10</option>
                                    <option value="30" {if $num eq 30}selected=""{/if}>30</option>
                                    <option value="50" {if $num eq 50}selected=""{/if}>50</option>
                                    <option value="100" {if $num eq 100}selected=""{/if}>100</option>
                                </select>
    </form>
</div>


<div id="bad_words" style="float: left; 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}
				<table border=0 cellspacing=0 cellpadding=0 width="100%">
							<tr class="table_header">                        
                                <td width="15%" >
                                     <input type="checkbox" id="select_all" name="select_all" onclick="PutAll()" /> {$lang.badwords.name} 
                                </td>
                                <td width="30%" >
                                    {$lang.badwords.content}
                                </td>
                                <td width="15%" >
                                    {$lang.badwords.section}
                                </td>
                                <td width="10%">
                                    {$lang.admin_block_ip.ip_ban}
                                </td>                        
                                <td width="15%" >
                                    {$lang.badwords.date}
                                </td>
                                <td width="15%" align="right">
                                    {$lang.badwords.actions}
                                </td>
                            </tr>
							{if $vialocations}
							{section name=spr loop=$vialocations}
							<tr id="id_{$vialocations[spr].id}" {if $smarty.section.spr.index mod 2 eq 1}class="even"{else}class="odd"{/if}>
								<td class="main_content_text" ><input type="checkbox" name="delete" value="{$vialocations[spr].id}" >{$vialocations[spr].name}</td>
								<td class="main_content_text" >{$vialocations[spr].message}</td>
								<td class="main_content_text" >{$vialocations[spr].section} </td>
                                <td >{if $vialocations[spr].status == 0} <img style="padding-left: 12px;" src="{$site_root}{$template_root}/images/success.png"/>{/if}</td>
								<td class="main_content_text" >{$vialocations[spr].date}</td>
								<td class="main_content_text" align="right" style="padding-right: 10px" >
                                    <div class="block_action" style="float:right;">
                                        <img src="{$site_root}{$template_root}/images/icon_ss.gif" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.statistic}');return false" height="15px" alt="" style="cursor: pointer;" onclick="window.open('{$vialocations[spr].statistic_link}','statistic', 'height=475, resizable=yes, scrollbars=yes,width=400, menubar=no,status=no');" />&nbsp;&nbsp;&nbsp;&nbsp;
                                        <img src="{$site_root}{$template_root}/images/communicate.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.comunicate.editform}');return false" height="15px" alt="" style="cursor: pointer;" onclick="javascript:window.open('{$vialocations[spr].communicate_link}','comunicate', 'height=800, resizable=yes, scrollbars=yes,width=600, menubar=no,status=no');" />&nbsp;&nbsp;&nbsp;&nbsp;
                                        <img  src="{$site_root}{$template_root}/images/photo_delete.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false" height="15px" width="15px" alt="" onclick="delReport('{$vialocations[spr].id}')" style="cursor: pointer;" />
                                        <!--- <input id_user="make_active{$item.id_user}" type="button" value="{$lang.button.make_active}" onclick="changeUserStatus({$vialocations[spr].id},1);" {if $item.status}style="display:none;"{/if}/>
                                        <input id_user="make_inactive{$item.id_user}" type="button" value="{$lang.button.make_inactive}" onclick="changeUserStatus({$vialocations[spr].id},0);" {if !$item.status}style="display:none;"{/if}/> --->
                                    </div>
                                </td>
								
							</tr>
							{/section}
							{else}
							<tr height="40">
								<td class="main_error_text" align="left" colspan="11" bgcolor="#FFFFFF">{$lang.interests_spr.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('bad_words', '{$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('bad_words', '{$links.previous}');">< {$lang.content.previous} {$per_page}</a>
                                    {/if}
                                    {if $links.next}
                                        <a onclick="PageList('bad_words', '{$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>
</div>
</div>    </div>                
{if $ajax eq 0}	
{include file="$admingentemplates/admin_bottom.tpl"}

<script type="text/javascript">
{literal}
function NumUsers(){
    num_users = $("select[name=num_on_page]").val();
    area = document.getElementById("area").value;
    par = 'num_on_page='+num_users+'&ajax=1&area='+area;
    ajaxLoadingImage(1, 'bad_words');
        $.post("admin_badwords.php", par, function(data){
            ajaxLoadingImage(0, 'bad_words');
            $('#info').html(data);
        });
}

function PageList(id_div, par) {
        ajaxLoadingImage(1, 'bad_words');
        $.post("admin_badwords.php", par, function(data){
            ajaxLoadingImage(0, 'bad_words');
            $('#info').html(data);
        });
    }
    
  
function delReport(id){
    area = document.getElementById("area").value;
    num_users = $("select[name=num_on_page]").val();
	par = 'ajax=1&sel=delete&id='+id+"&num_on_page="+num_users+"&area="+area;
	$.post('admin_badwords.php', par, function(data){		
		$('#info').html(data);
	});
}

function delReportAll(){    
	$('input[name=delete]:checked').each(function(){
	   delReport($(this).val());	  
     });
}

function PutAll() {
         var o=document.getElementsByName('select_all')	
         var i
         if (o[0].checked){                    
            o=document.getElementsByName('delete')
            for (i=0; i<o.length; i++){                
                o[i].checked = true
            }            
         }
         else{
            o=document.getElementsByName('delete')
            for (i=0; i<o.length; i++){                
                o[i].checked = false
            }            
         }             
}

function changeUserStatusAll(val){
        $('input[name=delete]:checked').each(function(){
	    changeUserStatus($(this).val(), val);	  
     });
}

function changeUserStatus(id, status){
    area = document.getElementById("area").value;
    num_users = $("select[name=num_on_page]").val();
    str = 'ajax=1&sel=user_status&id='+id+'&status='+status+"&num_on_page="+num_users+"&area="+area;
	$.post("admin_badwords.php", str, function(data){
		$('#info').html(data);
	});
}
{/literal}
</script>
{/if}