<table width="100%" cellspacing=0 cellpadding=0 id="attr_table">

  <tr style="display: none" id="el_0">
    <td class='dataVar dataOdd conf_attr_unused conf_row' align="left" width="170" abbr="" onmouseover="jQuery('#d'+this.parentNode.id).css('display', '')" onmouseout="jQuery('#d'+this.parentNode.id).css('display', 'none')"></td>
    <td class='dataVar dataOdd conf_row clickable' align="left" width="16" abbr="" onmouseover="jQuery('#d'+this.parentNode.id).css('display', '')" onmouseout="jQuery('#d'+this.parentNode.id).css('display', 'none')"><input type="image" src="[% url_prefix %]thruk/themes/[% theme %]/images/minus.gif" title="remove this attribute" id="del_0" onclick="remove_conf_attribute(this.parentNode.abbr, 'del_0'); return false;" style="display: none" tabindex='13'></td>
    <td class='dataVal dataOdd conf_row' colspan=2></td>
    <td class='dataVal dataOdd clickable conf_row' [% info_popup_event_type %]="return overlib(this.abbr,CAPTION,'Help',WIDTH,600,[% c.config.info_popup_options %]);" abbr=''><img src='[% url_prefix %]thruk/themes/[% theme %]/images/help.png' alt='help' title='help' width="16" height="16"></td>
  </tr>

  [% SET loopclass="dataEven" %]
  [% FOREACH key = obj.get_sorted_keys() %]
    [% NEXT IF obj.default.exists(key) && obj.default.$key.type == "DEPRECATED" %]
    [% IF duplicate_keys.exists(key) %]
      [% class = "conf_attr_used" %]
    [% ELSE %]
      [% class = "conf_attr_unused" %]
    [% END %]
    [% IF loop.even %]
        [% SET loopclass="dataEven" %]
    [% ELSE %]
        [% SET loopclass="dataOdd" %]
    [% END %]
    <tr class="[% loopclass %]">
      <td class='dataVar [% loopclass +%] [%+ class %] conf_row' align="left" width="170" abbr="[% key %]" onmouseover="jQuery('#del_[% loop.count %]').attr('src', '[% url_prefix %]thruk/themes/[% theme %]/images/minus.gif')" onmouseout="jQuery('#del_[% loop.count %]').attr('src' ,'[% url_prefix %]thruk/images/spacer.png')">[% IF !obj.default.exists(key) %]<input type="text" name="objkey.[% loop.count %]" value="[% key %]" class="attrkey" onchange="jQuery('.obj_[% key %]').attr('name', 'obj.'+this.value)">[% ELSE %][% key %][% END %]</td>
      <td class='dataVar [% loopclass +%] [%+ class %] conf_row clickable' width="16" align="left" abbr="[% key %]" onmouseover="jQuery('#del_[% loop.count %]').attr('src', '[% url_prefix %]thruk/themes/[% theme %]/images/minus.gif')" onmouseout="jQuery('#del_[% loop.count %]').attr('src', '[% url_prefix %]thruk/images/spacer.png')"><input type="image" src="[% url_prefix %]thruk/images/spacer.png" id="del_[% loop.count %]" title="remove this attribute" onclick="remove_conf_attribute(this.parentNode.abbr, 'del_[% loop.count %]'); return false;" style="height:16px; width: 16px;" tabindex='13'></td>
      <td class='dataVal [% loopclass %] conf_row' colspan=2>
        [% PROCESS _conf_object_row.tt nr = loop.count edit = 1 defaults = obj.default key = key obj_conf = obj.conf %]
      </td>
      [% SET helpkey = key %]
      [% IF !obj.default.exists(key) %]
        [% IF key.substr(0, 1) == "_" %]
          [% SET helpkey = "customvar" %]
        [% ELSIF type == "timeperiod" %]
          [% SET helpkey = "[exception]" %]
        [% END %]
      [% ELSIF obj.default.$key.exists('help') %]
        [% SET helpkey = obj.default.$key.help %]
      [% END %]
      <td class='dataVal [% loopclass %] clickable conf_row'  width="18" [% info_popup_event_type %]="return overlib(this.abbr,CAPTION,'Help',WIDTH,600,[% c.config.info_popup_options %]);" abbr='&lt;b&gt;[% helpkey %]&lt;/b&gt;&lt;br&gt;[% escape_html(obj.get_help(helpkey)) | nl2br %]'><img src='[% url_prefix %]thruk/themes/[% theme %]/images/help.png' alt='help' title='help' width="16" height="16"></td>
    </tr>

    [% IF !obj.default.exists(key) || obj.default.$key.type != 'LIST' || (obj_conf.$key.size > 0 && obj.conf.$key.0.substr(0,1) != '+') %]
      [% SET duplicate_keys.$key = 1 %]
    [% END %]
  [% END %]

  [% IF loopclass=="dataEven" %]
      [% SET loopclass="dataOdd" %]
  [% ELSE %]
      [% SET loopclass="dataEven" %]
  [% END %]
  <tr class="[% loopclass %]">
    <td class='dataVar [% loopclass +%] conf_row' align="left">
      <input type="text" class="attrkey new_attr" name="newattr" id="newattr" value="new attribute..." [% IF use_ajax_search %]onfocus="this.click()" onclick="ajax_search.init(this, 'attribute', { url:'conf.cgi?action=json&amp;type=attribute&amp;obj=[% type %]', autosubmit:false, empty: true, emptytxt: 'new attribute...', emptyclass:'new_attr', filter:new_attr_filter, emptymsg:'add custom variable', onselect:function() { on_attr_select(); return false; }, onemptyclick: function() { on_empty_click(); } })"[% END %]>
    </td>
    <td class='dataVar [% loopclass +%] conf_row' align="left"></td>
    <td class='dataVal [% loopclass %] conf_row' colspan=2></td>
    <td class='dataVal [% loopclass %] conf_row'></td>
  </tr>


  [% IF loopclass=="dataEven" %]
      [% SET loopclass="dataOdd" %]
  [% ELSE %]
      [% SET loopclass="dataEven" %]
  [% END %]
  <tr>
    <td class='dataVar [% loopclass %] conf_row' align="left" style="border-bottom: 0px;">comments</td>
    <td class='dataVar [% loopclass %] conf_row' style="text-align: center; border-bottom: 0px; white-space: inherit;" colspan=4>
      <button id="attr_opener" class="conf_button">add new attribute</button>

      <script type="text/javascript">
      <!--
      var fields = new Object({
        [% FOREACH key_cat = obj.get_default_keys() %]
          [% FOREACH key = key_cat.keys %]'[% key %]': { 'input': '[% PROCESS _conf_object_row.tt nr=0 edit=1 defaults = obj.default key = key obj_conf = obj.conf | escape_html | replace("'", "\\'") | replace("\n", "") %]', 'help': '[% SET helpkey = key %][% IF !obj.default.exists(key) %][% SET helpkey = "customvar" %][% ELSIF obj.default.$key.exists('help') %][% SET helpkey = obj.default.$key.help %][% END %]&lt;b&gt;[% helpkey %]&lt;/b&gt;&lt;br&gt;[% escape_html(obj.get_help(helpkey)) | nl2br | replace("'", "\\'") | replace("\n", "") %]' }
            [% UNLESS loop.last %],[% END %]
          [% END %]
          [% UNLESS loop.last %],[% END %]
        [% END %]
      });
      -->
      </script>

      <table border="1" class='filter' cellspacing="0" cellpadding="0" id="new_attribute_pane" style="display:none">
        <tr>
          <td class='filter'>
            <table>
              [% FOREACH key_cat = obj.get_default_keys() %]
                <tr>
                  <td class='attrName'><b>[% key_cat.name %]</b></td>
                  [% FOREACH key = key_cat.keys %]
                    <td class='attrValue clickable' onclick="add_conf_attribute('attr_table', '[% key %]'); return false;" id="new_[% key %]_btn" style="min-width:80px;[% IF key != 'customvariable' && key != 'exception' && obj.conf.defined(key) %] display:none[% END %]">[% key %]</td>
                  [% END %]
                </tr>
              [% END %]
            </table>
            <center><button class="conf_button" id="finish_button">finish</button></center>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class='dataVal [% loopclass %] conf_row' colspan=5><textarea rows=8 name="conf_comment" style='white-space: nowrap; word-wrap: normal; width: 100%'>[% obj.comments.join("\n") %]</textarea></td>
  </tr>

</table>
