<?
include_once("req.php");
error_reporting(E_ALL ^ E_NOTICE);
$text=$_REQUEST['text'];
array_walk($_REQUEST,"format_string");
array_walk($_POST,"format_string");
array_walk($_GET,"format_string");
$_REQUEST['text']=$text;
@setlocale(LC_ALL, array ('ru_RU.CP1251', 'rus_RUS.1251'));


$pattern = "/\w{0,5}[хx]([хx\s\!@#\$%\^&*+-\|\/]{0,6})[уy]([уy\s\!@#\$%\^&*+-\|\/]{0,6})[ёiлeеюийя]\w{0,7}|\w{0,6}[пp]([пp\s\!@#\$%\^&*+-\|\/]{0,6})[iие]([iие\s\!@#\$%\^&*+-\|\/]{0,6})[3зс]([3зс\s\!@#\$%\^&*+-\|\/]{0,6})[дd]\w{0,10}|[сcs][уy]([уy\!@#\$%\^&*+-\|\/]{0,6})[4чkк]\w{1,3}|\w{0,4}[bб]([bб\s\!@#\$%\^&*+-\|\/]{0,6})[lл]([lл\s\!@#\$%\^&*+-\|\/]{0,6})[yя]\w{0,10}|\w{0,8}[её][bб][лске@eыиаa][наи@йвл]\w{0,8}|\w{0,4}[еe]([еe\s\!@#\$%\^&*+-\|\/]{0,6})[бb]([бb\s\!@#\$%\^&*+-\|\/]{0,6})[uу]([uу\s\!@#\$%\^&*+-\|\/]{0,6})[н4ч]\w{0,4}|\w{0,4}[еeё]([еeё\s\!@#\$%\^&*+-\|\/]{0,6})[бb]([бb\s\!@#\$%\^&*+-\|\/]{0,6})[нn]([нn\s\!@#\$%\^&*+-\|\/]{0,6})[уy]\w{0,4}|\w{0,4}[еe]([еe\s\!@#\$%\^&*+-\|\/]{0,6})[бb]([бb\s\!@#\$%\^&*+-\|\/]{0,6})[оoаa@]([оoаa@\s\!@#\$%\^&*+-\|\/]{0,6})[тnнt]\w{0,4}|\w{0,10}[ё]([ё\!@#\$%\^&*+-\|\/]{0,6})[б]\w{0,6}|\w{0,4}[pп]([pп\s\!@#\$%\^&*+-\|\/]{0,6})[иeеi]([иeеi\s\!@#\$%\^&*+-\|\/]{0,6})[дd]([дd\s\!@#\$%\^&*+-\|\/]{0,6})[oоаa@еeиi]([oоаa@еeиi\s\!@#\$%\^&*+-\|\/]{0,6})[рr]\w{0,12}/i";

$replacement = "<вырезано цензурой>";

#$_REQUEST['text'] = preg_replace($pattern, $replacement,$_REQUEST['text']);

