
/* - ++resource++collective.contentcarousel.js/contentcarousel.js - */
var carousel_interval;
jq(document).ready(function(){
if (jq('#portal-contentcarousel')) {
    var carousel_rotate = function() {
        features = jq('.content-item');
        if (features.length < 2)
            return;
        jq('.content-item:visible').fadeOut(300);
        jq('.content-button.selected').removeClass('selected');
        next = jq('.content-item:visible').next('.content-item');
        if (next.length) {
            next.fadeIn(300);
            jq('#content-button-' + next.attr('id').substr(13)).addClass('selected');
        } else {
            jq('#content-item-0').fadeIn(300);
            jq('.content-button:first').addClass('selected');
        }
    };
    jq(function() {
        carousel_interval = setInterval(carousel_rotate, 8000);
        setTimeout(function() {
            jq('#portal-contentcarousel .link-https, #portal-contentcarousel .link-external').each( function() {
                jq(this).replaceWith(jq(this).html());
            })
        }, 1000);
        jq('#portal-contentcarousel').hover(
            function() { clearInterval(carousel_interval); },
            function() { carousel_interval = setInterval(carousel_rotate, 8000)
        });
    });
}
});


