{include file="left.tpl"}

<script>
	var pm_interval;
	var check_mess;

	jQuery(document).ready(function($)
	{
		{load_dialogs}

		load_companions();
	});

	function open_dialog(id)
	{
		$.ajax({
			type: 'POST',
			url: '../ajax/pm_actions.php',
			data: 'phpaction=1&token='+$('#token').val()+'&open_dialog=1&id='+id,
			success: function(html)
			{
				$('#title_messages').html('Диалог');

				$('#place_for_messages').html(html);

				history.pushState('', '', 'messages?id='+id);

				$('#back_btn').fadeIn();

				var block = document.getElementById('messages');

				block.scrollTop = block.scrollHeight;

				setTimeout(function()
				{
					var block = document.getElementById('messages');

					block.scrollTop = block.scrollHeight;
				}, 500);
			}
		});
	}
</script>

<div id="messages_sound_player"></div>

<div class="content float-right">
	<a id="back_btn" class="button-big active float-right disp-n" href="#" onclick="load_dialogs(); $('#title_messages').html('Список сообщений'); return false"><i class="fa fa-times-circle-o"></i> Назад к списку</a>

	<div class="clear"></div>

	<div class="block">
		<div class="header" id="title_messages">Список сообщений</div>
		<div class="block-content">
			<div id="place_for_messages" class="dialogs_place"></div>
		</div>
	</div>

	<div class="block">
		<div class="header">Список собеседников</div>
		<div class="block-content">
			<div id="companions"></div>
			<div class="clear"></div>
		</div>
	</div>
</div>