<?
require_once ("include/bittorrent.php");
global $CURUSER, $tracker_lang, $pic_base_url, $chaton, $chatwith, $CURGROUP;
if ($chaton == "sp" || $_GET [archive]) {
	dbconn ( true );
	if ($_GET [archive])
		validcan ( false, 'can_viewarch', true );
	else
		validcan ( false, 'can_viewsb', true );
	stdhead ( $tracker_lang ["chat"] );
}
begin_frame ( $tracker_lang ["chat"] );
if ($CURGROUP ['can_viewsb']) {
	//if (stripos ( " " . $_SERVER ['HTTP_USER_AGENT'], "opera" ))
	//$noscroll = 1;
	print ( "<form action=\"shoutbox.php\" method=\"post\" name=\"shoutform\" onsubmit=\"return sendShout(this);\">" );
	?>
<table cellspacing="0" cellpadding="0" width="100%">
	<tr>
		<td style="border: none;">
		<div id="shoutbox" style="<? //($noscroll ? "" : "overflow: auto;")					?>overflow: auto; height: 100px;" width="100%">
		Загрузка... <img src="<?=$pic_base_url?>smilies/w00t.gif" border="0">
		</div>
		</td>
<?
	if (/*$chatwith == "all" || */$chatwith == "radio"/* || $chatwith == "online"*/) {
		?>
    <td style="white-space: nowrap; border: none;" valign="top"
			width="30%">
<?
	}
	?>
<?

	if (/*$chatwith == "all" || */$chatwith == "radio") {
		?>
    <script language="javascript" type="text/javascript"
			src="js/radio.js"></script>
		<style type="text/css">
.mju {
	width: 150px;
	text-align: center;
	color: #444;
	font: 10px Arial;
}

.mju a {
	color: #444;
	font: 10px Arial;
	text-decoration: underline;
}

.mju a:hover {
	text-decoration: none;
}
</style>
		<div class="mju"><object width="150" height="68" id="mju">
			<param name="allowScriptAccess" value="sameDomain" />
			<param name="swLiveConnect" value="true" />
			<param name="movie" value="mju.swf" />
			<param name="flashvars"
				value="playlist=playlist.mpl&auto_run=false&repeat_one=false&shuffle=false" />
			<param name="loop" value="false" />
			<param name="menu" value="false" />
			<param name="quality" value="high" />
			<param name="wmode" value="transparent" />
			<embed src="radio/mju.swf"
				flashvars="playlist=radio/playlist.mpl&auto_run=false&repeat_one=false&shuffle=false"
				loop="false" menu="false" quality="high" wmode="transparent"
				bgcolor="#ffffff" width="150" height="68" name="mju"
				allowScriptAccess="sameDomain" swLiveConnect="true"
				type="application/x-shockwave-flash"
				pluginspage="http://www.macromedia.com/go/getflashplayer" /></object><br />
		<SELECT>
			<OPTION>.:: Выбери станцию</OPTION>
			<OPTION onclick="mju_play_track(1);return false;">.:: ULTRA</OPTION>
			<OPTION onclick="mju_play_track(2);return false;">.:: MAXIMUM</OPTION>
			<OPTION onclick="mju_play_track(3);return false;">.:: Наше радио</OPTION>
			<OPTION onclick="mju_play_track(4);return false;">.:: Серебрянный
			дождь</OPTION>
			<OPTION onclick="mju_play_track(5);return false;">.:: Динамит FM</OPTION>
			<OPTION onclick="mju_play_track(6);return false;">.:: Русское Радио</OPTION>
			<OPTION onclick="mju_play_track(7);return false;">.:: Евпора+</OPTION>
			<OPTION onclick="mju_play_track(8);return false;">.:: Радио Шансон</OPTION>
			<OPTION onclick="mju_play_track(9);return false;">.:: Эхо Москвы</OPTION>
			<OPTION onclick="mju_play_track(10);return false;">.:: Ретро FM</OPTION>
			<OPTION onclick="mju_play_track(11);return false;">.:: Радио Джаз</OPTION>
			<OPTION onclick="mju_play_track(12);return false;">.:: Радио Попса</OPTION>
			<OPTION onclick="mju_play_track(13);return false;">.:: Мегаполис FM</OPTION>
			<OPTION onclick="mju_play_track(14);return false;">.:: Радио РОКС</OPTION>
			<OPTION onclick="mju_play_track(15);return false;">.:: Радио Classic</OPTION>
		</SELECT></div>
<?
	}
	?>
<?

	//if ($chatwith == "all" || $chatwith == "online") {
	?><!--
  <br />
		<font color="darkgreen"><b>On-Line</b></font>
		<hr width="100%">
		<div id="wol" style="overflow: auto; height: auto; width: 100%;"><font
			size="-2"> Загрузка... </font></div>
		<br />
		</td>
		-->
<?
	//}
	?>

	
	
	
	
	
	
	
	
	
	</tr>
</table>
<?
	if ($CURGROUP ['can_shout']) {
		?>
<table cellspacing="0" cellpadding="5" width="100%">
	<tr>
		<td width="100%" style="border: none;">
    <?
		textbbcode ( "shoutform", "shout", "", "1" );
		?>
</td>
		<td style="white-space: nowrap; border: none;" width="50%"
			valign="top"><input type="submit" value="<?=$tracker_lang ["send"]?>"
			style="width: 76;" /> <input type="button"
			value="<?=$tracker_lang ["clear"]?>" style="width: 76;"
			onclick="sb_Clear()" />
<?
		if ($CURGROUP ['can_dellshout']) {
			?>
    <br />
		<input type="submit"
			value="<?=$tracker_lang ["clear"]?> <?=$tracker_lang ["all_sb"]?>"
			style="width: 76;" onClick="InsertSmilie('/prune')" />
<?
		}
		?>
</td>
	</tr>

	<tr>
		<td style="border: none;">
		<div align="center" id="smile" style="display: block; width: 100%"><img
			src='<?=$pic_base_url?>smilies/laugh.gif' onClick=InsertSmilie(':lol:')>
		<img src='<?=$pic_base_url?>smilies/w00t.gif' onClick=InsertSmilie(':w00t:')>
		<img src='<?=$pic_base_url?>smilies/tongue.gif' onClick=InsertSmilie(':-P')>
		<img src='<?=$pic_base_url?>smilies/wink.gif' onClick=InsertSmilie(';-)')>
		<img src='<?=$pic_base_url?>smilies/blush.gif' onClick=InsertSmilie(':blush:')>
		<img src='<?=$pic_base_url?>smilies/cry.gif' onClick=InsertSmilie(":'-(")>
		<img src='<?=$pic_base_url?>smilies/ohmy.gif' onClick=InsertSmilie(':-O')>
		<img src='<?=$pic_base_url?>smilies/shifty.gif' onClick=InsertSmilie(':shifty:')>
		<img src='<?=$pic_base_url?>smilies/grin.gif' onClick=InsertSmilie(':-D')>
		<img src='<?=$pic_base_url?>smilies/yawn.gif' onClick=InsertSmilie(':yawn:')>
		<img src='<?=$pic_base_url?>smilies/rolleyes.gif'
			onClick=InsertSmilie(':rolleyes:')> <img
			src='<?=$pic_base_url?>smilies/sick.gif' onClick=InsertSmilie(':sick:')>
		<img src='<?=$pic_base_url?>smilies/wavecry.gif' onClick=InsertSmilie(':wavecry:')>
		<img src='<?=$pic_base_url?>smilies/wall.gif' onClick=InsertSmilie(':wall:')>
		<img src='<?=$pic_base_url?>smilies/music.gif' onClick=InsertSmilie(':music:')>
		<img src='<?=$pic_base_url?>smilies/unsure.gif' onClick=InsertSmilie(':unsure:')>
		<img src='<?=$pic_base_url?>smilies/evilmad.gif' onClick=InsertSmilie(':evilmad:')>
		</div>
		</td>
		<td style="white-space: nowrap; border: none;" width="50%">
<?
		if ($CURGROUP ['can_viewarch']) {
			?>
    <input type="button" value="<?=$tracker_lang ["archive"]?>"
			style="width: 76;" onclick="javascript:winopar()" />
<?
		}
		?>
    <input type="button" value="<?=$tracker_lang ["smiles"]?>"
			style="width: 76;" onclick="javascript:winop()" /></td>

	</tr>
<?
		print ( "</table>" );
		print ( "</form>" );
	}
} else
	print ( 'Вам неразрешено просматривать чат!' );
