var mycarousel_itemList = [
    {url: 'img/folio_sites/bulgakov.png', title: 'Школа вождения', href: 'portfolio2a.html'},
    {url: 'img/folio_sites/cslit.png', title: 'CSL IT', href: 'portfolio2b.html'},
    {url: 'img/folio_sites/goldstream.png', title: 'Gold Stream', href: 'portfolio2c.html'},
    {url: 'img/folio_sites/impacto.png', title: 'Impacto', href: 'portfolio2d.html'},
    {url: 'img/folio_sites/jane.png', title: 'Jane Alexandrov', href: 'portfolio2e.html'},
    {url: 'img/folio_sites/kitchenclub.png', title: 'Kitchen Club', href: 'portfolio2f.html'},
    {url: 'img/folio_sites/koffey.png', title: 'Coffey.Ru', href: 'portfolio2g.html'},
	{url: 'img/folio_sites/meropriyatie.png', title: 'Meropriyatie.Ru', href: 'portfolio2h.html'},
	{url: 'img/folio_sites/msps.png', title: 'МСПС', href: 'portfolio2i.html'},
	{url: 'img/folio_sites/remighton.png', title: 'Remington-Shop.Ru', href: 'portfolio2j.html'},
	{url: 'img/folio_sites/ufmsmo.png', title: 'ФМС МО', href: 'portfolio2k.html'},
	{url: 'img/folio_sites/vsemarket.png', title: 'VseMarket', href: 'portfolio2l.html'},
	{url: 'img/folio_sites/zavodshow.png', title: 'ZavodShow', href: 'portfolio2m.html'},
	{url: 'img/folio_sites/kvazar-sire1.png', title: 'Квазар', href: 'portfolio2n.html'},
	{url: 'img/folio_sites/jubileyniy-site1.png', title: 'Юбилейный сайт', href: 'portfolio2o.html'},
	{url: 'img/folio_sites/dtsm.png', title: 'DT Group', href: 'portfolio2p.html'},
	{url: 'img/folio_sites/bf_1.png', title: 'BokovFactory', href: 'portfolio2q.html'},
	{url: 'img/folio_sites/matvey_1.png', title: 'Матвей Малый', href: 'portfolio2r.html'},	
	{url: 'img/folio_sites/micro_1.png', title: 'Микрофинансирование', href: 'portfolio2s.html'},
	{url: 'img/folio_sites/mosk_1.png', title: 'М.О.С.К.', href: 'portfolio2t.html'},	
	{url: 'img/folio_sites/politik_1.png', title: 'Политик.ру', href: 'portfolio2u.html'},
	{url: 'img/folio_sites/sd_1.png', title: 'Солнечная Долина', href: 'portfolio2v.html'}
];

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    return '<a href="'+ item.href +'"><img src="' + item.url + '" width="174" height="151" class="png" alt="' + item.title + '" /><span>' + item.title + '</span></a>';
};

$(document).ready(function() {

    jQuery('#rollingGallery').jcarousel({
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback},
		scroll:1,
		auto:5
		
    });


}); 