                     /* ---------------------------------------------
http://adipalaz.com/experiments/jquery/generated_tabs.html
Requires: jQuery v1.3+
When using this script, please keep this notice intact.
------------------------------------------------ */

(function($) {
$.fn.gTabs_tp = function(options) {
    var defaults = {
        section : 'div', // the container element of the individual sections
        head : 'a', // the section heading
        prefix : '', // the prefix of the hash
        def : 1, // the section to be shown by default
        hideHead : 'true' // whether to show or to hide the section headings
    };
    var o = $.extend({}, defaults, options);

    return this.each(function() {
        var container = $(this),
            prefixLength = o.prefix.length,
            num = location.hash.slice(prefixLength + 1) || o.def;

        // insert 'ul' before the the element that contains the sections:
        container.before('<div id="tabs"></div>');

        // the 'link text' in each tab is generated using the heading of the corresponding section:
        container.find('>' + o.section).each(function(i){
          $('#tabs').append('<div id="gTabs_tp">- <b><a class="tab" href="#' + o.prefix + (i+1) + '">' + $(this).prev(o.head).text() + '</a></b></div>');
          if(o.hideHead) $(this).prev(o.head).hide();
        });

        // hide all sections except the current(or default) one, and add class='active' to the current(or default) tab:
        container.find('>' + o.section + ':not(:eq(' + (num -1) + '))').hide().end()
        .prev('#tabs').find('a:eq(' + (num -1) + ')').addClass('active');

        $('#tabs a').click(function(thisTab) {
              var thisTab = $(this).closest('#tabs').find('a').index(this);
              $(this).addClass('active').parent().siblings('a').find('a.active').removeClass('active');
              $(this).closest('#tabs').next(container).find('>' + o.section + ':eq(' + thisTab + ')').fadeIn(0).siblings(o.section + ':visible').hide();
        });
    });
};
})(jQuery);


(function($) {
$.fn.gTabs_tv = function(options) {
    var defaults = {
        section : 'div', // the container element of the individual sections
        head : 'a', // the section heading
        prefix : '', // the prefix of the hash
        def : 1, // the section to be shown by default
        hideHead : 'true' // whether to show or to hide the section headings
    };
    var o = $.extend({}, defaults, options);

    return this.each(function() {
        var container = $(this),
            prefixLength = o.prefix.length,
            num = location.hash.slice(prefixLength + 1) || o.def;

        // insert 'ul' before the the element that contains the sections:
        container.before('<div id="tabs"></div>');

        // the 'link text' in each tab is generated using the heading of the corresponding section:
        container.find('>' + o.section).each(function(i){
          $('#tabs').append('<div id="gTabs_tv">- <b><a class="tab" href="#' + o.prefix + (i+1) + '">' + $(this).prev(o.head).text() + '</a></b></div>');
          if(o.hideHead) $(this).prev(o.head).hide();
        });

        // hide all sections except the current(or default) one, and add class='active' to the current(or default) tab:
        container.find('>' + o.section + ':not(:eq(' + (num -1) + '))').hide().end()
        .prev('#tabs').find('a:eq(' + (num -1) + ')').addClass('active');

        $('#tabs a').click(function(thisTab) {
              var thisTab = $(this).closest('#tabs').find('a').index(this);
              $(this).addClass('active').parent().siblings('a').find('a.active').removeClass('active');
              $(this).closest('#tabs').next(container).find('>' + o.section + ':eq(' + thisTab + ')').fadeIn(0).siblings(o.section + ':visible').hide();
        });
    });
};
})(jQuery);

(function($) {
$.fn.gTabs_finance = function(options) {
    var defaults = {
        section : 'div', // the container element of the individual sections
        head : 'a', // the section heading
        prefix : '', // the prefix of the hash
        def : 1, // the section to be shown by default
        hideHead : 'true' // whether to show or to hide the section headings
    };
    var o = $.extend({}, defaults, options);

    return this.each(function() {
        var container = $(this),
            prefixLength = o.prefix.length,
            num = location.hash.slice(prefixLength + 1) || o.def;

        // insert 'ul' before the the element that contains the sections:
        container.before('<div id="tabs"></div>');

        // the 'link text' in each tab is generated using the heading of the corresponding section:
        container.find('>' + o.section).each(function(i){
          $('#tabs').append('<div id="gTabs_finance">- <b><a class="tab" href="#' + o.prefix + (i+1) + '">' + $(this).prev(o.head).text() + '</a></b></div>');
          if(o.hideHead) $(this).prev(o.head).hide();
        });

        // hide all sections except the current(or default) one, and add class='active' to the current(or default) tab:
        container.find('>' + o.section + ':not(:eq(' + (num -1) + '))').hide().end()
        .prev('#tabs').find('a:eq(' + (num -1) + ')').addClass('active');

        $('#tabs a').click(function(thisTab) {
              var thisTab = $(this).closest('#tabs').find('a').index(this);
              $(this).addClass('active').parent().siblings('a').find('a.active').removeClass('active');
              $(this).closest('#tabs').next(container).find('>' + o.section + ':eq(' + thisTab + ')').fadeIn(0).siblings(o.section + ':visible').hide();
        });
    });
};
})(jQuery);
