$(function() {
                
    $(".scrollable img[title]").tooltip({
        position: "top right"
    }).dynamic({
        left: {
            direction: 'left',
            bounce: true
        }
    });


    $(window).bind('load', function() {
        //$(".items div").each(function() {
            //console.log($(this).find('img:first'), $(this).find('img:first').width());
            //$(this).width($(this).find('img:first').width());

            var itemsWidth = 0;
            $('.scrollable .items > div').each(function() {
                itemsWidth += $(this).innerWidth();
            });

            var width = $('.scrollable').innerWidth();

            var diff = itemsWidth - width;

            $('.scrollable').mousemove(function(e) {

                var pageX = e.pageX - $('.scrollable').offset().left;

                if(pageX > diff / 2) {
                    //pageX += 40;
                }

                var scrollLeft = pageX * (itemsWidth - width) / width;

                $('.scrollable').scrollLeft(scrollLeft);
            });

        //});
    });
    


    $(".scrollable img[title]").tooltip({
        position: "top right"
    }).dynamic({
        left: {
            direction: 'left',
            bounce: true
        }
    });
    
});