session_start();
include_once("session_class.php");
include_once("persinfo_class.php");
error_reporting(E_ALL ^ E_NOTICE);
$session = new Sessions;
/*
    $res=db_use('query',"show processlist");
    unset($i);while($i<mysql_num_rows($res)) {
      $i++;$plist=mysql_fetch_array($res);
      if ($plist['Time']>10) {
    #   db_use('query',"insert into agreatselect (id,time,info,state) values ('".$plist['Id']."','".$plist['Time']."','".addslashes($plist['Info'])."','".$plist['State']."');");
      }
    }
*/
if ($session->is_session(session_id())) {

$myinfo =new Persinfo($session->id_person);
$myinfo->get_chat_params();
$_REQUEST['text']==stripslashes($_REQUEST['text']);
setcookie ("ChatColor", $myinfo->chatcolor, time()+3600, "/", $_SERVER['SERVER_NAME'], 0);

if ($_GET['sbm'] && $_REQUEST['text']) {
  $res=db_use('array',"select * from person_on where id_person='".$myinfo->id_person."' and type=1;");
  if (!$res['id_person']) {


    echo "<script>top.frames['bottom'].document.F1.text.value='';</script>";
    if (substr(TRIM($_REQUEST['text']),0,10)!='telegraf [') {
      db_use('query',"INSERT INTO chat (id_person,timestamp,id_room,nick,text,color,type) VALUES ('".$myinfo->id_person."','".time()."','".$myinfo->id_room."','".($myinfo->invis?'<i>невидимка</i>':mysql_escape_string($myinfo->name))."','".mysql_escape_string(str_replace("\\","&#x5C;",htmlspecialchars($_REQUEST['text'])))."','".$myinfo->chatcolor."',".(substr(TRIM(str_replace("\\","&#x5C;",htmlspecialchars($_REQUEST['text']))),0,9)=='private ['?1:0).");"); #бяки ((\x3cbr\x3e\x3cFONT class=date2\x3e13:23\x3c/FONT\x3e \x3cFONT color=red\x3eВнимание!\x3c/FONT\x3e Артефакт обиделся на всех ((
      if (substr(TRIM($_REQUEST['text']),0,9)!='private [') {
      # db_use('query',"update person set money=money+0.01 where id_person='".$myinfo->id_person."'");
      }
    }else{# telegraf
      if ($myinfo->align!=1.6 && $myinfo->align!=1.9 && $myinfo->align!=1.91 && $myinfo->align!=1.99 && $myinfo->align!=1.999 && !($myinfo->align==1.001 && $myinfo->id_clan==24)) {
        if ($myinfo->money<10) {
          echo"<script>alert('Не хватает кр');</script>";
          break;
        }else{
          db_use('query',"update person set money=money-10 where id_person='".$myinfo->id_person."'");
          echo"<script>alert('Послано платное телеграфное сообщение: ".addslashes($_REQUEST['text']).". (10кр)');</script>";
        }
      }else{
        echo"<script>alert('Сообщение: ".addslashes($_REQUEST['text'])." отправлено.');</script>";
      }
      db_use('query',"INSERT INTO chat (id_person,timestamp,id_room,nick,text,color,type) VALUES ('".$myinfo->id_person."','".time()."',0,'".$myinfo->id_person."','".mysql_escape_string($myinfo->name).'[telegraf] '.mysql_escape_string(str_replace("\\","&#x5C;",htmlspecialchars($_REQUEST['text'])))."','".$myinfo->chatcolor."',7);"); #бяки ((\x3cbr\x3e\x3cFONT class=date2\x3e13:23\x3c/FONT\x3e \x3cFONT color=red\x3eВнимание!\x3c/FONT\x3e Артефакт обиделся на всех ((
      $a=strstr($_REQUEST['text'],'telegraf [');  $target=substr($a,10,strpos($a,']')-10);
      $res=db_use('array',"select id_person from users where login='".$target."'");
      if ($res['id_person']) {
      db_use('query',"INSERT INTO chat (id_person,timestamp,id_room,nick,text,color,type) VALUES ('".$myinfo->id_person."','".time()."',0,'".$res['id_person']."','".mysql_escape_string($myinfo->name).'[telegraf] '.mysql_escape_string(str_replace("\\","&#x5C;",htmlspecialchars($_REQUEST['text'])))."','".$myinfo->chatcolor."',7);");  #бяки
      }else{
        echo"<script>alert('Адресат не найден');</script>";
      }
    }
    $_GET['show']=1;
  }else{
    echo "<script>alert('На вас наложено заклятие молчания еще на ".($res['timestamp2']-time())." секунд.');</script>";
  }
}
if ($_GET['show']) {

  $res=db_use('array',"select max(id_am) as m from chat;");
  if ($_REQUEST['lid']<$res['m']-5000) {$_REQUEST['lid']=$res['m']-5000;}
  $slid=($res['m']>$_REQUEST['lid']?$res['m']:$_REQUEST['lid']);
  echo "<html><head><meta content=\"text/html; charset=windows-1251\" http-equiv=Content-type></head><body>
  <SCRIPT>
  top.rld(false); ";
  echo "top.slid(".$slid.");";
#if (top.frames['main1161352212'].transfersale) {top.frames['main1161352212'].reloadit()}

  echo"top.frames[\"chat\"].am('";
#id_room='".$myinfo->id_room."' OR
/*
  $res=db_use('query',"SELECT * FROM chat WHERE
  id_am>'".(0+clean_var($_GET['lid']))."' and id_am<='".$slid."' AND
  (id_room>0 or
  text like '%private [".$myinfo->name."]%' or (nick='".$myinfo->id_person."' and type=5))
  ".($_REQUEST['om']?"AND (type=1 or (type=2 and nick<>'') or type=5)":'')."
  ".(!$_REQUEST['sys']?"and type<>4":'')."
  order by timestamp desc;"); # 4-системные

*/
# и (комната или мои приваты или мои системки ) и приваты: (тип - приват или тип кто чо сделал из палов но ник непустой??) или тип=5

/*
(комната та же
или текст - приват мне
или ник - я комната та же и текст не приват
или ник - я и текст - приват комулибо
или ник - айди и тип 5 или 6)
или тип 2
*/
  $res=db_use('query',"(SELECT * FROM chat_last WHERE
  id_am>'".(0+clean_var($_GET['lid']))."' and id_am<='".$slid."' AND

  (
  id_room='".$myinfo->id_room."'
  or text like '%private [".$myinfo->name."]%'
  or (nick='".$myinfo->name."' and id_room='".$myinfo->id_room."' and text not like 'private [%')
  or (nick='".$myinfo->name."' and text like 'private [%')
  or (nick='".$myinfo->id_person."' and (type=5 or type=6))
  or (type=2 and nick='' and id_room=0)
   )
  ".($_REQUEST['om']?"AND (type=1 or (type=2) or type=5)":'')."
  ".(!$_REQUEST['sys']?"and type<>4":'')." and type<>7  ) union (select * from chat where type=7 and nick='".$myinfo->id_person."')
  order by timestamp desc limit 200;"); # 4-системные
$ss='';
  unset ($i);while ($i<mysql_num_rows($res)) {
      $i++;$s=mysql_fetch_array($res);
    #echo $s['type']."\n";
    if ($s['type']==1 OR $s['type']==0) {
      $text=$s['text'];
      $priv_bool=false;#$privs=array();
      $view=false;$private=false;
      for ($i1=0;$i1<strlen($text);$i1++) {
        if (substr($text,$i1,9)=='private [' && !$priv_bool) {
          $priv_bool=true;$n1=$i1;$private=true;#echo 'n1='.$n1;
        }elseif (substr($text,$i1,1)==']' && $priv_bool) {
          $n2=$i1;#echo 'n2='.$n2;
          $name1=substr($text,$n1+9,$n2-$n1-9);
          if ($name1==$myinfo->name) { $view=true; }
  if ($name1=='klan') {
    $kurklan=true;
    $r11=db_use('array',"select p.id_clan,p.align from users u left join person p on p.id_person=u.id_person
    where u.login='".mysql_escape_string($s['nick'])."' or p.id_person='".$s[id_person]."'");
    if ( ($r11['id_clan']==$myinfo->id_clan && $myinfo->id_clan>0) or
    ( ((int)$r11['align']==(int)$myinfo->align && ispal($myinfo->align) && $r11['id_clan']<2 ))
    )
     { $view=true;$klan=true; }
          }
          #array_push($privs,$name);
          $priv_bool=false;
        }
      }
      if (($view OR !$private OR $s['nick']==$myinfo->name )&& $s['type']<2) {
        $n++;
        if ($s['nick']=='<i>невидимка</i>' && $myinfo->align>=1.99 && $myinfo->align<=1.999) $d=' id'.$s[id_person]; else $d='';
        $ss="<font class=".($kurklan?'date2':'date').">".date('H:i:s',$s['timestamp'])."</font> [<SPAN>"
        .mysql_escape_string($s['nick'].$d).

        "</SPAN>] <font color=".mysql_escape_string($s['color']).">".mysql_escape_string(str_replace('private [klan]','<font color=Green  style="background-color:#99FFCC"><b>private [klan]</b></font>',$s['text']))."</font> <BR>".$ss;
        $kurklan=false;
      }


    }elseif($s['type']==2) {
      $ss=$s['text']."<br />".$ss;
    }elseif($s['type']==4) {
      $ss="<font class=sysdate>".date('H:i:s',$s['timestamp'])."</font> [<SPAN>".mysql_escape_string($s['nick'])."</SPAN>] ".mysql_escape_string($s['text'])."<br />".$ss;
    }elseif($s['type']==5) {
      $ss="<font class=date2>".date('H:i:s',$s['timestamp'])."</font> <font color=red>Внимание!</font> ".mysql_escape_string($s['text'])."<BR>".$ss;
      db_use('query',"delete from chat where id_am='".$s['id_am']."'");
    }elseif($s['type']==6) {
      $doreload=true;
    }elseif($s['type']==7) {
      #echo "anaana<br />";
      if ($s['id_room']==$myinfo->id_person) {
        db_use('query',"delete from chat where id_am='".$s['id_am']."'");
      $s['text']=str_replace('telegraf ['.$myinfo->name,'<font color=#45bbff style="background-color:#cbecff">telegraf ['.$myinfo->name,$s['text']);
      $s['text']=str_replace($myinfo->name.']',$myinfo->name.']</font>',$s['text']);
      $ss="<font class=sysdate>".date('H:i:s',$s['timestamp'])."</font> [<SPAN>ТЕЛЕГРАФ</SPAN>] ".mysql_escape_string($s['text'])."<br />".$ss;
      }
    }
  if ($n>80) {break;}
#   }
  }unset($i);
  echo $ss;
echo "'); ";
if ($doreload) {
echo "if (!top.frames['main".$myinfo->id_person."'].combat_loaded) {top.frames['main".$myinfo->id_person."'].location.reload()}";}

echo"</SCRIPT>";
#echo '<script>window.open(\'/forum.php\', \'forum\', \'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes\');</script';
die;
}elseif ($_GET['online']) {
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>
myalign=parseFloat('".$myinfo->align."');
document.onmousedown=Down;function Down()
{top.CtrlPress=window.event.ctrlKey}
function w(name,id,align,klan,level,slp,trv,city, att,afk) {
lev=7;
opener=\"\";
var s=\"\";
if (klan.length>0) {
md = new Date();
if (md.toGMTString().substring(5,15)=='1 Apr 2006'){
if ((klan==\"Mercenaries\")||(klan==\"Stalkers\")||(klan==\"AbbadonsBrotherhood\")||(klan==\"WheelWarriors\")||(klan==\"DarkClan\")||(klan==\"Censored\")||(klan==\"Brigada\")||(klan==\"BoRunes\")||(klan==\"WildHearts\")){ align=1;}
}
    klan='<A HREF=\"/encicl/klan/'+klan+'.html\" target=_blank><IMG SRC=\"../i/klan/'+klan+'.gif\" WIDTH=24 HEIGHT=15 BORDER=0 ALT=\"\"></A>';
}
if (lev>0) s+='<a href=\"javascript:'+opener+'top.AddToPrivate(\''+name+'\',true)\"><IMG SRC=\"../i/lock.gif\" WIDTH=20 HEIGHT=15 BORDER=0 ALT=\"Приват\"></a>';
s+='<IMG SRC=\"../i/align'+align+'.gif\" WIDTH=12 HEIGHT=15 BORDER=0 ALT=\"\">'+klan+
    '<a href=\"javascript:'+opener+'top.AddTo(\''+name+'\')\">'+name+'</a>['+level+']<a href=\"inf.php?'+id+'\" target=_blank>'+
    '<IMG SRC=\"../i/inf.gif\" WIDTH=12 HEIGHT=11 BORDER=0 ALT=\"Инф. о '+name+'\"></a>';
//    '<IMG SRC=\"../i/inf'+city+'.gif\" WIDTH=12 HEIGHT=11 BORDER=0 ALT=\"Инф. о '+name+'\"></a>';

  if (slp>0) { s+=' <IMG SRC=\"../i/sleep2.gif\" WIDTH=24 HEIGHT=15 BORDER=0 ALT=\"Наложено заклятие молчания\">'; }
  if (trv>0) { s+=' <IMG SRC=\"../i/travma2.gif\" WIDTH=24 HEIGHT=15 BORDER=0 ALT=\"Инвалидность\">'; }
  if ( (att!=\"0\" && att) || (myalign>=1 && myalign<2 && align>3 && align < 4) || (align>=1 && align<2 && myalign>3 && myalign < 4)) {
    s+=' <A style=\"cursor: hand\" onclick=\"top.cmloc(\'/main.php?attackc='+id+'&'+(Math.random())+'\')\"><IMG src=\"../i/misc/curse_attack'+att+'.gif\" width=13 height=13 alt=\"Напасть\"></A>';
  }
  document.write((afk>0?'afk':'')+s+'<BR>');
}
</SCRIPT></HEAD>
<body mardginwidth=0 leftmardgin=0 leftmargin=0 marginwidth=0 bgcolor=\"#faf2f2\" onscroll=\"top.myscroll()\" onload=\"document.body.scrollTop=top.OnlineOldPosition\">
<center><SCRIPT>document.write(\"<INPUT TYPE=button value=\\\"Обновить\\\" onclick=\\\"location='ch.php?online=\"+Math.random()+\"'\\\">"; /* <br>За последний час:<br> */

echo"</center>\")</SCRIPT>";
$res=db_use('array',"SELECT roomname FROM room WHERE id_room='".$myinfo->id_room."';");
$room=$res['roomname'];
$res=db_use('array',"SELECT count(*) as coun FROM sessions s left join users u on u.login=s.username left join person p on p.id_person=u.id_person where  p.id_room='".$myinfo->id_room."';");
#s.session_time<'".(time()+$session->session_expire_time-3600)."' and
#echo 'time='.time().' exptime='.$session->session_expire_time.' time+exp='.(time()+$session->session_expire_time);
#die;
# s.session_time<'".(time()+$session->session_expire_time+15*400)."' and
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$inroom=$res['coun'];
#(name,id,align,klan,level,slp,trv,city, att)

echo"<font style=\"COLOR:#8f0000;FONT-SIZE:10pt\"><B>".$room." (".$inroom.")</B></font><table border=0><tr><td nowrap><SCRIPT>";

$res=db_use('query',"SELECT DISTINCT p.afk,p.invis,p.travma_time,p.persname,u.login,p.id_person,p.align,p.id_clan,c.clanname,p.level,po.id_person as slp,0 as trv,id_cityborn,p.att,po2.id_person as invis2 FROM sessions s left join users u on u.login=s.username
left join person p on p.id_person=u.id_person
left join person_on po on po.id_person=p.id_person and po.type=1
left join person_on po2 on po2.id_person=p.id_person and po2.type=5
left join clans c on c.id_clan=p.id_clan where p.id_room='".$myinfo->id_room."';");
  unset ($i);while ($i<mysql_num_rows($res)) {
      $i++;$s=mysql_fetch_array($res);
    if ($s['type']!=4) {
      if ($s['invis']>0 OR $s['invis2']) {
        #echo "w('<i>невидимка</i>',0,'','','','".($s['slp']?1:0)."','".($s['travma_time']>time()?1:0)."','".$s['id_cityborn']."','".($s['att']?$s['att']:'')."',".$s['afk'].");";
      }else{
        echo "w('".mysql_escape_string(($s['persname']?$s['persname']:$s['login'])),"',".$s['id_person'].",'".$s['align']."','".$s['clanname']."','".$s['level']."','".($s['slp']?1:0)."','".($s['travma_time']>time()?1:0)."','".$s['id_cityborn']."','".($s['att']?$s['att']:'')."',".$s['afk'].");";
      }
    }
  }unset($i);
  if ($myinfo->id_room==15) {
      echo "w('Общий Враг',100020,'2','','18','1','1','1','1');";
  }
echo"
</SCRIPT></td></tr></table>
<SCRIPT>document.write('<INPUT TYPE=checkbox onclick=\"top.OnlineStop=!top.OnlineStop\" '+(top.OnlineStop?'':'checked')+'> Обновлять автомат.')</SCRIPT>
</body></html>";
die;

/*
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
<LINK href="../i/main.css" type=text/css rel=stylesheet>
<SCRIPT>
myalign=parseFloat('3');
document.onmousedown=Down;function Down()
{top.CtrlPress=window.event.ctrlKey}

var spisok = '';
var room_name = 'ss';

function wu(inv,name,id,align,klan,level,slp,trv,city,att,private,afk,afk_text,dnd,dnd_text,bat,ill,sms) {
lev=7;
opener="";
var s="";
filter = '';
var str_length = 22;

if (dnd_text) {
    dnd_text = write_br(dnd_text);
}

if (afk_text) {
    afk_text = write_br(afk_text);
}

function write_br(str) {

    var s = str.split(/ /);
    var c = 0;
    for (i=0;i<s.length;i++) {
  c = c+s[i].length+1;
  if (c>=str_length && i>0) {
      s[i-1] += '<br>';
  c=s[i].length;
  }
    }
    r = s.join(' ');
    return r.replace(/"/g,"");
}


if (bat>0) filter = 'style="filter:invert"';

if (klan.length>0) {klan='<A HREF="http://capitalcity.combats.ru/encicl/klan/'+klan+'.html" target=_blank><IMG SRC="../i/klan/'+klan+'.gif" WIDTH=24 HEIGHT=15 BORDER=0 ALT=""></A>';}
  s+=((ill!='' || inv)?'<SPAN style="background-Color: #dad2d2">':'');
if (private>0) s+='<a href="javascript:'+opener+'top.AddToPrivate(\''+name+'\',true)"><IMG SRC="../i/lock.gif" '+filter+' WIDTH=20 HEIGHT=15 BORDER=0 ALT="Приват"></a>';

s+='<IMG SRC="../i/align'+align+'.gif" WIDTH=12 HEIGHT=15 BORDER=0 ALT="">'+klan;
if (dnd>0) s+='<font style=\'font-size:11px;\' onmouseover="javascript:fastshow(\''+dnd_text+'\');" onmouseout=\'javascript:hideshow();\'><b>dnd</b></font> ';
if (afk>0 & !dnd) s+='<font style=\'font-size:11px;\' onmouseover="javascript:fastshow(\''+afk_text+'\');" onmouseout="javascript:hideshow();"><b>afk</b></font> ';
  s+='<a href="javascript:'+opener+'top.AddTo(\''+name+'\')">'+name+'</a>';
  if (sms!='') s+=' <span style=\'font-size:10px;\'>sms</span>';
if (inv>0) s+='(the invisible) ';
  s+=((ill!='')?' = <a href="javascript:'+opener+'top.AddTo(\''+ill+'\')">'+ill+'</a>':'');
  s+='['+level+']<a href="/inf.php?'+id+'" target=_blank>'+
  '<IMG SRC="../i/inf'+city+'.gif" WIDTH=12 HEIGHT=11 BORDER=0 ALT="Инф. о '+name+'"></a>'+
  ((ill!='' || inv)?'</SPAN>':'');
  if (slp>0) { s+=' <IMG SRC="../i/sleep2.gif" WIDTH=24 HEIGHT=15 BORDER=0 ALT="Наложено заклятие молчания">'; }
  if (trv>0) { s+=' <IMG SRC="../i/travma2.gif" WIDTH=24 HEIGHT=15 BORDER=0 ALT="Инвалидность">'; }
  if ( (att!="0" && att) || (myalign>=1 && myalign<2 && align>3 && align < 4) || (align>=1 && align<2 && myalign>3 && myalign < 4)) {
    s+=' <A style="cursor: hand" onclick="top.cmloc(\'/main.php?attackc='+name+'&'+(Math.random())+'\')"><IMG src="../i/misc/curse_attack'+att+'.gif" width=13 height=13></A>';
  }

  spisok += s+'<br>';
}

function write_spisok(write) {
    if (!write) return;
    room.innerHTML = room_name;
    users.innerHTML = spisok;
}

function fastshow (content) {
  var el = document.getElementById("mmoves");
  var o = window.event.srcElement;
  if (content!='' && el.style.visibility != "visible") {el.innerHTML = '<small>'+content+'</small>';}
  var x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft + 3;
  var y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop+5;
  el.style.left = x + "px";
  el.style.top  = y + "px";
  if (el.style.visibility != "visible") {
    el.style.visibility = "visible";
  }
}

function hideshow() {
    document.getElementById("mmoves").style.visibility = 'hidden';
}

</SCRIPT>
</HEAD>
<!--
onload="jdavascript:top.frames['online'].location = '/ch.php?online='+Math.random();document.body.scrollTop=top.OnlineOldPosition;"
-->
<BODY onscroll=top.myscroll() bgColor=#faf2f2 leftMargin=0  marginwidth="0" leftmardgin="0" mardginwidth="0">
<CENTER>
<!--top.frames['refreshed'].location = '/ch.php?show='+Math.random()+'&lid='+top.lid;-->
<INPUT TYPE=button value="Обновить" onclick="javascript:top.RefreshChat(1);top.NextRefreshChat();"></center>
<FONT style="FONT-SIZE: 10pt; COLOR: #8f0000"><B><div id="room"></div></B></FONT>
<TABLE border=0>
<TBODY>
<TR>
<TD noWrap>
<div id="mmoves" style="background-color:#FFFFCC; visibility:hidden; overflow:visible; position:absolute; border-color:#666666; border-style:solid; border-width: 1px; padding: 2px; white-space: nowrap;"></div>
<div id="users"></div>
</TD>
</TR>
</TBODY>
</TABLE>

<SCRIPT>document.write('<INPUT TYPE=checkbox onclick="top.frames[\'bottom\'].sw_na();" '+(top.OnlineStop?'':'checked')+'> Обновлять автомат.')</SCRIPT>

</BODY>
</HTML>

*/



}

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