;(function($){

    /*** markup ***/
    $(document).ready(function(){


      /*** flickr slider ***/
        var currentIndex = 0;
        var imageWidth = 508;
        var panelCount = $('#gallery-mask div.image').length;


        if (panelCount) {
            gotoPane(0);

            $('#gallery-next').click(function(){
                currentIndex++;
                gotoPane(currentIndex);
                return false;
            });

            $('#gallery-prev').click(function(){
                if ( currentIndex > 0 ) {
                    currentIndex-- ;
                    gotoPane(currentIndex);
                }
                return false;
            });


            $('#gallery-zoom').click(function(){
                $.fn.colorbox({href: this.href});
                return false;
            });
        }
            function gotoPane(panel)
            {
                if ( panel < 1 ) {
                    $('#gallery-prev').addClass('disabled');
                } else {
                    $('#gallery-prev').removeClass('disabled');
                }

                if ( panel >= panelCount ) {
                    $('#gallery-next').addClass('disabled');
                } else {
                    $('#gallery-next').removeClass('disabled');
                }

                $('#gallery-zoom')
                    .attr('title', $('#gallery img:eq(' + panel + ')').attr('alt'))
                    .attr('href', $('#gallery img:eq(' + panel + ')').attr('rel'));

                $('#gallery-image-title')
                    .animate({opacity: 0}, 250, function(){
                        $(this)
                            .html($('#gallery img:eq(' + panel + ')').attr('alt'))
                            .animate({opacity: 1}, 250);
                    });

                $('#gallery-mask').stop().animate({scrollLeft: panel*imageWidth}, 500);

            }
        

        /*** newsfeed animation ***/
        $('div#sidebar div#nieuws-top ul li a').hover(function(){
            $(this).stop().animate({paddingLeft: 15}, 150);
        }, function(){
            $(this).stop().animate({paddingLeft: 5}, 150);
        });

    });

    /*** fotogallery animation ***/
    $('a.colorbox').colorbox();

})(jQuery);