end_frame ();
if ($chaton == "sp" || $_GET [archive])
	stdfoot ();
$script_name = $_SERVER ["SCRIPT_FILENAME"];
if (preg_match ( "/chats/i", $script_name )) {
	$wherethisuser = "Общается в <b><a href='/chats.php'><font color='red'>чате</font></a></b>";
}
$wheruser = sqlesc ( $wherethisuser );
$uuserid = sqlesc ( $CURUSER ['id'] );

?>
<script language="javascript" type="text/javascript" src="js/ajax.js"></script>
	<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function InsertSmilie(texttoins) {
    document.shoutform.shout.value = document.shoutform.shout.value+' '+texttoins+' ';
    document.shoutform.shout.focus();
    return false;
}
function winop()
{
windop = window.open("moresmiles.php?form=shoutform&text=shout","mywin","height=500,width=450,resizable=no,scrollbars=yes");
}

function winoptag()
{
windop = window.open("tags.php?form=shbox&text=shbox_text","mywin","height=500,width=450,resizable=no,scrollbars=yes");
}

function winopar()
{
windop = window.open("chats.php?archive=1");
}

function sendShout(formObj) {

    /*if (postingShout) {
        alert('Отправка сообщения...')
        return false
    }*/

    Shout = formObj.shout.value

    if (Shout.replace(/ /g, '') == '') {
        alert('Вы должны вести сообщение!')
        return false
    }

    sb_Clear();

    var ajax = new engine_ajax();
    ajax.onShow ('');
    //ajax.onShow = function() { };
    var varsString = "";
    ajax.requestFile = "shoutbox.php";
    ajax.setVar("do", "shout");
    ajax.setVar("shout", escape(Shout));
    ajax.method = 'GET';
    ajax.element = 'shoutbox';
    ajax.sendAJAX(varsString);

    return false
}

