$(function() {
    $(".clients li").tipTip({
        maxWidth: "190px", 
        defaultPosition: "bottom"
    });
    
    $('#carousel').jcarousel({
        scroll: 1
    });
    
    function resizeWorks() {
        var blockWidth = $('#latestWorks').width(),
            elementWidth = $('#latestWorks a').eq(0).width(),
            numOfElements = Math.floor(blockWidth/elementWidth),
            margin = (blockWidth - (elementWidth * numOfElements))/(numOfElements-1);
            $('#latestWorks a').css({
                marginLeft : Math.floor(margin-1)
            });
    }
    
    $(window).resize(function() {
        resizeWorks();
    });
    
    resizeWorks();
});


