
    var carousel;
    function manage_ticker()
    {
    var secs = 10000;
    
    var interval = setInterval(function(){rotate();},secs);
    $('#tickerhome').bind('mouseenter', function(){
        clearInterval(interval); 
    });
    $('#tickerhome').bind('mouseleave', function(){
        interval = setInterval(function(){rotate();},secs);
    });
    $('#tickerhome .big-pic').bind('mouseenter', function(){
        
        if(!$(this).find('.intro').is(':visible')){
        $(this).find('.intro').effect('drop', {direction: 'down', mode: 'show'}, 300).fadeTo(500, 0.85);        
        }
    });
    $('#tickerhome .big-pic').bind('mouseleave', function(){
        
        if($(this).find('.intro').is(':visible')){
        $(this).find('.intro').effect('drop', {direction: 'down', mode: 'hide'}, 300); 
               
        }
    });
    
    
    $('.ticker-thumb').bind('mouseover', function(){
        fadeImage($(this));
    });
    $('#tickerhome .carousel .items ul li').bind('mouseenter', function(){
        //clearInterval(interval);
        var cl = $(this).attr('class');
        var tmp = cl.split(" ");
        sel = tmp[0];
        $('#tickerhome').find('.big-pic:visible').fadeOut(300,function(){
            $(this).css('display', 'none');
            $('#tickerhome .' + sel).fadeIn(300);
        });       
    });
    
     $('#tickerhome .carousel .items ul li').bind('mouseleave', function(){
           //interval = setInterval(function(){rotate();},secs);
     });
    }

    function fadeImage(el)
    {
        $('.ticker-thumb').not($(el)).fadeTo(0, 0.7);
        $(el).fadeTo(200, 0.95);
    }
    function fadeImageAnim(el1, index)
    {
        var id = el1.attr('id');
        var el = $('#t-' + id);
        $('.ticker-thumb').not(el).fadeTo(0, 0.7);
        el.fadeTo(200, 0.95);
        //$('#tickerhome .carousel .next').click();
        carousel.scroll(index);
    }
    
    function rotate(){
            var index = arguments[0];
            var childs = $('#tickerhome > div.big-pic');
             
                childs.each(function(i){
                    if($(this).css('display') != 'none'){
                        if(typeof(childs[i + 1]) != 'undefined'){
                            index = i + 1;
                        }else{
                            index = 0;
                        }
                        //alert(index + ': ' +childs[index]);
                         
                        $(this).fadeOut(300, function(){
                            $(childs[index]).fadeIn(300);
                            fadeImageAnim($(childs[index]), index);
                            
                            });
                        return false;
                    }
                });
  
            
        }
        
        function change_pic(id)
        {
            var el = $('#lead_' + id);
            el.siblings().fadeOut(500);
            el.fadeIn(500);
        }
        
$(document).ready(function(){
$("#tickerhome .carousel .items ul li img").not(':first').fadeTo(0, 0.5);
     
    function mycarousel_initCallback(cb)
    {
        carousel = cb;
    }
    jQuery('#carousel').jcarousel({
        vertical: true,
        scroll: 1,
        visible: 4,
        wrap: 'circular',
        buttonPrevHTML:'<div class="prev"><img src="images/rotator/rot_prev.png" alt="" width="32" height="10" /></div>',
        buttonNextHTML:'<div class="next"><img src="images/rotator/rot_next.png" alt="" width="32" height="10" /></div>',
        initCallback: mycarousel_initCallback
    });
    //$('#tickerhome .carousel').css('display', 'inline');
    $('.ticker-thumb').parent().css('height', '69px');

    //$('#tickerhome .carousel-bg').fadeTo(0, 0.85);
    
    manage_ticker();
});
