<div class="tableHeading"><?php echo $lang_manage_fields; ?></div>

<?php if ( ! empty( $fields ) ):?>
	<form method="post" action="<?=$fields_form_url?>">
		<table id="field-entries" class="tableBorder" style="width:100%;" 
			   cellspacing='0'  cellpadding='0'  border='0'>
			<thead>
				<tr>
					<th class="tableHeadingAlt" style="width:3%;  text-align:left;">&nbsp;</th>
					<th class="tableHeadingAlt" style="width:15%; text-align:left;">
						<input type="checkbox" name="toggle_all_checkboxes" value=""/>&nbsp;&nbsp;
						<?=$lang_delete?>
					</th>
					<th class="tableHeadingAlt" style="width:15%; text-align:left;"><?=$lang_name?></th>
					<th class="tableHeadingAlt" style="width:72%; text-align:left;"><?=$lang_label?></th>
				</tr>
			</thead>
			
			<tbody>
	<?php foreach($fields as $field):?>
				<?php $class = $this->cycle('tableCellOne', 'tableCellTwo'); ?>
				<tr>
					<td class="<?=$class?>"><?=$field['count']?></td>
					<td class="<?=$class?>">
				<?php if ( $field['locked'] ) :?>
						<?=$lang_locked?>
				<?php else:?>				
					<input type="checkbox" name="toggle[]" 
						   id="delete_box_<?=$field['id']?>" value="<?=$field['id']?>"/>
				<?php endif;?>
					</td>
					<td class="<?=$class?>">
				<?php if ( $field['locked'] ) :?>
						<?=$field['name']?>
				<?php else:?>				
					<a href="<?=$field['edit_url']?>"><?=$field['name']?></a>
				<?php endif;?>						
					</td>
					<td class="<?=$class?>"><?=$field['label']?></td>
				</tr>
	<?php endforeach; ?>	
			</tbody>	
			<?php $class = $this->cycle('tableCellOne', 'tableCellTwo'); ?>
			<tfoot>
				<tr>
					<td class="<?=$class?>">&nbsp;</td>
					<td class="<?=$class?>">
						<input type="checkbox" name="toggle_all_checkboxes" value=""/>&nbsp;&nbsp;
						<strong><?=$lang_delete?></strong>
					</td>
					<td class="<?=$class?>">&nbsp;</td>
					<td class="<?=$class?>">
					</td>
				</tr>
				
				<?php if ( $paginate ): ?>
					<?php $class = $this->cycle('tableCellOne', 'tableCellTwo'); ?>
						<tr>
							<td class="<?=$class?>" colspan="4">	
								<?=$paginate?>
							</td>
						<tr>		
				<?php endif; ?>
				
			</tfoot>
		</table>

		<div class='clearfix' >&nbsp;</div>

		<div class="itemWrapper">
			<input type="submit" name="submit" value="<?=$lang_delete?>" />
		</div>
	</form>

<?php else: ?>	
	<div class="tableCellOne">
		<div class="highlight"><?=$lang_no_fields?></div>
	</div>
<?php endif; ?>

<script type="text/javascript">create_magic_checkboxes('field-entries');</script>
