anchor.diff:        </div>
       </div>
     <% end %>
  -  </div>
  -</div>
  +  </div><!-- col-md-6 -->
  +</div><!-- row -->
   
   <div class="row">
     <div class="col-md-6">
  -<h3>Output: <%= h @check_summary %></h3>
  -<p><%= h @check_details %></p>
  -<table class="table table-hover table-condensed">
  -  <tr>
  -    <td>Last state change:</td>
  -    <td><%= h relative_time_ago(Time.at(@check_last_change.to_i)) %> ago</td>
  -    <td><%= h Time.at(@check_last_change.to_i).to_s %></td>
  -    <td>&nbsp;</td>
  -  </tr>
  -  <tr>
  -    <td>Last update:</td>
  -    <td><%= h relative_time_ago(Time.at(@check_last_update.to_i)) %> ago</td>
  -    <td><%= h Time.at(@check_last_update.to_i).to_s %></td>
  -    <td>&nbsp;</td>
  -  </tr>
  -  <% [:critical, :warning, :unknown, :recovery, :acknowledgement].each do |type| %>
  -    <tr>
  -      <td>Last <%= h type.to_s %> notification:</td>
  -      <td><%= @last_notifications[type] ? h(@last_notifications[type][:relative]) : 'never' %></td>
  -      <td><%= @last_notifications[type] ? h(@last_notifications[type][:time].to_s) : '&nbsp;' %></td>
  -      <td><%= @last_notifications[type] ? h(@last_notifications[type][:summary]) : '&nbsp;' %></td>
  -    </tr>
  -  <% end %>
  -</table>
  -  </div>
  +    <h3>Output: <%= h @check_summary %></h3>
  +    <p><%= h @check_details %></p>
  +    <table class="table table-hover table-condensed">
  +      <tr>
  +        <td>Last state change:</td>
  +        <td><%= h relative_time_ago(Time.at(@check_last_change.to_i)) %> ago</td>
  +        <td><%= h Time.at(@check_last_change.to_i).to_s %></td>
  +        <td>&nbsp;</td>
  +      </tr>
  +      <tr>
  +        <td>Last update:</td>
  +        <td><%= h relative_time_ago(Time.at(@check_last_update.to_i)) %> ago</td>
  +        <td><%= h Time.at(@check_last_update.to_i).to_s %></td>
  +        <td>&nbsp;</td>
  +      </tr>
  +      <% [:critical, :warning, :unknown, :recovery, :acknowledgement].each do |type| %>
  +        <tr>
  +          <td>Last <%= h type.to_s %> notification:</td>
  +          <td><%= @last_notifications[type] ? h(@last_notifications[type][:relative]) : 'never' %></td>
  +          <td><%= @last_notifications[type] ? h(@last_notifications[type][:time].to_s) : '&nbsp;' %></td>
  +          <td><%= @last_notifications[type] ? h(@last_notifications[type][:summary]) : '&nbsp;' %></td>
  +        </tr>
  +      <% end %>
  +    </table>
  +  </div><!-- col-md-6 -->
  +
     <div class="col-md-6">
       <h3>Recent state changes</h3>
  -  <% if @state_changes && !@state_changes.empty? %>
  +    <% if @state_changes && !@state_changes.empty? %>
       <table class="table table-hover table-condensed">
         <tr>
           <th>Timestamp</th>
  
positive.code: 
  <div class="row">
    <div class="col-md-6">
  <%
    state_qualifier = @check_enabled ? '' : "DISABLED. Last "
    state_class     = case @check_state
                      when 'ok'
                        'success'
                      when 'warning'
                        'warning'
                      when 'critical'
                        'danger'
                      else
                        "info #{@check_state}"
                      end
  
  %>
  
      <div class="alert alert-<%= state_class %>">
        <%= state_qualifier %>State:
        <span class="alert-link"><%= @check_state ? h(@check_state.upcase) : '' %></span>
      </div>
    </div>
  
    <div class="col-md-6">
     <%
  
