
createTabs = function(id) {
    hideAllTabContents(id);
    
    var active_tab_id = $('#'+id+' ul li.active a').attr('href');
    $(active_tab_id).show();
    
    $('#'+id+' ul li').each(function() {
        $(this).bind('click', function() {
            hideAllTabContents(id);
            resetTabStyles(id);

            var active_tab_id = $(this).find('a').attr('href');
            $(this).find('a').parent().addClass('active');
            $(active_tab_id).show();

            return false;
        });
    });
};

hideAllTabContents = function(id) {
    $('#'+id+' .tab-content').each(function() {
        $(this).hide();
    });
};

resetTabStyles = function(id) {
    $('#'+id+' ul li').each(function() {
        $(this).removeClass('active');
    });
};

jQuery(document).ready(function() {
	/* new tabs feature */
	jQuery('.js_tabs').each(function() {
		var tab_container = jQuery(this);
		
		jQuery(tab_container).find('ul.tab_nav li a').click(function() {
			var aRef = jQuery(this);
			
			jQuery(tab_container).find('.tab_content').hide();
			jQuery(tab_container).find('ul.tab_nav li').removeClass('active');
			jQuery(this).parents('li').addClass('active');
			jQuery(tab_container).find('#'+jQuery(aRef).attr('rel')).show();
			
			return false;
		});
	});
});
