<?php
#error_reporting(E_ALL ^ E_NOTICE);
include_once("req.php");

array_walk($_REQUEST,"format_string");   
array_walk($_POST,"format_string");   
array_walk($_GET,"format_string");   
include_once("config.php");
include_once("session_class.php");
session_start();
$session = new Sessions;
$design=$_SESSION['design'];
if ($design==0) {$design=1;}

if ($session->is_session(session_id() )) {
#switch ($_GET['header']) {
include_once("persinfo_class.php");
$myinfo =new Persinfo($session->id_person);
if ($_REQUEST['toggle_afk']) {
	db_use('query',"update person set afk=-afk where id_person='".$myinfo->id_person."'");
}
$afk=db_use('array',"select afk from person where id_person='".$myinfo->id_person."'");
#----------------------------
	$invis=db_use('array',"select id_person from person_on where type=5 and id_person='".$myinfo->id_person."'");
	$invis=($invis[id_person]?1:-1);
if ($_REQUEST['toggle_invis'] && in_array($myinfo->id_person,$invises) ) {
	if ($invis==1) {db_use('array',"delete from person_on where type=5 and id_person='".$myinfo->id_person."'");$invis=-1; }
	else {db_use('array',"insert into person_on (id_person,type,timestamp2) values ('".$myinfo->id_person."',5,".(time()+24*60*7*60).")");$invis=1;}
}
#----------------------------
if ($_GET['top']) {

}elseif ($_GET['header']) {
#case 1:

echo "
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />
<meta http-equiv=\"Pragma\" content=\"no-cache\" />
<meta http-equiv=\"Expires\" content=\"0\" />
<meta http-equiv=\"imagetoolbar\" content=\"no\" />
<link href=\"../i/move/design2.css\" rel=\"stylesheet\" type=\"text/css\" />
<script language=\"javascript\" type=\"text/javascript\">
function solo(n) {
	window.location.href='/movement.php?path='+n+'&rnd='+Math.random();
}

function showtable (tblname) {
	hidesel(tblname);
	hidemenu(0);
	document.getElementById('menu'+tblname).style.visibility = 'visible';
	document.getElementById('menu'+tblname).style.width = '';
	document.getElementById('menu'+tblname).style.overflow = 'visible';
}

function hidesel (tblname) {
	for (var i=1;i<=5;i++) {
		if (i!=tblname) {document.getElementById('el'+i).style.backgroundColor='';document.getElementById('el'+i).style.color='';}
	}	
}

function hidemenu (time) {
	for (var i=1;i<=4;i++) {
		document.getElementById('menu'+i).style.visibility = 'hidden';
		document.getElementById('menu'+i).style.width = '1px';
		document.getElementById('menu'+i).style.overflow = 'hidden';
	}	
}

function jumptopath (path,topframe) {
	var rnd=Math.random();
	if (!topframe) {
		top.frames['main".$myinfo->id_person."'].location.href = ''+path+'&rand='+rnd;
	} else {
		top.location.href = ''+path+'&rand='+rnd;
	}
}

function loadpers() {
	document.getElementById('el4').style.backgroundColor='#404040';
	document.getElementById('el4').style.color='#FFFFFF';
	showtable('4');
}

</script>
</head>
<body onload=\"loadpers();\">

";

if ($design==1) {
echo "

<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"height:100%\">
  <tr>
    <td align=\"left\" valign=\"top\" style=\"height:73px\"><table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
        <tr>
          <td style=\"background-image:url(../i/move/1/sand_top_03.gif) \"><img src=\"../i/move/1/capital_top_01.gif\" width=\"239\" height=\"32\" /></td>
          <td align=\"right\" valign=\"top\" style=\"background-image:url(../i/move/1/sand_top_03.gif) \">
            <table height=\"18\" cellspacing=\"0\" cellpadding=\"0\" width=\"450\" border=\"0\">
              <tbody>
                <tr>
                  <td width=\"31\" valign=\"top\"><img height=\"18\" src=\"../i/move/mennu112_043.gif\" width=\"38\" /></td>
                  <td valign=\"top\"><table height=\"14\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" background=\"../i/move/mennu112_06.gif\" border=\"0\">
                      <tbody>
                        <tr align=\"middle\">
                          <td id=\"el1\" class=\"main_text\" onclick=\"this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('1');\">Знания</td>
                          <td width=\"1\"><img height=\"11\" src=\"../i/move/mennu112_09.gif\" width=\"1\" /></td>
                          <td id=\"el2\" class=\"main_text\" onclick=\"this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('2');\">Общение</td>
                          <td width=\"1\"><img height=\"11\" src=\"../i/move/mennu112_09.gif\" width=\"1\" /></td>
                          <td id=\"el3\" class=\"main_text\" onclick=\"this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('3');\">Безопасность</td>
                          <td width=\"1\"><img height=\"11\" src=\"../i/move/mennu112_09.gif\" width=\"1\" /></td>
                          <td id=\"el4\" class=\"main_text\" onclick=\"this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('4');\">Персонаж</td>
                          <td width=\"1\"><img height=\"11\" src=\"../i/move/mennu112_09.gif\" width=\"1\" /></td>
                          <td id=\"el5\" class=\"main_text\" onclick=\"if (confirm('Выйти из игры?')) top.location.href='/main.php?exit=0.638452612300913';\">Выход&nbsp;</td>
                        </tr>
                      </tbody>
                  </table></td>
                  <td width=\"31\" valign=\"top\"><img height=\"18\" src=\"../i/move/mennu112_023.gif\" width=\"31\" /></td>
                </tr>
              </tbody>
            </table></td>
        </tr>
        <tr>
          <td class=\"menutop\"><img src=\"../i/move/1/sand_top_05.gif\" width=\"15\" height=\"13\" /><img src=\"../i/move/1/capital_top_06.gif\" width=\"79\" height=\"13\" /></td>
          <td width=\"100%\" align=\"right\" nowrap=\"nowrap\" class=\"menutop\"><span id=\"menu1\" style=\"visibility:hidden; width:0px; overflow:hidden\">| <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?news=1'); return false;\" href=\"#\">Новости</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/\" target=\"_blank\">Библиотека</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/FAQ/\" target=\"_blank\">FAQ</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/law.html\" target=\"_blank\">Законы</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/law2.html\" target=\"_blank\">Соглашения</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/FAQ/afer.html\" target=\"_blank\">Правила безопасности</a></span> <span id=\"menu2\" style=\"visibility:hidden; width:0px; overflow:hidden\">| <a class=\"menutop\" onclick=\"this.blur();\" href=\"/event\" target=\"_blank\">События</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/forum.php\" target=\"_blank\">Форум</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"http://top.antibk.org/\" target=\"_blank\">Рейтинг сайтов</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"http://antibk.org/topgen.php/\" target=\"_blank\">Рейтинг бойцов</a></span> <span id=\"menu3\" style=\"visibility:hidden; width:0px; overflow:hidden\">| <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?logenters=1'); return false;\" href=\"#\">Отчеты</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/FAQ/afer.html\" target=\"_blank\">Правила</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?changepsw=1'); return false;\" href=\"#\">Настройки</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?changepsw=1'); return false;\" href=\"#\">Смена пароля</a></span> <span id=\"menu4\" style=\"visibility:hidden; width:0px; overflow:hidden\">| <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?edit=1'); return false;\" href=\"#\">Инвентарь</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?skills=1'); return false;\" href=\"#\">Умения</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?schet=1'); return false;\" href=\"#\">Отчет о переводах</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/zayavka.php?a='); return false;\" href=\"#\">Поединки</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?editanketa=1'); return false;\" href=\"#\">Анкета</a> | <a class=\"menutop\" onclick=\"this.blur(); if (confirm('Вы уверены, что хотите переключиться на сокращенный тип дизайна?')) {jumptopath('/main.php?ch_design=2','1');} return false;\" href=\"#\">Дизайн</a></span>&nbsp;</td>
        </tr>
        <tr style=\"background-image: url(../i/move/1/capital_top_14.gif)\">
          <td><img src=\"../i/move/1/capital_top_09.gif\" width=\"15\" height=\"17\" /><img src=\"../i/move/1/capital_top_10.gif\" width=\"79\" height=\"17\" /><img src=\"../i/move/1/capital_top_11.gif\" width=\"137\" height=\"17\" /></td>
          <td width=\"100%\" align=\"right\"><img src=\"../i/move/1/capital_top_16.gif\" width=\"24\" height=\"17\" /></td>
        </tr>
        <tr>
          <td style=\"background-image: url(../i/move/1/sand_top_20.gif) \"><img src=\"../i/move/1/sand_top_17.gif\" width=\"15\" height=\"11\" /><img src=\"../i/move/1/capital_top_18.gif\" width=\"79\" height=\"11\" /></td>
          <td width=\"100%\" align=\"right\" style=\"background-image: url(../i/move/1/sand_top_20.gif)\"><img src=\"../i/move/1/sand_top_23.gif\" width=\"24\" height=\"11\" /></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>

";die;
} elseif ($design==2) {
echo "
<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr style=\"background-image:url(../i/lite/top_lite_cap_03.gif) \">
    <td align=\"left\"><img src=\"../i/lite/top_lite_cap_01.gif\" width=\"64\" height=\"14\" /></td>
    <td align=\"right\" class=\"main_text\"><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"448\">
      <tr valign=\"bottom\">
        <td width=\"31\" height=\"14\"><img height=\"14\" src=\"../i/lite/mennu112_06_lite.gif\" width=\"31\" /></td>
        <td align=\"center\"><table height=\"14\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" background=\"../i/move/mennu112_06.gif\" border=\"0\">
            <tr align=\"middle\">
              <td id=\"el1\" class=\"main_text\" onclick=\"this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('1');\">Знания</td>
              <td width=\"1\"><img height=\"11\" src=\"../i/move/mennu112_09.gif\" width=\"1\" /></td>
              <td id=\"el2\" class=\"main_text\" onclick=\"this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('2');\">Общение</td>
              <td width=\"1\"><img height=\"11\" src=\"../i/move/mennu112_09.gif\" width=\"1\" /></td>
              <td id=\"el3\" class=\"main_text\" onclick=\"this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('3');\">Безопасность</td>
              <td width=\"1\"><img height=\"11\" src=\"../i/move/mennu112_09.gif\" width=\"1\" /></td>
              <td id=\"el4\" class=\"main_text\" onclick=\"this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('4');\">Персонаж</td>
              <td width=\"1\"><img height=\"11\" src=\"../i/move/mennu112_09.gif\" width=\"1\" /></td>
              <td id=\"el5\" class=\"main_text\" onclick=\"if (confirm('Выйти из игры?')) top.location.href='/main.php?exit=0.477127324994232';\">Выход&nbsp;</td>
            </tr>
        </table></td>
        <td width=\"38\"><img height=\"14\" src=\"../i/lite/mennu112_04_lite.gif\" width=\"37\" /></td>
      </tr>
    </table></td>
  </tr>
  <tr style=\"background-image:url(../i/lite/top_lite_cap_11.gif) \">
    <td align=\"left\"><img src=\"../i/lite/top_lite_cap_07.gif\" width=\"15\" height=\"17\" /><img src=\"../i/lite/top_lite_cap_08.gif\" width=\"175\" height=\"17\" /></td>
    <td align=\"right\"><table cellspacing=\"0\" cellpadding=\"0\" width=\"448\" style=\"background-image:url(../i/lite/top_lite_devils_15.gif);\" border=\"0\">
      <tr>
        <td align=\"left\"><img height=\"17\" src=\"../i/lite/top_lite_devils_13.gif\" width=\"20\" /></td>
        <td valign=\"top\"><table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\">
            <tr>
              <td align=\"right\" nowrap=\"nowrap\" class=\"menutop\" width=\"100%\"><span id=\"menu1\" style=\"visibility:hidden; width:0px; overflow:hidden\"> <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?news=1'); return false;\" href=\"#\">Новости</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/\" target=\"_blank\">Библиотека</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/FAQ/\" target=\"_blank\">FAQ</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/law.html\" target=\"_blank\">Законы</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/law2.html\" target=\"_blank\">Соглашения</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/FAQ/afer.html\" target=\"_blank\">Правила безопасности</a></span> <span id=\"menu2\" style=\"visibility:hidden; width:0px; overflow:hidden\"><a class=\"menutop\" onclick=\"this.blur();\" href=\"/event\" target=\"_blank\">События</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/forum.php\" target=\"_blank\">Форум</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"http://top.antibk.org/\" target=\"_blank\">Рейтинг сайтов</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"http://antibk.org/topgen.php/\" target=\"_blank\">Рейтинг бойцов</a></span> <span id=\"menu3\" style=\"visibility:hidden; width:0px; overflow:hidden\"><a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?logenters=1'); return false;\" href=\"#\">Отчеты</a> | <a class=\"menutop\" onclick=\"this.blur();\" href=\"/encicl/FAQ/afer.html\" target=\"_blank\">Правила</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?changepsw=1'); return false;\" href=\"#\">Настройки</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?changepsw=1'); return false;\" href=\"#\">Смена пароля</a></span> <span id=\"menu4\" style=\"visibility:hidden; width:0px; overflow:hidden\"><a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?edit=1'); return false;\" href=\"#\">Инвентарь</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?skills=1'); return false;\" href=\"#\">Умения</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?schet=1'); return false;\" href=\"#\">Отчет о переводах</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/zayavka.php?a='); return false;\" href=\"#\">Поединки</a> | <a class=\"menutop\" onclick=\"this.blur(); jumptopath('/main.php?editanketa=1'); return false;\" href=\"#\">Анкета</a> | <a class=\"menutop\" onclick=\"this.blur(); if (confirm('Вы уверены, что хотите переключиться на нормальный тип дизайна?')) {jumptopath('/main.php?ch_design=1','1');} return false;\" href=\"#\">Дизайн</a></span>&nbsp;</td>
            </tr>
        </table></td>
        <td align=\"right\"><img height=\"17\" src=\"../i/lite/top_lite_devils_18.gif\" width=\"22\" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan=\"2\" valign=\"top\" style=\"background-image:url(../i/lite/sand_top_20s.gif); background-repeat:repeat-x;\"><table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
        <tr valign=\"top\">
          <td><img src=\"../i/lite/sand_lit_20.gif\" width=\"15\" height=\"6\" /><img src=\"../i/lite/cap_lit_21.gif\" width=\"79\" height=\"6\" /></td>
          <td width=\"100%\"><img src=\"../i/lite/sand_top_20s.gif\" width=\"31\" height=\"6\" /></td>
          <td><img src=\"../i/lite/sand_lit_27.gif\" width=\"24\" height=\"6\" /></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>

";die;
}


#break;
}

#==========================================================================
if ($_GET['ch']) {
echo"
<HTML><HEAD>
<meta content=\"text/html; charset=windows-1251\" http-equiv=Content-type>
<style type=\"text/css\">
.menu {
  background-color: #d2d0d0;
  border-color: #ffffff #626060 #626060 #ffffff;
  border-style: solid;
  border-width: 1px;
  position: absolute;
  left: 0px;
  top: 0px;
  visibility: hidden;
}

a.menuItem {
  border: 0px solid #000000;
  color: #003388;
  display: block;
  font-family: MS Sans Serif, Arial, Tahoma,sans-serif;
  font-size: 8pt;
  font-weight: bold;
  padding: 2px 12px 2px 8px;
  text-decoration: none;
}

a.menuItem:hover {
  background-color: #a2a2a2;
  color: #0066FF;
}

a,span {
  FONT-SIZE: 10pt;
  FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
  text-decoration: none;
  FONT-WEIGHT: bold;
  color: #003388;
  cursor: hand;
}
body, td, ol, ul, li , p {
  FONT-SIZE: 10pt;
  FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
}
a:hover		{ color: #0066FF}
.number		{ font-size: 11pt; font-weight: bold; color: #6F0000}
.p			{ font-weight:bold; color: red; background-color: #FAE0E0}
.date		{ font-family: Courier; font-size: 8pt; text-decoration:none; font-weight:normal; color: #007000}
.date2		{ font-family: Courier; font-size: 8pt; text-decoration:none; font-weight:normal; color: #007000; background-color: #00FFAA}
.sysdate	{ font-family: Courier; font-size: 8pt; text-decoration:none; font-weight:normal; color: #B00000}
</style>
<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"../i/ch2.87.js\"></SCRIPT>
<SCRIPT LANGUAGE=\"JavaScript\">
var maxsmiles = 30;
var smilesimgpath='<IMG border=0 src=../i/smile/';
var smilesimgstyle=' style=\"cursor:hand\" onclick=\"sml(\'';
var user = '".$myinfo->name."';

function sml(smile){
top.frames['bottom'].document.forms[0].text.value += ' :'+smile+': ';
}
function am(text){
    var s=\"\";
    var spl=text.split(\"<BR>\");
    for (var k=0; k<spl.length; k++){
      var txt=spl[k];
	  if (txt.length>0) {
		var i,j=0;
		for (i=0; i < sm.length; i+=3) {
			while(txt.indexOf(':'+sm[i]+':') >= 0) {
				txt = txt.replace(':'+sm[i]+':', smilesimgpath + sm[i] + '.gif ' + 'width='+sm[i+1]+' height='+sm[i+2]+smilesimgstyle+sm[i]+'\')\">');
				if (++j >= maxsmiles) break;
			}
			if (j>=maxsmiles) break;
		}
		if ((j=txt.indexOf('private ['))>0 && (i=txt.indexOf(']', j+9))>0 && txt.indexOf('</font> [<SPAN>'+user+'</SPAN>] ')>0) {
			var user2 = txt.substring(j+9, i);
			txt = txt.replace('private ['+user2+']', '<SPAN class=p alt=\"'+user2+'\">private ['+user2+']</SPAN>');
			var user3='';
			if ((j=txt.indexOf('[<SPAN>'))>0) {
				i=txt.indexOf('</', j+7);
				user3 = txt.substring(j+7, i);
			}
			if (user!=user3) {snotify(1,'nocheck');}
		} else if (txt.indexOf('private ['+user+']')>0) {
			if ((j=txt.indexOf('[<SPAN>'))>0) {
				i=txt.indexOf('</', j+7);
				var user2 = txt.substring(j+7, i);
				txt = txt.replace('private ['+user+']', '<SPAN class=p alt=\"'+user2+'\">private ['+user+']</SPAN>');
				if (user!=user2) {snotify(1,'nocheck');}
			} else { 
				txt = txt.replace('private ['+user+']', '<b>private ['+user+']</b>');
				snotify(1,'nocheck');
			}
			txt = txt.replace('<font class=date>', '<font class=date2>');
		} else if (txt.indexOf('to ['+user+']')>0) {
			var user2='';
			if ((j=txt.indexOf('[<SPAN>'))>0) {
				i=txt.indexOf('</', j+7);
				user2 = txt.substring(j+7, i);
			}
			txt = txt.replace('to ['+user+']', '<b>to ['+user+']</b>');
			txt = txt.replace('<font class=date>', '<font class=date2>');
			if ((user2 && user!=user2) || user2=='') {snotify(1,'check');}
		} else {
			var user2;
			if ((j=txt.indexOf('[<SPAN>'))>0) {
				i=txt.indexOf('</', j+7);
				user2 = txt.substring(j+7, i);
			}
			if ((user2 && user!=user2) || user2=='') {snotify(1,'check');}
		}
		s+=txt+\"<BR>\";
	  }
    }
    mes.innerHTML += s;
	window.scrollBy(0, 65000);
}

function snotify (sid, chk) {
	if ((top.ChatOm==true && top.SoundSys==true) || (top.ChatOm==false && chk=='nocheck' && top.SoundSys==true)) {
		var volume=top.frames['bottom'].soundvol;
		top.frames['bottom'].window.document.Sound.SetVariable(\"Volume\", (volume*50));
		top.frames['bottom'].window.document.Sound.SetVariable(\"Sndplay\",sid);
	}	
}

</SCRIPT>
</HEAD>
<body topmargin=0 marginheight=0 bgcolor=f2f0f0 onload=\"top.strt()\">
<TEXTAREA ID=\"holdtext\" STYLE=\"display:none;\"></TEXTAREA>
<DIV ID=oMenu CLASS=\"menu\" onmouseout=\"closeMenu()\"></DIV>
<div id=\"mes\" onclick=\"AddLogin()\" oncontextmenu=\"OpenMenu()\"></div>
</BODY></HTML>
";
}else{
echo "
<HTML>
<HEAD>
<link rel=\"stylesheet\" type=\"text/css\" href=\"../i/main.css\">
<meta content=\"text/html; charset=windows-1251\" http-equiv=\"Content-type\">
<script language=\"javascript\" type=\"text/javascript\">
var map_en = new Array('s`h','S`h','S`H','s`Х','sh`','Sh`','SH`',\"'o\",'yo',\"'O\",'Yo','YO','zh','w','Zh','ZH','W','ch','Ch','CH','sh','Sh','SH','e`','E`',\"'u\",'yu',\"'U\",'Yu',\"YU\",\"'a\",'ya',\"'A\",'Ya','YA','a','A','b','B','v','V','g','G','d','D','e','E','z','Z','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','r','R','s','S','t','T','u','U','f','F','h','H','c','C','`','y','Y',\"'\")
var map_ru = new Array('сх','Сх','СХ','сХ','щ','Щ','Щ','ё','ё','Ё','Ё','Ё','ж','ж','Ж','Ж','Ж','ч','Ч','Ч','ш','Ш','Ш','э','Э','ю','ю','Ю','Ю','Ю','я','я','Я','Я','Я','а','А','б','Б','в','В','г','Г','д','Д','е','Е','з','З','и','И','й','Й','к','К','л','Л','м','М','н','Н','о','О','п','П','р','Р','с','С','т','Т','у','У','ф','Ф','х','Х','ц','Ц','ъ','ы','Ы','ь')

function convert(str)
{	for(var i=0;i<map_en.length;++i) while(str.indexOf(map_en[i])>=0) str = str.replace(map_en[i],map_ru[i]);
	return str;
}
function translate() {	// translates latin to russian
	var strarr = new Array();
	strarr = document.F1.text.value.split(' ');
	for(var k=0;k<strarr.length;k++) {
		if(strarr[k].indexOf(\"http://\") < 0 && strarr[k].indexOf('@') < 0 && strarr[k].indexOf(\"www.\") < 0 && !(strarr[k].charAt(0)==\":\" && strarr[k].charAt(strarr[k].length-1)==\":\")) {
			if ((k<strarr.length-1)&&(strarr[k]==\"to\" || strarr[k]==\"private\")&&(strarr[k+1].charAt(0)==\"[\")) {
				while ( (k<strarr.length-1) && (strarr[k].charAt(strarr[k].length-1)!=\"]\") ) k++;
			} else { strarr[k] = convert(strarr[k]) }
		}
	}
	document.F1.text.value = strarr.join(' ');
}

function sw_translit()
{
   top.ChatTranslit = ! top.ChatTranslit;
   if (top.ChatTranslit) {
       document.all('b___translit').src = b___translit_on.src;
	   document.all('b___translit').alt = b___translit_on.alt;
   } else {
       document.all('b___translit').src = b___translit_off.src;
	   document.all('b___translit').alt = b___translit_off.alt;
   }
}

function sw_filter()
{
   top.ChatOm = ! top.ChatOm;
   if (top.ChatOm) {
       document.all('b___filter').src = b___filter_on.src;
	   document.all('b___filter').alt = b___filter_on.alt;
	   document.F1.om.value = '1';
   } else {
       document.all('b___filter').src = b___filter_off.src;
	   document.all('b___filter').alt = b___filter_off.alt;
	   document.F1.om.value = '';
   }
}

function sw_sys()
{
   top.ChatSys = ! top.ChatSys;
   if (top.ChatSys) {
       document.all('b___sys').src = b___sys_on.src;
	   document.all('b___sys').alt = b___sys_on.alt;
	   document.F1.sys.value = '1';
   } else {
       document.all('b___sys').src = b___sys_off.src;
	   document.all('b___sys').alt = b___sys_off.alt;
	   document.F1.sys.value = '';
   }
}

var soundvol = 0;
function sw_sound() {
   if (soundvol==2 || soundvol==0) {top.SoundSys = ! top.SoundSys;}
   if (top.SoundSys) {
       soundvol++;
	   if (soundvol==1) {
	   		document.all('b___sound').src = b___sound_on.src;
	   		document.all('b___sound').alt = b___sound_on.alt;
	   } else if (soundvol==2) {
	   		document.all('b___sound').src = b___sound_on2.src;
	   		document.all('b___sound').alt = b___sound_on2.alt;
	   }
	   document.F1.sound.value = '1';
   } else {
       document.all('b___sound').src = b___sound_off.src;
	   document.all('b___sound').alt = b___sound_off.alt;
	   document.F1.sound.value = '';
	   soundvol=0;
   }
}

function sw_slow()
{
   if (top.ChatSlow) {
     if (top.ChatTimerID >= 0) { // выключаем чат
	     top.StopRefreshChat();
         document.all('b___slow').src = b___chat_off.src; document.all('b___slow').alt = b___chat_off.alt;
	 } else { // Запускаем чат на нормальную скорость
	     top.ChatSlow = false;
	     top.ChatDelay=top.ChatNormDelay;
		 top.RefreshChat();
         document.all('b___slow').src = b___slow_off.src; document.all('b___slow').alt = b___slow_off.alt;
	 }
   } else { // замедляем чат
     top.ChatSlow = true;
     document.all('b___slow').src = b___slow_on.src; document.all('b___slow').alt = b___slow_on.alt;
	 top.ChatDelay=top.ChatSlowDelay;
	 top.RefreshChat();
   }
}

function subm()
{
	if (top.ChatTranslit) translate()
}

var b___translit_on = new Image; b___translit_on.src=\"../i/move/b___translit_on.gif\"; b___translit_on.alt=\"(включено) Преобразовывать транслит в русский текст\";
var b___translit_off = new Image; b___translit_off.src=\"../i/move/b___translit_off.gif\"; b___translit_off.alt=\"(выключено) Преобразовывать транслит в русский текст\";
var b___filter_on = new Image; b___filter_on.src=\"../i/move/b___filter_on.gif\"; b___filter_on.alt=\"(включено) Показывать в чате только сообщения адресованные мне\";
var b___filter_off = new Image; b___filter_off.src=\"../i/move/b___filter_off.gif\"; b___filter_off.alt=\"(выключено) Показывать в чате только сообщения адресованные мне\";
var b___sys_on = new Image; b___sys_on.src=\"../i/move/b___sys_on.gif\"; b___sys_on.alt=\"(включено) Показывать в чате системные сообщения\";
var b___sys_off = new Image; b___sys_off.src=\"../i/move/b___sys_off.gif\"; b___sys_off.alt=\"(выключено) Показывать в чате системные сообщения\";
var b___slow_on = new Image; b___slow_on.src=\"../i/move/b___slow_on.gif\"; b___slow_on.alt=\"(включено) Медленное обновление чата (раз в минуту)\";
var b___slow_off = new Image; b___slow_off.src=\"../i/move/b___slow_off.gif\"; b___slow_off.alt=\"(выключено) Медленное обновление чата (раз в минуту)\";
var b___sound_on = new Image; b___sound_on.src=\"../i/move/b___sound_on.gif\"; b___sound_on.alt=\"(включено 'тихо') Звуковые уведомления\";
var b___sound_on2 = new Image; b___sound_on2.src=\"../i/move/b___sound_on2.gif\"; b___sound_on2.alt=\"(включено 'громко') Звуковые уведомления\";
var b___sound_off = new Image; b___sound_off.src=\"../i/move/b___sound_off.gif\"; b___sound_off.alt=\"(выключено) Звуковые уведомления\";
var b___chat_off = new Image; b___chat_off.src=\"../i/move/b___chat_off.gif\"; b___chat_off.alt=\"Обновление чата выключено!\";

function smiles()
{
   var x = event.screenX - 180;
   var y = event.screenY - 390;
   var sFeatures = 'dialogLeft:'+x+'px;dialogTop:'+y+'px;dialogHeight:400px;dialogWidth:365px;help:no;status:no;unadorned:yes';
   window.showModelessDialog(\"smiles.html\", window, sFeatures);
}
function rslength() // изменяет размер строки ввода текста
{";

	  switch ((int)$myinfo->align) {
	  	case 1:$pal=1;break;
	  	case 50:$pal=1;break;
		case 3:$drk=1;break;
	  }
	#  if ($myinfo->align==3.99 or $myinfo->align==3.81) {
	#	$pal=1;
	# }
$res=db_use('array',"select pal_access from align where align='".$myinfo->align."'");
$pal_abil=$res['pal_access'];
for ($i=0;$i<strlen($pal_abil);$i++) if ($pal_abil[$i]) $pal=1; 
if ($myinfo->align==50 OR $myinfo->align==1.999 or in_array($myinfo->id_person,$alhimics)) {$alh=1;}
	#  if ($myinfo->id_person==411 or $myinfo->id_person==1224 or $myinfo->id_person==1509 OR $myinfo->id_person==37 OR $myinfo->id_person==430 OR $myinfo->id_person==487 OR $myinfo->id_person==12 OR $myinfo->id_person==140) {
	 # 	$pal=1;
	 # }
	  if (in_array($myinfo->id_person,$svyas) OR in_array($myinfo->id_person,$shmot) OR in_array($myinfo->id_person,$alhimics) OR (int)($myinfo->align)==1) {$pal=1;}
	  if ($myinfo->id_person==12) {$vip=1;}
	  
	  #											инв тем дру		 кла 								вых
	 # 	var size = document.body.clientWidth-(6*30)				-31		-59		-256		-18		-30;
#6 кнопок - 31 - 59 смайл - 256 часы - 18 - 30
echo"
	var size = document.body.clientWidth-(6*30)-59-256-18".(($myinfo->level>=4 && (int)$myinfo->align!=2)?"-30":'').($pal?"-30":'').($vip?"-30":'').($drk?"-30":'').($alh?"-30":'').(($myinfo->id_clan OR ispal($myinfo->align))?"-30":'').(in_array($myinfo->id_person,$invises)?"-40":'').";
	if (size<100) { size=100 }
	document.F1.text.width = size;
	document.all('T2').width = size;
}
window.onresize=rslength;

function clearc()
{
	if (document.F1.text.value == '') {
		if (confirm('Очистить окно чата?')) top.frames['chat'].document.all('mes').innerHTML='';
	} else { document.F1.text.value=''; }
	document.F1.text.focus();
}
</script>
</HEAD>
<body leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 bgcolor=#E6E6E6 onLoad=\"rslength()\" onFocus=\"document.forms[0].text.focus()\">
<form action=\"ch.php\" method=\"get\" name=\"F1\" target=\"refreshed\" id=\"F1\" onSubmit=\"subm();top.NextRefreshChat();\">
  <input type=\"hidden\" name=\"color\" value=\"000000\" />
  <input type=\"hidden\" name=\"sys\" value=\"\" />
  <input type=\"hidden\" name=\"om\" value=\"\" />
  <input type=\"hidden\" name=\"lid\" value=\"\" />
  <input type=\"hidden\" name=\"sound\" value=\"\" />
  <table width=\"100%\" height=\"30\" cellspacing=\"0\" cellpadding=\"0\">
    <tr valign=\"top\" style=\"background-image:url(../i/move/beg_chat_03.gif); background-position: top; background-repeat:repeat-x; \">
      <td width=\"9\"><img src=\"../i/move/bkf_l_r1_02.gif\" width=\"9\" height=\"30\"></td>
      <td width=\"30\"><img src=\"../i/move/b___.gif\" width=\"30\" height=\"30\" alt=\"Чат\" /></td>
      <td valign=\"middle\" id=\"T2\"><input type=\"text\" name=\"text\" maxlength=\"240\" size=\"80\" onKeyUp=\"if((event.ctrlKey) && ((event.keyCode==10)||(event.keyCode==13)) || ((event.keyCode==10)||(event.keyCode==13))) { document.F1.sbm.click() }\" /></td>
      <td nowrap id=\"T3\"><img src=\"../i/move/b___ok.gif\" width=\"30\" height=\"30\" alt=\"Добавить текст в чат\" style=\"cursor: hand\" onClick=\"document.F1.sbm.click()\" /><img src=\"../i/1x1.gif\" width=\"8\" height=\"1\" alt=\"\" /><img src=\"../i/move/b___clear.gif\" width=\"30\" height=\"30\" alt=\"Очистить строку ввода/чат\" style=\"cursor: hand\" onClick=\"clearc()\" /><img src=\"../i/move/b___filter_off.gif\" alt=\"(выключено) Показывать в чате только сообщения адресованные мне\" name=\"b___filter\" width=\"30\" height=\"30\" id=\"b___filter\" style=\"cursor: hand\" onClick=\"sw_filter();\" /><img src=\"../i/move/b___sys_off.gif\" alt=\"(выключено) Показывать в чате системные сообщения\" name=\"b___sys\" width=\"30\" height=\"30\" id=\"b___sys\" style=\"cursor: hand\" onClick=\"sw_sys();\" /><img src=\"../i/move/b___slow_off.gif\" alt=\"(выключено) Медленное обновление чата (раз в минуту)\" name=\"b___slow\" width=\"30\" height=\"30\" id=\"b___slow\" style=\"cursor: hand\" onClick=\"sw_slow();\" /><img src=\"../i/move/b___translit_off.gif\" alt=\"(выключено) Преобразовывать транслит в русский текст (правила перевода см. в энциклопедии)\" name=\"b___translit\" width=\"30\" height=\"30\" id=\"b___translit\" style=\"cursor: hand\" onClick=\"sw_translit();\" /><img src=\"../i/move/b___sound_off.gif\" alt=\"(выключено) Звуковые уведомления\" name=\"b___sound\" width=\"30\" height=\"30\" id=\"b___sound\" style=\"cursor: hand\" onClick=\"sw_sound();\" /><img src=\"../i/1x1.gif\" width=\"7\" height=\"1\" alt=\"\" /><img src=\"../i/".($afk['afk']<0?'chat_on_afk':'chat_off_afk').".gif\" onclick=\"document.location.href='buttons.php?toggle_afk=1';\" alt=\"".($afk['afk']>0?'Сейчас режим AFK (не на месте) включен. Выключить?':'Включить режим AFK?')."\">".(in_array($myinfo->id_person,$invises)?"<img src=\"../i/items/".($invis<0?'pal_buttona':'trap').".gif\" onclick=\"document.location.href='buttons.php?toggle_invis=1';\" alt=\"".($afk['afk']>0?'Сейчас режим invis включен. Выключить?':'Включить режим invis?')."\">":"")."
      <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"1\" height=\"1\" id=\"Sound\" align=\"middle\">
          <param name=\"allowScriptAccess\" value=\"always\" />
          <param name=\"movie\" value=\"../i/flash/Sound2.2.swf\" />
          <param name=\"quality\" value=\"high\" />
          <param name=\"scale\" value=\"noscale\" />
          <param name=\"wmode\" value=\"transparent\" />
          <embed src=\"../i/flash/Sound2.1.swf\" quality=\"high\" scale=\"noscale\" wmode=\"transparent\" width=\"1\" height=\"1\" name=\"Sound\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />
      </object><img src=\"../i/move/b___smile.gif\" width=\"30\" height=\"30\" alt=\"Смайлики\" style=\"cursor:hand\" onClick=\"smiles()\" /></td>
      <td width=\"19\" id=\"T4\" background=\"../i/b___bg2.gif\"><img src=\"../i/move/beg_chat_05.gif\" width=\"19\" height=\"30\" alt=\"\" /></td>
      <td align=\"right\" nowrap=\"nowrap\" bgcolor=\"BAB7B3\" id=\"T5\" background=\"../i/b___bg2.gif\"><img src=\"../i/a___inv.gif\" width=\"30\" height=\"30\" alt=\"Настройки/Инвентарь\" style=\"cursor:hand\" onClick=\"top.cht('/main.php?edit='+Math.random())\" />";
	  

	  echo (($myinfo->level>=4 && (int)$myinfo->align!=2)?"<img src=\"../i/a___trf.gif\" width=\"30\" height=\"30\" alt=\"Передать предметы/кредиты\" style=\"cursor:hand\" onClick=\"top.cht('/main.php?setkredit='+Math.random())\" />":'').($drk?"<img src=\"../i/a___drk.gif\" width=\"30\" height=\"30\" alt=\"Темные\" style=\"cursor:hand\" onClick=\"top.cht('/dark.php?0.136279637992534')\" />":"").($pal?"<img src=\"../i/a___pal.gif\" width=\"30\" height=\"30\" alt=\"Светлые\" style=\"cursor:hand\" onClick=\"top.cht('/pal.php?0.136279637992534')\" />":"")."<img src=\"../i/a___friend3.gif\" width=\"30\" height=\"30\" alt=\"Друзья\" style=\"cursor:hand\" onClick=\"top.cht('/main.php?friends=0.136279637992534')\" />".($alh?"<img src=\"../i/a___dlr.gif\" width=\"30\" height=\"30\" alt=\"Алхимка\" style=\"cursor:hand\" onClick=\"top.cht('/alh.php?0.136279637992534')\" />":"").($vip?"<img src=\"../i/a___vip.gif\" width=\"30\" height=\"30\" alt=\"VIP\" style=\"cursor:hand\" onClick=\"top.cht('/vip.php?0.136279637992534')\" />":"").(($myinfo->id_clan OR ispal($myinfo->align))?"<img src=\"../i/a___kln.gif\" width=\"30\" height=\"30\" alt=\"Клан\" style=\"cursor:hand\" onClick=\"top.cht('/clans.php?0.136279637992534')\" />":"")."<img src=\"../i/a___ext.gif\" width=\"30\" height=\"30\" alt=\"Выход из игры\" style=\"cursor:hand\" onClick=\"if (confirm('Выйти из игры?')) top.window.navigate('/main.php?exit=0.136279637992534')\" /></td>
      <td width=\"70\" valign=\"middle\" background=\"../i/b___bg2.gif\" bgcolor=\"BAB7B3\" id=\"T6\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"70\" height=\"26\">
          <param name=\"movie\" value=\"../i/flash/clock.swf?hours=".date('H')."&minutes=".date('i')."&sec=".(date('s')+1)."\" />
          <param name=\"quality\" value=\"high\" />
        </object>
      </td>
      <td width=\"9\" valign=\"middle\" background=\"../i/b___bg2.gif\" bgcolor=\"BAB7B3\"><img src=\"../i/move/bkf_l_r1_06.gif\" width=\"9\" height=\"30\"></td>
    </tr>
  </table>
  <script language=\"JavaScript\" type=\"text/javascript\">
var user = top.getCookie(\"ChatColor\");
if ((user != null)&&(user != \"\")) document.F1.color.value = user;
document.F1.text.focus();
</script>
  <input type=\"submit\" name=\"sbm\" style=\"display:none\" />
</form>
</body>
</html>";

 }

} else {
$session->destroy_session(session_id() );
session_destroy();
header("Location: totop.htm"); 
die;
}
?>