<script type="text/javascript">
ajax.in_edit_mode = false;

$(document).ready(function(){
	$('#show-edit-btn a').click(function(){
		show_edit_options();
		$('#show-edit-btn').html( $('#edit-sel-topics').html() );
		return false;
	});

	$('td.topic_id').click(function(){
		if (!ajax.in_edit_mode) {
			$('#show-edit-btn a').click();
			$(this).find('input').click();
		}
	});
});

function show_edit_options ()
{
	$('td.topic_id').each(function(){
		var topic_id = $(this).attr('id');
		var input = '<input id="sel-'+ topic_id +'" type="checkbox" value="'+ topic_id +'" class="topic-chbox" />';
		$(this).html(input);
	});

	$('input.topic-chbox').click(function(){
		if ($.browser.mozilla) {
			$('#tr-'+this.value+' td').toggleClass('hl-selected-row');
		}	else {
			$('#tr-'+this.value).toggleClass('hl-selected-row');
		}
	});
	$('#pagination a.pg').each(function(){ this.href += '&mod=1'; });
	$('#ed-list-desc').hide();
	$('#mod-action-cell').append( $('#mod-action-content')[0] );
	$('#mod-action-row, #mod-action-content').show();

	$('#mod-action').submit(function(){
		var $form = $(this);
		$('input[name~=topic_id_list]', $form).remove();
		$('input.topic-chbox:checked').each(function(){
			$form.append('<input type="hidden" name="topic_id_list[]" value="'+ this.value +'" />');
			$('#tr-'+this.value).remove();
		});
	});
	ajax.in_edit_mode = true;
}
</script>

<style type="text/css">
td.topic_id { cursor: pointer; }
</style>

<div class="col-md-12">

<div id="mod-action-content" style="display: none;">
<form id="mod-action" name="watch_form" method="post" action="{S_FORM_ACTION}">
	<table class="borderless pad_0" cellpadding="0" cellspacing="0">
	<tr><td class="pull-left">
		<input type="submit" class="btn btn-default btn-flat" name="del_from_ut" value="{L_DEL_LIST_MY_MESSAGE}" onclick="if (!window.confirm( this.value +'?' )){ return false };" />
	</tr></table>
</form>
</div>

<table id="post-row" style="display: none;">
<tr>
	<td class="row2" colspan="7">
		<div class="post_watch_wrap row1">
			<div class="post_body pad_6"></div>
			<div class="clear"></div>
		</div>
	</td>
</tr>
</table>

<div class="box box-primary">
<div class="box-header">
	<h3 class="box-title">
		<span id="show-edit-btn"><a href="#">{L_EDIT_MY_MESSAGE_LIST}</a></span>
		<span id="edit-sel-topics" style="display: none;"><a href="#" class="text-red" onclick="$('input.topic-chbox').trigger('click'); return false;">{L_SELECT_INVERT}</a></span><em>&middot;</em>
		<a href="#" class="med normal" onclick="setCookie('{COOKIE_MARK}', 'all_forums');">{L_MARK_ALL_FORUMS_READ}</a>
	</h3>
	<div class="box-tools">
		<ul class="pagination pagination-sm no-margin pull-right">
			{PAGINATION}
		</ul>
	</div>
</div>
<div class="box-body no-padding">
<table class="table table-hover">
<thead>
<tr>
	<th></th>
	<th width="25%">{L_FORUM}</th>
	<th width="55%">{L_TOPIC}</th>
	<th width="5%">{L_AUTHOR}</th>
	<th width="5%">{L_REPLIES}</th>
	<th width="10%">{L_LASTPOST}</th>
</tr>
</thead>
<!-- BEGIN watch -->
<tr id="tr-{watch.TOPIC_ID}">
	<td id="{watch.TOPIC_ID}" class="topic_id">
		<span style="display: none;">{watch.TOPIC_ICON}</span>
		<i class="{watch.TOPIC_ICON}"></i>
	</td>
	<td><a href="{watch.U_FORUM}">{watch.FORUM_TITLE}</a></td>
	<td class="text-left">
		<a class="topictitle" title="{watch.FULL_TOPIC_TITLE}" href="{watch.U_TOPIC}">{watch.TOPIC_TITLE}</a>
		<!-- IF watch.PAGINATION --><br /><span class="topicPG">&nbsp;[{ICON_GOTOPOST}{L_GOTO_SHORT} {watch.PAGINATION} ]</span><!-- ENDIF -->
	</td>
	<td>{watch.AUTHOR}</td>
	<td class="text-center small">{watch.REPLIES}</td>
	<td class="small">
		{watch.LAST_POST}<!-- IF watch.IS_UNREAD --><a href="{TOPIC_URL}{watch.TOPIC_ID}{NEWEST_URL}">{ICON_NEWEST_REPLY}</a><!-- ELSE -->
		<a href="{POST_URL}{watch.LAST_POST_ID}#{watch.LAST_POST_ID}">{ICON_LATEST_REPLY}</a><!-- ENDIF -->
	</td>
</tr>
<!-- END watch -->
</table>
</div>
<div class="box-footer" id="mod-action-row">
<div id="mod-action-cell">
	<span id="ed-list-desc" class="small">{L_DEL_LIST_INFO}<span class="pull-right">{MATCHES}</span></span>
</div>
</div>
</div>

</div>