<?php 	if( $this->logs['count'] < 1) : ?>
	<table id="subadminListMatches" class="aliases">
		<tbody>
			<tr class="subadminRow divide">
			<td>
<?php 		echo $this->translate('0 Messaages in the queue') ?>
			</td>
			</tr>
		</tbody>
	</table>
	
<?php endif ?>
<pre>
<?php
var_dump($this->logs['memlog']);
var_dump($this->logs['lines']);
?>
</pre>

<table id="subadminListMatches" class="aliases">
	<tbody>
		<tr class="header">
			<td><b><?php echo $this->translate('Age') ?></b></td>
			<td><b><?php echo $this->translate('Size') ?></b></td>
			<td><b><?php echo $this->translate('Id') ?></b></td>
			<td><b><?php echo $this->translate('From') ?></b></td>
			<td><b><?php echo $this->translate('Status') ?></b></td>
			<td><b><?php echo $this->translate('To') ?></b></td>
		</tr>
<?php foreach( $this->logs['lines'] as $row ) : ?>
	<?php $respString = ''; ?>
	<?php if(count($row['resp']) > 0 ) {
		foreach( $row['resp'] as $resp ) : ?>
		<?php $respString .= $resp . ' '; ?> 
	<?php endforeach;
	}
	?>
	<tr class="subadminRow divide" subadminid="<?php echo $row['header'][2] ?>">
			<td title='<?php echo $row['header'][2] ?> <?php echo $row['pcount'] ?>'><?php echo $row['header'][0] ?></td>
			<td><?php echo $row['header'][1] ?></td>
			<td><a href='#' class='exim_message_id' id='<?php echo $row['header'][2] ?>'><?php echo $row['header'][2] ?></a></td>
			<td><?php echo $row['header'][3] ?></td>	
			<td><?php echo $row['header'][4] ?> <?php echo $row['header'][5] ?> <?php echo $row['header'][6] ?></td>
			<td><div title='<?php echo $respString;?>' class='max16chars'>
			<?php echo $respString;?>
			</div></td>	
		</tr>
<?php endforeach ?>
       </tbody>
</table>

<script>
$(function() 
{
	$(".exim_message_id").bind('click', function(event){

		event.preventDefault();

		// var currentId = $(this).attr('id');
		// var currentId = event.target.id

		var params = {};
		params.currentId = event.target.id;

		// Launch the JSON to ask the api to delete the message
		$.getJSON('<?php echo $this->appBaseUrl ?>/admin/dashboard/deletemessage/', params, function(json) {

			alert('Finished!');

			if( json ) {
			}
		});

		
	});

	var logCount = '<?php echo $this->logs['count'] ?>';

	
	
	// Last, update how many rows we matched
	$('#primary_header H1').html("Exim queue - &gt; <span class='logCount'>" + logCount + "</span> results");
	
	$("SPAN.logCount").format({format:"#,###", locale:"us"});

	//resize parent to fit
	rows = $('#subadminListMatches').children('tbody').children('tr').length

	
	
	if( rows < 3 )
		rows = 3
		
	newHeightA = rows * 29
	newHeightB = $("body").innerHeight() - 230
	
	//if wants to be higher than available space then scroll
	if( newHeightA > newHeightB )
		newHeight = newHeightB
	else
		newHeight = newHeightA

	
	
	//set minimum height
	if( newHeight < 80 )
		newHeight = 100

	$('#subadminListMatches').parent().height( newHeight );

	// Scroll to the top for matches
	$("#log-table").scrollTo(0);
	
})
</script>