﻿function carouselCallback(direction, nextStep, env) {
    var next;

    if (direction == 'next') {
        var carouselWidth = env.$elts.wrap.width();
        var numberOfItemsVisible = Math.floor(carouselWidth / env.itemWidth);
        next = numberOfItemsVisible + nextStep;
    }
    else {
        next = nextStep + 1;
    }

    var a = $('li:nth-child(' + next + ') a', env.$elts.content);
    a.click();
}
