jQuery(document).ready(function(){

        // UL = .tabtitle2
        // Tab contents = .inside2
        
       var tag_cloud_class = '#tagcloud'; 
       
              //Fix for tag clouds - unexpected height before .hide() 
            var tag_cloud_height = jQuery('#tagcloud').height();

       jQuery('.inside2 ul li:last-child').css('border-bottom','0px') // remove last border-bottom from list in tab conten
       jQuery('.tabtitle2 li a:first').addClass('selectedsidetab'); // Add .selectedsidetab class to first tab on load
       jQuery('.inside2 > *').hide();
       jQuery('.inside2 > *:first').show();
       

       jQuery('.tabtitle2 li a').click(function(evt){ // Init Click funtion on Tabs
        
            var clicked_tab_ref = jQuery(this).attr('href'); // Strore Href value
            
            jQuery('.tabtitle2 li a').removeClass('selectedsidetab'); //Remove selectedsidetab from all tabs
            jQuery(this).addClass('selectedsidetab');
            jQuery('.inside2 > *').fadeOut(400);
            
            /*
            if(clicked_tab_ref === tag_cloud_class) // Initiate tab fix (+20 for padding fix)
            {
                clicked_tab_ref_height = tag_cloud_height + 20;
            }
            else // Other height calculations
            {
                clicked_tab_ref_height = jQuery('.inside2 ' + clicked_tab_ref).height();
            }
            */
             //jQuery('.inside2').stop().animate({
            //    height: clicked_tab_ref_height
            // },400,"linear",function(){
                    //Callback after new tab content's height animation
                    jQuery('.inside2 ' + clicked_tab_ref).fadeIn(700);
            // })
             
             evt.preventDefault();

        })
    
})
