$(function() {

        $('#tablinks').find('li').remove();
    
        $('#panels').cycle({
            speed:  -1,
            timeout: 0,
            pager:  '#tablinks',
			cleartype:  1,
            pagerAnchorBuilder: function(idx, slide) {
                return '<li><a href="#">' + slide.title + '</a></li>';
            }
        });
       
    });

    $.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex){
        // Update the active link. (This is the default code for this function.)
        $(pager).find('a').removeClass('activeSlide').filter('a:eq(' + currSlideIndex +')').addClass('activeSlide');
        
        // Resize the container to fit the current div.
        var pagerTitle = document.getElementById(pager.replace(/#/, "")).title;
        var height = $("#" + pagerTitle + " > *")[currSlideIndex].cycleH;   // height of the text itself.
        $("#" + pagerTitle).height(height);
    };