$(document).ready(function(){
    $.each($('.tabset'), function() {
    
        var self = $(this); 
        self.tabs = self.find('li');
        self.links = self.find('li a');
        self.tab_contents = {}; 
        
        var current = null;
        
        for(i=0; i < self.links.length; ++i) {
            var contents = $($(self.links[i]).attr('href'));
            self.tab_contents[$(self.links[i]).attr('href')] = contents;
            
            if(!$(self.links[i]).hasClass('active')) {
                contents.hide();
            } else {
                current = $(self.links[i]).attr('href');
            }
        }
        
        self.find('li a').click(function() {
        
            if(current != null) {
                $(current).hide();
            }
        
            self.links.removeClass('active');
            $(this).addClass('active');
        
            self.tab_contents[$(this).attr('href')].show(); 
            current = $(this).attr('href'); 
            
            return false; 
            
        }); 
    });
}); 
