$(window).ready(function() {
    $(".photo_carousel .middle").jCarouselLite({
        btnNext: "#next_trigger",
        btnPrev: "#prev_trigger",
        slicesCt: "#slices_ct",
        start: 0,
        scroll: 7,
        visible: 7,
        circular: true,
        speed: 1000,
        easing: "easeInSine",

        afterEnd: function(a, o, curr, liSize) {
            // photosPages and photosCount are set by PHP
            if (typeof(o.slicesCt) != undefined && o.slicesCt != '') {
                var slices = $(o.slicesCt), ol = $("ol", slices), tLi = $("li", ol), tl = tLi.size();
                var page = parseInt(curr / o.visible);
                if (page > 0) {
                    page--;
                    page = page % photosPages;
                } else {
                    page = tl - 1;
                }

                tLi.removeClass('active');
                if (tLi[page] != undefined) {
                    $(tLi[page]).addClass('active');
                }
            }
       }
    });

    $('.photo_carousel').children('.bottomframe').children('.middle').children('ul').children('li').fadeTo(1,0.5);
    $('.photo_carousel').children('.bottomframe').children('.middle').children('ul').children('li.active').fadeTo(1,1);
});
