<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
  <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
  <?php } ?>
  </div>
<?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
<?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/package_tracking/lorry_link.png" alt="" /> <?php echo $heading_title; ?></h1>
			<div class="buttons">
				<a href="<?php echo $back; ?>" class="button"><span><?php echo $button_back; ?></span></a>
			</div>
    </div>
    <div class="content">
      <div class="htabs" id="tabs" >
        <a href="#tab-general"><?php echo $tab_general; ?></a>
        <a href="#tab-settings"><?php echo $tab_settings; ?></a>
        <a href="#tab-about"><?php echo $tab_about; ?></a>
      </div>
      <div id="tab-general">
          <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-general">
          <div style="text-align:right; margin: -10px 5px 5px 5px;">
            <a onclick="location='<?php echo $insert; ?>'" class="button"><span><?php echo $button_insert; ?></span></a>
            <a onclick="if (confirm('<?php echo $text_delete_confirm; ?>')) {$('#form-general').attr('action', '<?php echo $delete; ?>');$('#form-general').submit();}" class="button"><span><?php echo $button_delete; ?></span></a>
          </div>
          <table class="list">
            <thead>
              <tr>
                <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
                <td class="center"><?php echo $column_tracker_image; ?></td>
                <td class="left"><?php if ($sort == 'tracker_carrier_name') { ?>
                  <a href="<?php echo $sort_tracker_carrier_name; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_tracker_carrier_name; ?></a>
                  <?php } else { ?>
                  <a href="<?php echo $sort_tracker_carrier_name; ?>"><?php echo $column_tracker_carrier_name; ?></a>
                  <?php } ?></td>
                <td class="left"><?php if ($sort == 'tracker_carrier_link') { ?>
                  <a href="<?php echo $sort_tracker_carrier_link; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_tracker_carrier_link; ?></a>
                  <?php } else { ?>
                  <a href="<?php echo $sort_tracker_carrier_link; ?>"><?php echo $column_tracker_carrier_link; ?></a>
                  <?php } ?></td>
                <td class="left"><?php echo $column_tracker_status; ?></td>
                <td class="right" width="60"><?php echo $column_action; ?></td>
              </tr>
            </thead>
            <tbody>
              <?php if ($trackers) { ?>
              <?php foreach ($trackers as $tracker) { ?>
              <tr>
                <td style="text-align: center;"><?php if ($tracker['selected']) { ?>
                  <input type="checkbox" name="selected[]" value="<?php echo $tracker['tracker_id']; ?>" checked="checked" />
                  <?php } else { ?>
                  <input type="checkbox" name="selected[]" value="<?php echo $tracker['tracker_id']; ?>" />
                  <?php } ?></td>
                <td class="center"><img src="<?php echo $tracker['tracker_image']; ?>" alt="<?php echo $tracker['tracker_carrier_name']; ?>" style="padding: 1px; border: 1px solid #DDDDDD;" /></td>
                <td class="left"><?php echo $tracker['tracker_carrier_name']; ?></td>
                <td class="left"><?php echo $tracker['tracker_carrier_link']; ?></td>
                <td class="left"><?php echo $tracker['tracker_status']; ?></td>
                <td class="right"><?php foreach ($tracker['action'] as $track_action) { ?>
                  [ <a href="<?php echo $track_action['href']; ?>"><?php echo $track_action['text']; ?></a> ]
                  <?php } ?></td>
              </tr>
              <?php } ?>
              <?php } else { ?>
              <tr>
                <td class="center" colspan="5"><?php echo $text_no_results; ?></td>
              </tr>
              <?php } ?>
            </tbody>
          </table>
          <div class="pagination"><?php echo $pagination; ?></div>
          </form>
        </div>
      <div id="tab-settings">
          <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-settings">
          <div style="text-align:right; margin: -10px 5px 5px 5px;">
            <a onclick="$('#form-settings').attr('action', '<?php echo $save; ?>'); $('#form-settings').submit();" class="button"><span><?php echo $button_save; ?></span></a>
          </div>
          <table class="form">
            </tbody>
            <tr>
              <td style="min-width:400px;"><?php echo $entry_show_images; ?></td>
              <td><input type="checkbox" name="pts_show_images" value="1" <?php echo ($pts_show_images) ? 'checked="checked"': ''; ?>/></td>
            </tr>
            <tr>
              <td><?php echo $entry_last_tracking; ?></td>
              <td><input type="checkbox" name="pts_last_tracking" value="1" <?php echo ($pts_last_tracking) ? 'checked="checked"': ''; ?>/></td>
            </tr>
            <tr>
              <td><?php echo $entry_history_on_invoice; ?></td>
              <td><input type="checkbox" name="pts_history_on_invoice" value="1" <?php echo ($pts_history_on_invoice) ? 'checked="checked"': ''; ?>/></td>
            </tr>
            <tr>
              <td><?php echo $entry_only_notified_on_invoice; ?></td>
              <td><input type="checkbox" name="pts_only_notified_on_invoice" value="1" <?php echo ($pts_only_notified_on_invoice) ? 'checked="checked"': ''; ?>/></td>
            </tr>
            <tr>
              <td><?php echo $entry_remove_sql_changes; ?></td>
              <td><input type="checkbox" name="pts_remove_sql_changes" value="1" <?php echo ($pts_remove_sql_changes) ? 'checked="checked"': ''; ?>/></td>
            </tr>
            </tbody>
          </table>
          </form>
        </div>
      <div id="tab-about">
          <table class="form">
          <tr>
            <td style="min-width:100px;"><?php echo $entry_extension_name; ?></td>
            <td style="min-width:500px;"><?php echo $extension_name; ?></td>
            <td rowspan="8" style="width:350px;border-bottom:0px;"><img src="view/image/package_tracking/package_tracking_service_oc_300.png" style="float:center;" /></td>
          </tr>
          <tr>
            <td><?php echo $entry_extension_desc; ?></td>
            <td><?php echo $extension_desc; ?></td>
          </tr>
          <tr>
            <td><?php echo $entry_extension_version; ?></td>
            <td><b><?php echo $extension_version; ?></b> [ <?php echo $extension_type; ?> ]</td>
          </tr>
          <tr>
            <td><?php echo $entry_extension_compatibility; ?></td>
            <td><?php echo $extension_compatibility; ?></td>
          </tr>
          <tr>
            <td><?php echo $entry_extension_url; ?></td>
            <td><a href="<?php echo $extension_url; ?>" target="_blank"><?php echo htmlspecialchars($extension_url); ?></a></td>
          </tr>
          <tr>
            <td><?php echo $entry_extension_support; ?></td>
            <td>
              <a href="<?php echo $extension_forum; ?>"><?php echo $entry_extension_forum; ?></a>&nbsp;&nbsp;|&nbsp;&nbsp;
              <a href="mailto:<?php echo $extension_support; ?>?subject='<?php echo $extension_subject; ?>'"><?php echo $extension_support; ?></a>
              <a href="view/static/package_tracking_help.htm" id="help_notice" style="float:right;"><?php echo $entry_extension_help_asking; ?></a>
            </td>
          </tr>
          <tr>
            <td><?php echo $entry_extension_legal; ?></td>
            <td><?php echo $extension_copyright; ?><a href="view/static/package_tracking_terms.htm" id="legal_notice" style="float:right;"><?php echo $entry_extension_terms; ?></a></td>
          </tr>
          <tr>
            <td style="border-bottom:0px;"></td>
            <td style="border-bottom:0px;"></td>
          </tr>
        </table>
        </div>
    </div><!-- content -->
  </div><!-- box -->
</div>
<div id="help_text" style="display:none"></div>
<div id="legal_text" style="display:none"></div>
<script type="text/javascript"><!--
$('#tabs a').tabs();
$("#help_notice").click(function(e) {
    e.preventDefault();
    $("#help_text").load(this.href, function() {
        $(this).dialog({
            title: '<?php echo $entry_extension_help_request; ?>',
            width:  800,
            height:  600,
            minWidth:  500,
            minHeight:  400,
            modal: true,
        });
    });
    return false;
});
$("#legal_notice").click(function(e) {
    e.preventDefault();
    $("#legal_text").load(this.href, function() {
        $(this).dialog({
            title: '<?php echo $entry_extension_terms; ?>',
            width:  800,
            height:  600,
            minWidth:  500,
            minHeight:  400,
            modal: true,
        });
    });
    return false;
});
//--></script>
<?php echo $footer; ?>