tables={

hideClass: 'hide',
showClass: 'show',

init:function() {

         if (!document.getElementById || !document.getElementsByTagName) {
             return;
         }

         var a;

         /* ------------------------------------------------------------------
         * Add the column toggle function event to all links in the
         * #vis_links div
         */
         var div = document.getElementById('vis_links');
         if (div) {
  
             a = div.getElementsByTagName('a');
             for (var i = 0; i < a.length; i++) {
                 dom.addEvent(a[i], 'click', tables.toggle_column_vis, false);
             }

         }
         // ------------------------------------------------------------------
     
         /* ------------------------------------------------------------------
          * Add the drop down toggle function event to all links with class
          * list_img
          */
         a = document.getElementsByTagName('a');
         for (var i = 0; i < a.length; i++) {
             if (a[i].className.indexOf('list_img') == -1) {
                 continue;
             }
             dom.addEvent(a[i], 'click', tables.toggle_div_vis, false);
         }
         // ------------------------------------------------------------------
     },

toggle_column_vis:function(e) {

                      if (!document.getElementById ||
                              !document.getElementsByTagName ) {
                          return;
                      }

                      var target = dom.getTarget(e);
                      if (!target) {
                          return;
                      }
                      var targetClass = target.className;
                      var t = document.getElementsByTagName('table');
                      if (!t) {
                          return;
                      }

                      for (var x = 0; x < t.length; x++) {
                          cells = t[x].getElementsByTagName('td');
                          for (var i = 0; i < cells.length; i++) {
                              if (cells[i].className.indexOf(targetClass) == -1) {
                                  continue;
                              }
     
                              var vis = cells[i].className;
                              if (vis.indexOf(tables.hideClass) < 0) {
                                  // Display log filenames
                                  dom.cssjs('swap', cells[i], tables.showClass,
                                      tables.hideClass);
                                  dom.setText(target, 'Show Source Logs');
                              }
                              else {
                                  // Hide log filenames
                                  dom.cssjs('swap', cells[i], tables.hideClass,
                                      tables.showClass);
                                  dom.setText(target, 'Hide Source Logs');
                              }
                          }
                      }

                      dom.cancelClick();

                  },


toggle_div_vis:function(e) {

                   if (!document.getElementById ||
                           !document.getElementsByTagName ) {
                       return;
                   }

                   // Get the node that fired the event
                   var target = dom.getTarget(e);
                   if (!target) {
                       return;
                   }
                   var c1, c2;
                   if (target.className.indexOf(tables.hideClass) != -1) {
                       c1 = tables.hideClass;
                       c2 = tables.showClass;
                   }
                   else {
                       c1 = tables.showClass;
                       c2 = tables.hideClass;
                   }
                   
                   dom.cssjs('swap', target, c1, c2);

                   // Get the parentNode
                   var parentDiv = target.parentNode;
                   if (!parentDiv) {
                       return;
                   }

                   // Get the child div
                   var div = parentDiv.getElementsByTagName('div');
                   if (!div) {
                       return;
                   }

                   dom.cssjs('swap', div[0], c1, c2);

                   dom.cancelClick(e);

               }

}
// Add the object on window load
dom.addEvent(window, 'load', tables.init, false);

