$(document).ready(function() {
    $('#window')
    .cycle({ 
        fx:      'fade', 
        timeout:  5000,
        next: '#next',
        prev: '#prev',
        pager: '#nav',
        before:  onBefore, 
        after:   onAfter 
    }); 
    $("#for_alt").hover(
        function(){
            $('#window').cycle('pause');
        },
        function(){
            $('#window').cycle('resume');
            setTimeout("$('#window').cycle('next')", 2000);
    });
    function onBefore() { 
        //$('#alt').html(""); 
    } 
    function onAfter() { 
        $('#alt').html(this.alt); 
        $('#link').attr('href', this.title);
    }
    function next() { 
        $('#window').cycle('next');
    }
});
