// JavaScript Document
//***********************************************
// produtos
//***********************************************

var mycarousel_itemList = [
    {url: 'fotos/produtos/01_t.jpg', title: 'Produtos'},
    {url: 'fotos/produtos/02_t.jpg', title: 'Produtos'},
    {url: 'fotos/produtos/03_t.jpg', title: 'Produtos'},
    {url: 'fotos/produtos/04_t.jpg', title: 'Produtos'},
    {url: 'fotos/produtos/05_t.jpg', title: 'Produtos'},
	{url: 'fotos/produtos/06_t.jpg', title: 'Produtos'},
	{url: 'fotos/produtos/07_t.jpg', title: 'Produtos'},
	{url: 'fotos/produtos/08_t.jpg', title: 'Produtos'},
	{url: 'fotos/produtos/09_t.jpg', title: 'Produtos'},
	{url: 'fotos/produtos/10_t.jpg', title: 'Produtos'},
	{url: 'fotos/produtos/11_t.jpg', title: 'Produtos'},
	{url: 'fotos/produtos/12_t.jpg', title: 'Produtos'}
];

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 '<img src="' + item.url + '" width="186" height="142" alt="' + item.title + '" />';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});