<?
session_start();
include "conf.php";
$data = mysql_connect($base_name, $base_user, $base_pass);
mysql_select_db($db_name,$data);
if (ereg("[<>\\/-]",$act) or ereg("[<>\\/-]",$h) or ereg("[<>\\/-]",$talker) or ereg("[<>\\/-]",$phrase) or ereg("[<>\\/-]",$razdel) or ereg("[<>\\/-]",$om)) {print "?!"; exit();}
$act=htmlspecialchars($act);
$h=htmlspecialchars($h);
$talker=htmlspecialchars($talker);
$color=htmlspecialchars($color);
$sys=htmlspecialchars($sys);
$om=htmlspecialchars($om);
$sound=htmlspecialchars($sound);
$phrase=htmlspecialchars($phrase);
$razdel=htmlspecialchars($razdel);
$sql = mysql_query("SELECT * FROM users WHERE login='$login'");
$db = mysql_fetch_array($sql);
$orden = $db["orden"];
$clan = $db["clan"];
?>
<HTML><HEAD>
<link rel="stylesheet" type="text/css" href="main.css">
<meta content="text/html; charset=windows-1251" http-equiv="Content-type">
<script language="javascript" type="text/javascript">
function subm()
{
        document.talker.h.value=document.talker.phrase.value;
	if (top.ChatTranslit)  translate();    
}

var b___translit_on = new Image; b___translit_on.src="img/b___translit_on.gif"; b___translit_on.alt="(включено) Преобразовывать транслит в русский текст";
var b___translit_off = new Image; b___translit_off.src="img/b___translit_off.gif"; b___translit_off.alt="(выключено) Преобразовывать транслит в русский текст";

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 rslength() // изменяет размер строки ввода текста
{
	var size = document.body.clientWidth-(4*30)-31-59-285-18-30;
	if (size<100) { size=100 }
	document.F1.phrase.width = size;
	document.all('T2').width = size;
}
window.onresize=rslength;

function translate() {	// translates latin to russian
	var strarr = new Array();
	strarr = document.F1.h.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.h.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;
   }
}
</script>
<script>
function rel(){
top.location.reload();
}
function url(url){
top.main.location.href = "main.php?act="+url;
}
function quit(){
if(confirm("Вы уверены что хотите выйти из игры?")){top.location.href='main.php?act=exit';}
}


</script>

</HEAD>
<body leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 bgcolor=#E6E6E6 onload="rslength();" onfocus="document.F1.phrase.focus()">

<script>

function s()
{
   var x = event.screenX - 120;
   var y = event.screenY - 360;
   var sFeatures = 'dialogLeft:'+x+'px;dialogTop:'+y+'px;dialogHeight:340px;dialogWidth:600px;help:no;status:no;unadorned:no';
   window.showModelessDialog("smiles.html", window, sFeatures);
}
function clean(){
	if(this.talker.phrase.value!=''){
     this.talker.phrase.value = '';
     this.talker.phrase.focus();
    }
    else{

		if(confirm('Вы уверены что хотите очистить окно чата?')){
		parent.msg.mes.innerHTML='';
		}
    }
}
function changeChatStat(){
 top.follow.location.href='follow.php?act=changeStat';
}
function talk(){
 this.talker.phrase.focus();
}
</script>

<form name="talker" action='null.php' target='null2' onsubmit="subm();" id="F1" method='post'>
  <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(img/beg_chat_03.gif); background-position: top; background-repeat:repeat-x; ">
      <td width="9"><img src="img/bkf_l_r1_02.gif" width="9" height="30"></td>
      <td width="30"><img src="img/b___.gif" width="30" height="30" alt="Чат" /></td>
      <td valign="middle" id="T2"><input type="normal" name="phrase" maxlength="240" size="80" onKeyDown="document.talker.h.value=document.talker.phrase.value;"  /></td>
      <td nowrap id="T3"><img src="img/b___ok.gif" width="30" height="30" alt="Добавить текст в чат" style="cursor: hand" onclick="document.F1.sbm.click()" /><img src="img/1x1.gif" width="8" height="1" alt="" /><img src="img/b___clear.gif" width="30" height="30" alt="Очистить строку ввода/Чат" style="cursor: hand" onclick="clean();" /><img src="img/b___filter_off.gif" alt="Не работает" name="b___filter" width="30" height="30" id="b___filter" onclick="" /><img src="img/b___sys_off.gif" alt="Не работает" name="b___sys" width="30" height="30" id="b___sys" onclick="" /><img src="img/b___slow_off.gif" alt="Не работает" name="b___slow" width="30" height="30" id="b___slow" onclick="" /><img src="img/b___translit_off.gif" alt="(выключено) Преобразовывать транслит в русский текст (правила перевода см. в энциклопедии)" name="b___translit" width="30" height="30" id="b___translit" style="cursor: hand" onclick="sw_translit();" /><img src="img/b___sound_off.gif" alt="Не работает" name="b___sound" width="30" height="30" id="b___sound" onclick="" /><img src="img/1x1.gif" width="7" height="1" alt="" />
      <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="img/Sound2.swf" />
          <param name="quality" value="high" />
          <param name="scale" value="noscale" />
          <param name="wmode" value="transparent" />
          <embed src="img/Sound2.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="img/b___smile.gif" width="30" height="30" alt="Смайлики" style="cursor:hand" onclick="s();" /></td>
      <td width="19" id="T4" background="img/b___bg2.gif"><img src="img/beg_chat_05.gif" width="19" height="30" alt="" /></td>
      <td align="right" nowrap="nowrap" bgcolor="BAB7B3" id="T5" background="img/b___bg2.gif"><img src="img/a___inv.gif" width="30" height="30" alt="Настройки/Инвентарь" style="cursor:hand" onClick=url("inv&razdel=obj"); /><?if($db["level"]>=4 or $db["orden"]==4){?><img src="img/a___trf.gif" width="30" height="30" alt="Передать предметы/кредиты" style="cursor:hand" onClick=url("perevod"); /><?}?><?if($db["orden"]==1 or $db["login"]=='Смотритель' or $db["login"]=='Мироздатель'){?><img src="img/a___pal.gif" width="30" height="30" alt="Власть" style="cursor:hand" onClick=url("orden"); /><?}?><?if($db["orden"]==2){?><img src="img/a___drk.gif" width="30" height="30" alt="Власть" style="cursor:hand" onClick=url("orden"); /><?}?><?if($db["clan"]!=""){?><img src="img/a___kln.gif" width="30" height="30" alt="Клан" style="cursor:hand" onClick=url("clan"); /><?}?><img src="img/a___ext.gif" width="30" height="30" alt="Выход из игры" style="cursor:hand" onClick="quit();" />&nbsp;</td>
      <td width="70" valign="middle" background="img/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="img/clock.swf?hours=<?echo Date(H);?>&minutes=<?echo Date(i);?>&sec=<?echo Date(s);?>" />
          <param name="quality" value="high" />
        </object>
      </td>
      <td width="9" valign="middle" background="img/b___bg2.gif" bgcolor="BAB7B3"><img src="img/bkf_l_r1_06.gif" width="9" height="30"></td>
    </tr>
  </table>
  <input type=hidden name=h>
  <input type="submit" name="sbm" style="display:none" />
</form>
</body>
</html>
