{#if $T.d.length == 0}
<div class="info">
    {#if window.location.href.indexOf('Spam.aspx') > 0}
    Hooray, no spam here!
    {#/if}
    {#if window.location.href.indexOf('Pending.aspx') > 0}
    There are no pending comments.
    {#/if}
    {#if window.location.href.indexOf('Approved.aspx') > 0}
    There are no approved comments.
    {#/if}
    {#if window.location.href.indexOf('Pingbacks.aspx') > 0}
    There are no pingbacks or trackback. Make sure you enabled sending and recieving trackbacks/pingbacks in <a href="../settings/Advanced.aspx">Advanced settings</a> section.
    {#/if}
</div>
{#else}
<table id="Comments" class="beTable rounded" style="width:100%">
    <thead>
        <tr>
	        <th width="20"><input type="checkbox" id="selectall" onclick="toggleAllChecks(this)" /></th>
            <th width="38">&nbsp;</th>
            <th width="auto">Comment</th>
	        <th width="120">Ip</th>
	        <th width="100">Created on</th>
            <th width="70">&nbsp;</th>
        </tr>
    </thead>
    <tbody>
        {#foreach $T.d as cmt}
        <tr id="{$T.cmt.Id}" class="{#cycle values=['','alt']}">
            <td><input type="checkbox" {#if $T.cmt.HasChildren} disabled {#/if} class="chk"/></td>
            <td>{$T.cmt.Avatar}</td>
            <td><span class="commenttitle">{$T.cmt.Title}</span>
                {$T.cmt.Teaser}</td>
            <td>{$T.cmt.Ip}</td>
            <td><span class="comment_date">{$T.cmt.Date}</span><span class="comment_time">{$T.cmt.Time}</span></td>
            <td>
                <ul class="rowTools">
                    <li>
                        <a class="toolsAction" href="#"><span class="">Tools</span></a>
                        <ul class="rowToolsMenu">
                            <li><a class="editAction" href="#" onclick="return EditComment('{$T.cmt.Id}');">Edit</a></li>
                            {#if window.location.href.indexOf('Spam.aspx') > 0 || window.location.href.indexOf('Pending.aspx') > 0}
                            <li><a class="approveAction" href="#" onclick="return CommentAction('Approve','{$T.cmt.Id}');">Approve</a></li>
                            {#/if}
                            {#if window.location.href.indexOf('Approved.aspx') > 0 && $T.cmt.HasChildren == false}
                            <li><a class="unapproveAction" href="#" onclick="return CommentAction('Reject','{$T.cmt.Id}');">Unapprove</a></li>
                            {#/if}
                            {#if $T.cmt.HasChildren == false}
                            <li><a href="#" class="deleteAction" onclick="return CommentAction('Delete','{$T.cmt.Id}');">Delete</a></li>
                            {#/if}
                       </ul>
                    </li>
               </ul>
            </td>
        </tr>
        {#/for}
    </tbody>
</table>
{#/if}

{#if $T.d.length > 0}
    {#if window.location.href.indexOf('Spam.aspx') > 0}
    <div class="action_buttons">
        <input type="submit" class="btn" value="Restore Selected" onclick="return ProcessSelected('Approve','Spam');" />&nbsp;
		<input type="submit" class="btn" value="Delete Selected" onclick="return ProcessSelected('Delete', 'Spam');" />&nbsp;
        <input type="submit" class="btn" value="Delete All" onclick="return DeleteAllSpam();" />&nbsp;
        <span class="loader">&nbsp;</span>
    </div>
    {#/if}
    {#if window.location.href.indexOf('Pending.aspx') > 0}
    <div class="action_buttons">
		<input type="submit" class="btn" value="Approve Selected" onclick="return ProcessSelected('Approve', 'Pending');" />&nbsp;
        <input type="submit" class="btn" value="Reject Selected" onclick="return ProcessSelected('Reject', 'Pending');" />&nbsp;
        <input type="submit" class="btn" value="Delete Selected" onclick="return ProcessSelected('Delete', 'Pending');" />&nbsp;
        <span class="loader">&nbsp;</span>
    </div>
    {#/if}
    {#if window.location.href.indexOf('Approved.aspx') > 0}
    <div class="action_buttons">
        <input type="submit" class="btn" value="Reject Selected" onclick="return ProcessSelected('Reject', 'Approved');" />&nbsp;
        <input type="submit" class="btn" value="Delete Selected" onclick="return ProcessSelected('Delete', 'Approved');" />&nbsp;
        <span class="loader">&nbsp;</span>
    </div>
    {#/if}
    {#if window.location.href.indexOf('Pingbacks.aspx') > 0}
    <div class="action_buttons">
		<input type="submit" class="btnAddNew btn" value="Delete Selected" onclick="return ProcessSelected('Delete', 'Pingback');" />&nbsp;
        <span class="loader">&nbsp;</span>
    </div>
    {#/if}
{#/if}

<script type="text/javascript">
    $('.loader').hide();
</script>
