$(document).ready(function() {


    var content = '';
    var f = '';
    var g = '';

    $('#tf_content_tabbed > .secHeader').each(function(i) {
		
		$(this).hide();
		
        if (i == 0) {
            f = 'first ';
            g = ' es_open';
            //$(this).show();
        } else {
            f = '';
            g = '';
            //$(this).hide();
        }
        content += '<li class="' + f + 'es_closed' + g + '"><span>' + $(this).children('h1:first').text() + '</span></li>';
    });
    content = '<div class="mainTabs"><ul>' + content + '</ul></div>';
    
	$('#tf_content_tabbed').prepend(content);

    $('#tf_content_tabbed .mainTabs li').each(function(index) {
		if(index > 0){		
			$('#tf_content_tabbed > .sec').eq(index).hide();
    	}
		$(this).click(function() {
            
			$('#tf_content_tabbed .mainTabs li.es_open').removeClass('es_open');
            
			$('#tf_content_tabbed > .sec').hide();
            $('#tf_content_tabbed > .sec').eq(index).show();
            
			$(this).addClass('es_open');

        }).mouseover(function(){
			
			$(this).addClass('over');
			
			}).mouseleave(function(){
				
				$(this).removeClass('over');
				
				});
    });
});