negative.code:       </tr>
        <% end %>
      </table>
      <% else %>
      <p>No state changes recorded for this check.</p>
      <% end %>
    </div><!-- col-md-6 -->
  </div><!-- row -->
  
  <div class="row">
    <div class="col-md-12">
      <a name="scheduled_maintenance_periods"></a>
      <h3>Scheduled Maintenance Periods</h3>
      <% if @scheduled_maintenances && !@scheduled_maintenances.empty? %>
      <table class="table table-bordered table-hover table-condensed">
        <tr>
          <th>Start</th>
          <th>End</th>
          <th>Duration</th>
          <th>Summary</th>
          <th>Actions</th>
        </tr>
  
      <% @scheduled_maintenances.sort_by {|s| s[:start_time]}.each do |scheduled_maintenance| %>
        <%
          start_time = scheduled_maintenance[:start_time]
          end_time   = scheduled_maintenance[:end_time]
          duration   = scheduled_maintenance[:duration]
          summary    = scheduled_maintenance[:summary]
        %>
        <tr>
          <td><%= h Time.at(start_time).to_s %></td>
          <td><%= h Time.at(end_time).to_s %></td>
          <td><%= h(ChronicDuration.output(duration, :keep_zero => true) || '0 secs') %></td>
          <td><%= h summary %></td>
          <td>
          <% if end_time > current_time.to_i %>
            <% label = (start_time > current_time.to_i) ? 'Delete' : 'End Now' %>
              <form action="/scheduled_maintenances/<%= check_path_escaped %>" method="post">
                <input type="hidden" name="_method" value="delete">
                <input type="hidden" name="start_time" value="<%= start_time %>">
                <button type="submit" class="btn btn-danger"><%= label %></button>
              </form>
            <% else %>
              &nbsp;
            <% end %>
          </td>
        </tr>
      </table>
    </div><!-- col-md-12 -->
    <% end %>
  <% else %>
    <p>No maintenance is scheduled</p>
  <% end %>
  </div><!-- row -->
  
  <div class="row">
    <div class="col-md-8">
  
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">Add Scheduled Maintenance</h4>
        </div>
        <div class="panel-body">
          <form action="/scheduled_maintenances/<%= check_path_escaped %>" method="post" role="form" class="form-horizontal">
  
            <div class="form-group">
              <label class="col-sm-2 control-label" for="start_time">Start time:</label>
              <div class="col-sm-9">
                <input type="text" name="start_time" class="form-control" size="20" maxlength="80" value="">
                <span class="help-block">
                  e.g. "today 4pm", "two hours hence", "friday 2pm", "2012-01-28 13:00"
                </span>
              </div>
            </div>
  
            <div class="form-group">
              <label class="col-sm-2 control-label" for="duration">Duration:</label>
              <div class="col-sm-9">
                <input type="text" name="duration" class="form-control" size="20" maxlength="80" value="">
                <span class="help-block">
                  e.g. "1 hour", "2:30:00", "three days", etc
                </span>
              </div>
            </div>
  
            <div class="col-sm-9 col-md-offset-2">
              <div class="alert alert-info">
                Times given will be interpreted in the local timezone of
                <span class="alert-link"><%= h(local_timezone) %></span>
              </div>
            </div>
  
            <div class="form-group">
              <label class="col-sm-2 control-label" for="summary">Summary:</label>
              <div class="col-sm-9">
                <input type="text" name="summary" class="form-control" size="80" maxlength="160" value="">
              </div>
            </div>
  
            <div class="form-group">
              <div class="col-sm-2"></div>
              <div class="col-sm-9">
                <button type="submit" class="btn btn-success">Save</button>
              </div>
            </div>
          </form><!-- form-horizontal-->
  
        </div><!-- panel-body -->
      </div><!-- panel panel-default -->
    </div><!-- col-md-8 -->
  </div><!-- row -->
  
  
  <div class="row">
    <div class="col-md-8">
      <h3>Contacts</h3>
      <% if @contacts && !@contacts.empty? %>
        <table class="table table-bordered table-hover table-condensed">
          <tr>
            <th>Name</th>
            <th>Media</th>
          </tr>
          <% @contacts.sort_by {|c| [c.first_name, c.last_name] }.each do |contact| %>
            <tr>
              <td><a href="/contacts/<%= contact.id %>" title="contact details"><%= h contact.name %></a></td>
              <td>
                <% if contact.media && !contact.media.empty? %>
                  <p><%= h contact.media.keys.collect(&:capitalize).join(", ") %></p>
                <% else %>
                  <p>No media</p>
                <% end %>
              </td>
            </tr>
          <% end %>
        </table>
      <% else %>
        <p>There are <strong>no contacts</strong> associated with this check.</p>
      <% end %>
    </div><!-- col-md-8 -->
  </div><!-- row -->
  
  <div id="zone-of-surprise" class="row">
    <div class="col-md-8 col-md-offset-2">
  