{if $ajax eq 0}{include file="$admingentemplates/admin_top.tpl"}
<div class="back">
    <a href="{$site_url}{$site_root}/flash_chat/admin/botlist.php">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$header.razdel_name}</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>{$help.chat_bot}
    </div>
</div>
<div class="cr">&nbsp;</div>
<div style="float:right;"><a href="{$site_url}{$site_root}/flash_chat/flashchat.php" target="_blank">{$lang.admin_menu.chat_login}</a></div>
<div class="cr">&nbsp;</div>
<ul class="tabs">
    <li>
        <a href="msglist.php">{$lang.admin_menu.chat_messages}</a>
    </li>
    <li>
        <a href="roomlist.php">{$lang.admin_menu.chat_rooms}</a>
    </li>
    <li>
        <a href="connlist.php">{$lang.admin_menu.chat_connections}</a>
    </li>
    <li>
        <a href="banlist.php">{$lang.admin_menu.chat_bans}</a>
    </li>
    <li>
        <a href="ignorelist.php">{$lang.admin_menu.chat_ignoring}</a>
    </li>
    <li>
        <a class="current">{$lang.admin_menu.chat_bots}</a>
    </li>
    <li>
        <a href="modlist.php">{$lang.admin_menu.chat_moderators}</a>
    </li>
    <li>
        <a href="modules.php">{$lang.admin_menu.chat_modules}</a>
    </li>
{*    <li>
        <a href="{$site_url}{$site_root}/flash_chat/flashchat.php" target="_blank">{$lang.admin_menu.chat_login}</a>
    </li>*}
</ul>{/if}
	<div class="user_operation_line" style="height:4px;">&nbsp;</div>
    <div class="user_status_line" style="margin-bottom:0px;width:100%;">
        <div id="tab_news" class="user_status_elem" onclick="links_load('ignorelist.php?');">
            <a>{$lang.admin_menu.chat_ignoring}</a>
        </div>
        <div id="tab_feeds" class="user_status_elem_active">
            {$lang.admin_menu.chat_bots}
        </div>
        <div class="user_status_elem" onclick="links_load('modlist.php?');">
            <a>{$lang.admin_menu.chat_moderators}</a>
        </div>
	</div>

<div class="panel_subtabs">
<div class="panel_content" style="width:97%;">
{if $enableBots}
	<form name="bot" id="bot" action="bot.php" method="post">
		<input type="hidden" name="id" value="{$_REQUEST.id}">
		<input type="hidden" name="sub" id="sub" value="">
		<table border="0" cellspacing="8">
		<tr><td align="left">{$header.bot_name}</td><td><input type="text" name="login" value="{$_REQUEST.login}"></td></tr>
		<tr>
			<td align="left">{$header.bot_room_list_avatar}</td>
			<td >
				<select name="room_avatar">
					{assign var="selected" value="`$_REQUEST.bot.room_avatar`"}
					<option id="0" {if $selected==""}selected{/if}>{$header.sel_none}</option>
					{foreach from=$_REQUEST.smilies key=key item=ordersel}
					<option id="{$key}" {if $ordersel==$selected}selected{/if}>{$ordersel}</option>
					{/foreach}
				</select>
			</td>
		</tr>
		<tr>
			<td align="left">{$header.bot_main_chat_avatar}</td>
			<td >
				<select name="chat_avatar">
					{assign var="selected" value="`$_REQUEST.bot.chat_avatar`"}
					<option id="0" {if $selected==""}selected{/if}>{$header.sel_none}</option>
					{foreach from=$_REQUEST.smilies key=key item=ordersel}
					<option id="{$key}" {if $ordersel==$selected}selected{/if}>{$ordersel}</option>
					{/foreach}
				</select>
			</td>
		</tr>
		<tr>
			<td align="left">{$header.login_into_room}</td>
			<td >
				<select name="roomid">
					{assign var="selected" value="`$_REQUEST.bot.roomid`"}
					{foreach from=$_REQUEST.rooms key=key item=ordersel}
					<option id="{$key}" {if $key==$selected}selected{/if}>{$ordersel}</option>
					{/foreach}
				</select>
			</td>
		</tr>
		<tr>
			<td align="left">{$header.active_when_1}</td>
			<td >
				<input type="text" name="active_on_min_users" size="3" maxlength="2" value="{$_REQUEST.bot.active_on_min_users}">
			</td>
		</tr>
		<tr>
			<td align="left">{$header.active_when_2}</td>
			<td >
				<input type="text" name="active_on_max_users" size="3" maxlength="2" value="{$_REQUEST.bot.active_on_max_users}">
			</td>
		</tr>
		<tr>
			<td align="left">{$header.active_when_3}</td>
			<td >
				<input type="checkbox" name="active_on_no_moderators" id="active_on_no_moderators"
				{if $_REQUEST.bot.active_on_no_moderators == 1} checked {/if}>
			</td>
		</tr>
		<tr>
			<td align="left">{$header.active_when_4}</td>
			<td >
				<input type="checkbox" name="active_on_no_bots" id="active_on_no_bots"
				{if $_REQUEST.bot.active_on_no_bots == 1} checked {/if}>
			</td>

		</tr>
		<tr>
			<td align="left">{$header.active_when_5}</td>
			<td >
				<select name="active_on_user">
					{assign var="selected" value="`$_REQUEST.bot.active_on_user`"}
					<option id="0" {if $selected=="0"}selected{/if}>{$header.sel_none}</option>
					{foreach from=$_REQUEST.users key=key item=ordersel}
					<option id="{$ordersel.id}" {if $ordersel.id==$selected}selected{/if}>{$ordersel.login}</option>
					{/foreach}
				</select>
			</td>
		</tr>
{*		<tr>
			<td>&nbsp;</td>
			<td><input type="submit" name="submit" value="{$header.submit_btn}">
			</td>
		</tr>*}
		</table>
	</form>
{else}
	<font class="main_error_text">{$header.err_bots_disabled}</font>
{/if}
</div>
</div>
<div style="float:left;">
<a class="admin_button_major" href="#" onclick="Save_status();">{$header.submit_btn}<span>&nbsp;</span></a>
</div>
<script type="text/javascript">
{literal}
function Save_status(){
$("#sub")[0].value = "1";
var options = {
	  success: function() {
			links_load('botlist.php?');
		}
	};
	$("#bot").ajaxSubmit(options); }	
{/literal}
</script>
{if $ajax eq 0}
{*<p align="right" class="main_header_text">&copy;<a href="http://tufat.com/" target="_blank">TUFaT.com</a> </p>*}
{include file="$admingentemplates/admin_bottom.tpl"}{/if}