﻿// Homepage - Image slider (Sslide)

$(function() {
    $('#slides').slides({
        play: 10000,
        pause: 2500,
        hoverPause: true,
        animationStart: function(current) {
            $('.caption').animate({
                bottom: -90
            }, 100);
            if (window.console && console.log) {
                // example return of current slide number
                console.log('animationStart on slide: ', current);
            };
        },
        animationComplete: function(current) {
            $('.caption').animate({
                bottom: 50
            }, 200);
            if (window.console && console.log) {
                // example return of current slide number
                console.log('animationComplete on slide: ', current);
            };
        },
        slidesLoaded: function() {
            $('.caption').animate({
                bottom: 50
            }, 200);
        }
    });
});

    // initialize scrollable with mousewheel support
$(function() {
$('div.scrollable').scrollable({ size: 1, items: '.videoItems', vertical: true });
});

// Homepage Video and Audio switcher

$(document).ready(function() {
    $('#toggle1').click(function() {
        $('.video').toggle(400);
        return false;
    });
    $('#toggle1').click(function() {
        $('.audio').hide();
        return false;
    });

    $('#toggle2').click(function() {
        $('.audio').toggle(400);
        return false;
    });
    $('#toggle2').click(function() {
        $('.video').hide();
        return false;
    });
});


$(document).ready(function() {

    // Video adds Youtube popup
    $(".popup").colorbox({ iframe: true, innerWidth: 425, innerHeight: 344 });

    // Homepage news
    // Finds individual URL and creates a DIV containing a read more link
    $(".homeNews .channelSummaryContainer .linkPanel").each(function() {
        var link = $('a', this).attr('href');
        $('.linkDetails', this).after('<div class="newsReadMore"><a href="' + link + '" class="newsLink">Read more</a></div>');
    });

});
