$(document).ready(
   function () {
      tabs = function(group_name) {
         var max_num_tabs = 1000;
         var i;
         for (i = 1; i <= max_num_tabs; i++) {
            var button_id = '#' + group_name + '-tab-' + i + '-button';
            
            if ($(button_id).length <= 0) {
               break;
            }
            
            $(button_id).click(function() {
               var clicked_button_id      = '#' + $(this).attr('id');
               var visible_container_id   = clicked_button_id.substr(0, clicked_button_id.length - 7) + '-content';
               
               $(this).attr('href', 'javascript:void(0);');
               
               if ($(visible_container_id).css('display') == 'none') {
                  $(clicked_button_id).parent().attr('class', 'active');
                  $(visible_container_id).css('display', 'block');
                  
                  var j;
                  for (j = 1; j <= max_num_tabs; j++) {
                     var inactive_button_id  = '#' + group_name + '-tab-' + j + '-button';
                     var hidden_container_id = '#' + group_name + '-tab-' + j + '-content';
                     
                     if (hidden_container_id != visible_container_id) {
                        $(inactive_button_id).parent().attr('class', 'inactive');
                        $(hidden_container_id).css('display', 'none');
                     }
                  }
               }
               
               return false;
            });
         }
      }
   }
);
