<?php if ( ! empty( $templates ) ):?>
	<form method="post" action="<?=$form_url?>">
		<input type="hidden" name="XID" value="<?=$XID_SECURE_HASH?>" />
		<table id="field-entries" class="mainTable padTable magic_checkbox_table" style="width:100%;" 
			   cellspacing='0'  cellpadding='0'  border='0'>
			<thead>
				<tr>
					<th  style="width:3%;  text-align:left;">&nbsp;</th>
					<th  style="width:1%; text-align:left;">
						<input type="checkbox" name="toggle_all_checkboxes" value=""/>
					</th>
					<th  style="width:10%; text-align:left;">
						<?=$lang_delete?>
					</th>
					<th  style="width:35%; text-align:left;"><?=$lang_name?></th>
					<th  style="width:51%; text-align:left;"><?=$lang_label?></th>
				</tr>
			</thead>
			<tbody>
	<?php foreach($templates as $template):?>
				<?php $class = $this->cycle('odd', 'even'); ?>
				<tr class="<?=$class?>">
					<td><?=$template['count']?></td>
					
				<?php if ( $template['locked'] ) :?>
					<td>&nbsp;</td>
					<td><?=$lang_locked?></td>
				<?php else:?>
					<td>		
						<input type="checkbox" name="toggle[]" 
						   	   id="delete_box_<?=$template['id']?>" value="<?=$template['id']?>"/>
					</td>
					<td>&nbsp;</td>	
				<?php endif;?>
					
					<td>
				<?php if ( $template['locked'] ) :?>
						<?=$template['name']?>
				<?php else:?>				
					<a href="<?=$template['edit_url']?>"><?=$template['name']?></a>
				<?php endif;?>						
					</td>
					<td><?=$template['label']?></td>
				</tr>
	<?php endforeach; ?>			
			</tbody>	
			<?php $class = $this->cycle('odd', 'even'); ?>
			<tfoot>
				<tr class="<?=$class?>">
					<td>&nbsp;</td>
					<td>
						<input type="checkbox" name="toggle_all_checkboxes" value=""/>
					</td>
					<td>
						<strong><?=$lang_delete?></strong>
					</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
				
				<?php if ( $paginate ): ?>
					<?php $class = $this->cycle('odd', 'even'); ?>
						<tr class="<?=$class?>">
							<td  colspan="5">	
								<?=$paginate?>
							</td>
						<tr>		
				<?php endif; ?>
				
			</tfoot>
		</table>
		<p>
			<input type="submit" name="submit" class="submit" value="Delete" />
		</p>
	</form>		
<?php else: ?>	
	<p class="highlight"><?=$lang_no_templates?></div>
	</p>
<?php endif; ?>
