jQuery.fn.rotate = function () {
    var t = $(this);
    var n = t.next();
    setTimeout(function () {
        t.animate({ width: 'toggle' }, 750, function () {
            t.animate({ width: 'toggle' }).appendTo(t.parent());
            n.rotate();
        });
    }, 5000);
};
$(function () {
    if ($('#banner li').length > 1)
        $('#banner li:first').rotate();

    var galleries = $('.ad-gallery').adGallery({ loader_image: '/img/loader.gif' });
    if (galleries.length > 1)
        galleries[0].toggleSlideshow();

    var calItems = $('li.ics', '#calendar');
    if (calItems.length > 0) {
        calItems.mouseenter(function () {
            var t = $(this);
            $('.download').hide();
            $('.download', t).fadeIn();
        }).mouseleave(function () {
            var t = $(this);
            $('.download', t).hide();
        });
    }
});

