/**
*
*  StripeTable 1.0 - client-side table striping
*  Copyright (c) 2008 HDE, Inc.
*  Dual licensed under the MIT and GPL licenses:
*  http://www.opensource.org/licenses/mit-license.php
*  http://www.gnu.org/licenses/gpl.html
*
*  @description Create a striped table.
*
**/
(function($) {

  $.extend({
    stripeTable : new function() {
    
      this.defaults = {
        pattern_num : 2
      };
      
      this.construct = function(settings) {
        return this.each(function() {
          
          if (!this.tHead || !this.tBodies) return;
          
          var config = $.extend({}, $.stripeTable.defaults, settings);
          if (config.pattern_num.constructor != Number || config.pattern_num <= 1) return;
          
          $(this).children("tbody").children("tr").each(function(index) {
            $(this).addClass("stripe-" + ((index % config.pattern_num) + 1));
          });
          
        });
      };
      
    }
  });

  $.fn.extend({
    stripeTable : $.stripeTable.construct
  });

})(jQuery);

