
    if ( typeof(facts) != "undefined" ) {
        /**************************************************************************
         * Fast Facts Homepage
         *************************************************************************/
        var t;
        var fact_counter=0;
        var fact_clicked=false;

        function startAutoFade() {
            t=setInterval('doTransition()',5000);
        }

        function doTransition() {

            target= "#fast-fact-wrapper";
            arr = facts;

            fact_counter++;

            if ( fact_counter >= arr.length ) {
                fact_counter=0;
            }

            $(target).fadeOut("fast",function(){

                $(target).html(arr[fact_counter]).fadeIn("slow",function(){
                    fact_clicked = false;
                });
            });
        }


        $(document).ready(function() {

            $("#carousel-controls").css('visibility', "visible");

            /**************************************************************************
             * Carousel
             *************************************************************************/
            // initialize scrollable together with the autoscroll plugin
            window.api =
                $("#scroller").hover(function() {
                    api.pause();
                }).scrollable({
                    clickable:false,
                    size:1,
                    loop: true,
                    speed: 750,
                    onSeek: function() {
                        $(".slide-jump").removeClass("selected");
                        $("#slide-jump-"+(api.getIndex()+1)).addClass("selected");
                    }
                }).autoscroll({
                    autoplay: true,
                    api: true,
                    interval: 12000
                });


            $(".slide-jump").click(function() {
                api.seekTo( parseInt(this.id.split("-")[2])-1 );
            });

            /**************************************************************************
             * Fast Facts Homepage
             *************************************************************************/
            // Start Automatic Fade Timer
            startAutoFade();

            // Only show when javascript is enabled
            $("#btn-next-fact").show();

            // Handle next button clicks
            $("#btn-next-fact").click(function() {

                if ( !fact_clicked ) {
                    fact_clicked = true;

                    doTransition( "#fast-fact-wrapper", facts );
                }
                return false;
            });
        });
    }



