;(function($){
    $(function() {
        
        $('#home-slider .tabs li a').live('click', function() {
            if ($(this).parent('li').hasClass('active')) {
                return false;
            };
            var href= $(this).attr('href');
            $('#home-slider .tabs li').removeClass('active').find('span.arrow').remove();
            $(this).parent('li').addClass('active').append('<span class="arrow">&nbsp;</span>');
            $('#home-slider .tabs-content .tab-content').fadeOut();
            $(href).fadeIn();
            return false;
        });
        
        function switch_img() {
            var current = $('#fc-slide a:visible');
            
            if (current.is(':last-child')) {
                var next = $('#fc-slide a:eq(0)');
            } else {
                var next = current.next();
            }
            current.fadeOut('slow');
            next.fadeIn('slow');
            
            setTimeout(arguments.callee, 5000);
        }
        setTimeout(switch_img, 5000);
    });
})(jQuery)
