(function(){
    
    if(!jQuery) {
        throw new Error('jQuery is required for jquery.semantictabs.js');
    }
    
    var uuid = 0;
    var prefix = 'ui-tabs-';
    
    jQuery.fn.semanticTabs = function(){
    
        this.each(function(){
            
            var tabs = jQuery('<ul />');
            
            jQuery('.tab', this).each(function(){
                uuid++;
                var label = jQuery('.tab-label', this).hide().text();
                var id = prefix + uuid;
                tabs.append('<li><a href="#'+id+'">'+label+'</a></li>');
                this.id = id;
            });
            
            jQuery(this).prepend(tabs);
            
        });
        
        this.tabs();
        
    }
    
}());


