<div class="col-md-12">
	{if('{page}' == '1')}
	<table class="block answer" id="answer_0">
		<tr>
			<td class="col-xs-2">
				<div class="line">
					<a href="../profile?id={author_id}" class="fs-17">
						{author_login}
					</a>
				</div>
			</td>
			<td class="col-xs-10">
				<div class="line">
					<font class="f-l">{date}</font>
					{if(is_worthy("e"))}
						<a href="#" class="f-r c-p"><span class="glyphicon glyphicon-trash" data-placement="left" tooltip="yes" data-original-title="Удалить" onclick="dell_topic('{id}' , '{id2}');"></span></a>
					{/if}
					{if((is_worthy("e")) or (is_auth() && '{author_id}' == '{my_id}'))}
						<a href="edit_topic?id={id}" class="f-r c-p"><span class="glyphicon glyphicon-pencil" data-placement="left" tooltip="yes" data-original-title="Редактировать"></span></a>
					{/if}
				</div>
			</td>
		</tr>
		<tr>
			<td class="col-xs-2">
				<div class="user mb-10">
					<img src="../{author_avatar}" alt="{author_login}"><br>
					<p class="hidden-xs" style="color: {group_color}">{group_name}</p>
					<p class="hidden-xs">Рейтинг: {reit}</p>
					<p class="hidden-xs">Сообщений: {answers}</p>
					<p class="hidden-xs">Спасибок: {thanks}</p>
				</div>
			</td>
			<td class="col-xs-10">
				<div id="text_0" class="with_code">
					{text}
				</div>
				<div class="clearfix"></div>
				{if('{edited_by_id}' != '')}<div class="edited">Отредактировал: <a href="../profile?id={edited_by_id}" title="{edited_by_login}">{edited_by_login}</a>, {edited_time}</div>{/if}
				{if('{signature}' != '')} <hr class="delimiter"> {signature} <div class="clearfix"></div>{/if}
			</td>
		</tr>
		<tr>
			{if(is_auth() && '{author_id}' != '{my_id}')}
			<td class="col-xs-2">
				<div class="btn-group disp-b" role="group">
					<a class="btn btn-default btn-sm c-p pd-5" onclick="answer(0,'{author_login}','{link}');" type="button">
						<i class="hidden-xs">Ответ</i>
						<span class="visible-xs glyphicon glyphicon-share-alt"></span>
					</a>
					<a class="btn btn-default btn-sm c-p pd-5" onclick="thank({id},1);" type="button">
						<i class="hidden-xs">Спасибо</i>
						<span class="visible-xs glyphicon glyphicon-thumbs-up"></span>
					</a>
				</div>
			</td>
			<td class="col-xs-10">
				{thanks_str}
			</td>
			{else}
			<td class="col-xs-12" colspan="2">
				{thanks_str}
			</td>
			{/if}
		</tr>
	</table>
	{/if}

	<div id="answers">
		{func Forum:get_answers("{id}", "{start}", "{limit}", "{script}", "{link}")}
	</div>
	<div id="pagination2"><center>{pagination}</center></div>

	{if(is_auth())}
	<div class="block mt-10 mb-0">
		{if('{status}' == '1' or '{status}' == '3')}
			<div class="block_head">
				Оставить ответ:
			</div>
			<div id="send_answer">
				<textarea id="text" class="form-control maxMinW100" maxlength="2000"></textarea>
				<div class="smile_input_forum">
					<input id="send_btn" class="btn2 mt-10" type="button" onclick="send_answer('{id}');" value="Отправить">
					<div id="smile_btn" class="smile_btn visible-lg-inline-block" data-container="body" data-toggle="popover" data-placement="top" data-content="empty"></div>
				</div>
			</div>
		{else}
			<div class="disabled_input form-control">Тема закрыта <span class="glyphicon glyphicon-ban-circle"></span></div>
		{/if}
	</div>
	{/if}
</div>

<script>
	$(document).ready(function() {
		init_tinymce("text", "forum", "{file_manager_theme}", "{file_manager}", "{{md5($conf->code)}}");
		get_smiles('#smile_btn', 1);
	});

	$('#smile_btn').popover({ html: true, animation: true, trigger: "click" });
	$('#smile_btn').on('show.bs.popover', function () {
		$(document).mouseup(function (e) {
			var container = $(".popover-content");
			if (container.has(e.target).length === 0){
				$('#smile_btn').popover('hide'); selected = 'gcms_smiles';
			}
		});
	});

	function set_smile(elem){
		var smile =  "<img src=\""+$(elem).attr("src")+"\" class=\"g_smile\" height=\"20px\" width=\"20px\">";
		tinymce.activeEditor.insertContent(smile);
		$('#smile_btn').popover('hide'); selected = 'gcms_smiles';
	}

	$(document).ready(function() {
		h1 = $('#answer_0 tr:nth-child(2) > .col-xs-2').height();
		h2 = $('#answer_0 tr:nth-child(2) > .col-xs-10').height();

		if(h2 > h1) {
			$('#answer_0 tr:nth-child(2) > .col-xs-2').height(h2+20);
		}
	});
</script>