// JavaScript Document

var mycarousel_itemList = [
    {url: 'marcas/2_1_tn.jpg', cod: '2'},
    {url: 'marcas/6_1_tn.jpg', cod: '6'},
    {url: 'marcas/7_1_tn.jpg', cod: '7'},
    {url: 'marcas/11_1_tn.jpg', cod: '11'},
    {url: 'marcas/12_1_tn.jpg', cod: '12'},
    {url: 'marcas/14_1_tn.jpg', cod: '14'},
    {url: 'marcas/15_1_tn.jpg', cod: '15'},
    {url: 'marcas/16_1_tn.jpg', cod: '16'},
    {url: 'marcas/18_1_tn.jpg', cod: '18'},
    {url: 'marcas/19_1_tn.jpg', cod: '19'},
    {url: 'marcas/21_1_tn.jpg', cod: '21'},
    {url: 'marcas/3_1_tn.jpg', cod: '3'},
    {url: 'marcas/22_1_tn.jpg', cod: '22'},
    {url: 'marcas/23_1_tn.jpg', cod: '23'},
    {url: 'marcas/24_1_tn.jpg', cod: '24'},
    {url: 'marcas/25_1_tn.jpg', cod: '25'},
    {url: 'marcas/4_1_tn.jpg', cod: '4'},
    {url: 'marcas/40_1_tn.jpg', cod: '40'},
    {url: 'marcas/41_1_tn.jpg', cod: '41'},
    {url: 'marcas/44_1_tn.jpg', cod: '44'},
    {url: 'marcas/59_1_tn.jpg', cod: '59'},
    {url: 'marcas/67_1_tn.jpg', cod: '67'},
    {url: 'marcas/62_1_tn.jpg', cod: '62'},
    {url: 'marcas/70_1_tn.jpg', cod: '70'},
    {url: 'marcas/72_1_tn.jpg', cod: '72'},
    {url: 'marcas/77_1_tn.jpg', cod: '77'},
    {url: 'marcas/82_1_tn.jpg', cod: '82'},
    {url: 'marcas/79_1_tn.jpg', cod: '79'},
    {url: 'marcas/100_1_tn.jpg', cod: '100'},
    {url: 'marcas/111_1_tn.jpg', cod: '111'},
    {url: 'marcas/113_1_tn.jpg', cod: '113'},
    {url: 'marcas/114_1_tn.jpg', cod: '114'},
    {url: 'marcas/8_1_tn.jpg', cod: '8'},
    {url: 'marcas/83_1_tn.jpg', cod: '83'},
    {url: 'marcas/9_1_tn.jpg', cod: '9'},
    {url: 'marcas/92_1_tn.jpg', cod: '92'},
    {url: 'marcas/97_1_tn.jpg', cod: '97'},
    {url: 'marcas/5_1_tn.jpg', cod: '5'},
    {url: 'marcas/26_1_tn.jpg', cod: '26'},
    {url: 'marcas/75_1_tn.jpg', cod: '75'},
    {url: 'marcas/28_1_tn.jpg', cod: '28'},
    {url: 'marcas/29_1_tn.jpg', cod: '29'},
    {url: 'marcas/30_1_tn.jpg', cod: '30'},
    {url: 'marcas/37_1_tn.jpg', cod: '37'},
    {url: 'marcas/102_1_tn.jpg', cod: '102'},
    {url: 'marcas/81_1_tn.jpg', cod: '81'},
    {url: 'marcas/58_1_tn.jpg', cod: '58'},
    {url: 'marcas/85_1_tn.jpg', cod: '85'},
    {url: 'marcas/32_1_tn.jpg', cod: '32'},
    {url: 'marcas/33_1_tn.jpg', cod: '33'},
    {url: 'marcas/45_1_tn.jpg', cod: '45'},
    {url: 'marcas/1_1_tn.jpg', cod: '1'},
    {url: 'marcas/10_1_tn.jpg', cod: '10'},
    {url: 'marcas/17_1_tn.jpg', cod: '17'},
    {url: 'marcas/34_1_tn.jpg', cod: '34'},
    {url: 'marcas/35_1_tn.jpg', cod: '35'},
    {url: 'marcas/38_1_tn.jpg', cod: '38'},
    {url: 'marcas/39_1_tn.jpg', cod: '39'},
    {url: 'marcas/91_1_tn.jpg', cod: '91'},
    {url: 'marcas/56_1_tn.jpg', cod: '56'},
    {url: 'marcas/47_1_tn.jpg', cod: '47'},
    {url: 'marcas/96_1_tn.jpg', cod: '96'},
    {url: 'marcas/98_1_tn.jpg', cod: '98'},
    {url: 'marcas/42_1_tn.jpg', cod: '42'},
    {url: 'marcas/43_1_tn.jpg', cod: '43'},
    {url: 'marcas/48_1_tn.jpg', cod: '48'},
    {url: 'marcas/49_1_tn.jpg', cod: '49'},
    {url: 'marcas/51_1_tn.jpg', cod: '51'},
    {url: 'marcas/53_1_tn.jpg', cod: '53'},
    {url: 'marcas/54_1_tn.jpg', cod: '54'},
    {url: 'marcas/57_1_tn.jpg', cod: '57'},
    {url: 'marcas/60_1_tn.jpg', cod: '60'},
    {url: 'marcas/61_1_tn.jpg', cod: '61'},
    {url: 'marcas/64_1_tn.jpg', cod: '64'},
    {url: 'marcas/65_1_tn.jpg', cod: '65'},
    {url: 'marcas/66_1_tn.jpg', cod: '66'},
    {url: 'marcas/68_1_tn.jpg', cod: '68'},
    {url: 'marcas/69_1_tn.jpg', cod: '69'},
    {url: 'marcas/71_1_tn.jpg', cod: '71'},
    {url: 'marcas/73_1_tn.jpg', cod: '73'},
    {url: 'marcas/74_1_tn.jpg', cod: '74'},
    {url: 'marcas/80_1_tn.jpg', cod: '80'},
    {url: 'marcas/84_1_tn.jpg', cod: '84'},
    {url: 'marcas/86_1_tn.jpg', cod: '86'},
    {url: 'marcas/87_1_tn.jpg', cod: '87'},
    {url: 'marcas/88_1_tn.jpg', cod: '88'},
    {url: 'marcas/89_1_tn.jpg', cod: '89'},
    {url: 'marcas/93_1_tn.jpg', cod: '93'},
    {url: 'marcas/94_1_tn.jpg', cod: '94'},
    {url: 'marcas/95_1_tn.jpg', cod: '95'},
    {url: 'marcas/101_1_tn.jpg', cod: '101'},
    {url: 'marcas/103_1_tn.jpg', cod: '103'},
    {url: 'marcas/104_1_tn.jpg', cod: '104'},
    {url: 'marcas/106_1_tn.jpg', cod: '106'},
    {url: 'marcas/107_1_tn.jpg', cod: '107'},
    {url: 'marcas/108_1_tn.jpg', cod: '108'},
    {url: 'marcas/109_1_tn.jpg', cod: '109'},
    {url: 'marcas/115_1_tn.jpg', cod: '115'},
    {url: 'marcas/116_1_tn.jpg', cod: '116'},
    {url: 'marcas/63_1_tn.jpg', cod: '63'},
    {url: 'marcas/117_1_tn.jpg', cod: '117'},
    {url: 'marcas/118_1_tn.jpg', cod: '118'},
    {url: 'marcas/112_1_tn.jpg', cod: '112'},
    {url: 'marcas/27_1_tn.jpg', cod: '27'},
    {url: 'marcas/55_1_tn.jpg', cod: '55'},
    {url: 'marcas/36_1_tn.jpg', cod: '36'},
    {url: 'marcas/50_1_tn.jpg', cod: '50'},
    {url: 'marcas/31_1_tn.jpg', cod: '31'},
    {url: 'marcas/110_1_tn.jpg', cod: '110'},
    {url: 'marcas/46_1_tn.jpg', cod: '46'},
    {url: 'marcas/76_1_tn.jpg', cod: '76'},
    {url: 'marcas/20_1_tn.jpg', cod: '20'},
    {url: 'marcas/52_1_tn.jpg', cod: '52'},
    {url: 'marcas/90_1_tn.jpg', cod: '90'},
    {url: 'marcas/105_1_tn.jpg', cod: '105'},
    {url: 'marcas/78_1_tn.jpg', cod: '78'},
    {url: 'marcas/99_1_tn.jpg', cod: '99'},
    {url: 'marcas/123_1_tn.jpg', cod: '123'},
    {url: 'marcas/124_1_tn.jpg', cod: '124'},
    {url: 'marcas/125_1_tn.jpg', cod: '125'},
    {url: 'marcas/127_1_tn.jpg', cod: '127'},
    {url: 'marcas/126_1_tn.jpg', cod: '126'},
    {url: 'marcas/129_1_tn.jpg', cod: '129'},
    {url: 'marcas/128_1_tn.jpg', cod: '128'},
    {url: 'marcas/130_1_tn.jpg', cod: '130'},
    {url: 'marcas/133_1_tn.jpg', cod: '133'}
];

mycarousel_itemList = $.shuffle(mycarousel_itemList);

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="index.php?destino=produtos&cod_marca=' + item.cod + '"><img src="' + item.url + '" alt="" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        wrap: 'circular',
		scroll: 7,
		auto: 6,
		animation: 'slow',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});