function getShouts() {

    var ajax = new engine_ajax();
    ajax.onShow = function() { };
    var varsString = "";
    ajax.requestFile = "shoutbox.php";
    ajax.method = 'GET';
    ajax.element = 'shoutbox';
    <?
				if ($_GET [archive]) {
					?>
    ajax.setVar("archive", "1");    
    <?
				}
				?>
    ajax.sendAJAX(varsString);

    setTimeout('getShouts()', 100000);

    return false

}

function sb_Clear() {
    document.forms["shoutform"].shout.value = ''
    return true;
}

function deleteShout(id) {
{
        var ajax = new engine_ajax();
        ajax.onShow = function() { };
        var varsString = "";
        ajax.requestFile = "shoutbox.php";
        ajax.setVar("do", "delete");
        ajax.setVar("id", id);
        ajax.method = 'GET';
        ajax.element = 'shoutbox';
        ajax.sendAJAX(varsString);
    }

    return false

}
function editShout(id) {
        var ajax = new engine_ajax();
        ajax.onShow = function() { };
        var varsString = "";
        ajax.requestFile = "shoutbox.php";
        ajax.setVar("id", id);
        ajax.setVar("do", "edit");
        ajax.method = 'GET';
        ajax.element = 'shoutbox';
        ajax.sendAJAX(varsString);
}
function executeEdit(id, text) {
        var ajax = new engine_ajax();
        ajax.onShow = function() { };
        var varsString = "";
        ajax.requestFile = "shoutbox.php";
        ajax.setVar("do", 'edit');
        ajax.setVar("id", id);
        ajax.setVar("text", text);
        ajax.method = 'GET';
        ajax.element = 'shoutbox';
        ajax.sendAJAX(varsString);
        getShouts();
        return false;
}
getShouts();
<?
//if ($chatwith == "all" || $chatwith == "online") {
?>

//function getWOL() {
//
//    var ajax = new engine_ajax();
//    ajax.onShow = function() { };
//    var varsString = "";
//    ajax.requestFile = "online.php";
//    ajax.method = 'GET';
//    ajax.setVar("wol", 1);
//    ajax.element = 'wol';
//    ajax.sendAJAX(varsString);
//
//    setTimeout('getWOL()', 1000);
//
//    return false
//
//}
//getWOL();
<?
//}
?>
-->
    </SCRIPT>


	<div id="loading-layer"
		style="display: none; font-family: Lucida Sans Unicode; font-size: 11px; width: 200px; height: 100px; background: #EDFCEF; padding: 10px; text-align: center; border: 1px solid #000">
	<div style="font-weight: bold" id="loading-layer-text"><font
		color="red"> Загрузка. Пожалуйста, подождите...</font></div>
	<br />
	<img src="<?=$pic_base_url?>smilies/w00t.gif" border="0"><img
		src="<?=$pic_base_url?>loading.gif" border="0" /></div>