// Set thickbox loading image
tb_pathToImage = "Gallery/images/loading-thickbox.gif";

var mycarousel_itemList = [
    {url: 'http://altosdelmaria.com/Gallery/SantiagoApostol/Santiagoapostol01_s.jpg', title: 'Santiago Apostol'},
    {url: 'http://altosdelmaria.com/Gallery/SantiagoApostol/Santiagoapostol02_s.jpg', title: 'Santiago Apostol'},
    {url: 'http://altosdelmaria.com/Gallery/SantiagoApostol/Santiagoapostol03_s.jpg', title: 'Santiago Apostol'},
    {url: 'http://altosdelmaria.com/Gallery/SantiagoApostol/Santiagoapostol04_s.jpg', title: 'Santiago Apostol'},
    {url: 'http://altosdelmaria.com/Gallery/SantiagoApostol/Santiagoapostol05_s.jpg', title: 'Santiago Apostol'},
    {url: 'http://altosdelmaria.com/Gallery/SantiagoApostol/Santiagoapostol06_s.jpg', title: 'Santiago Apostol'}
];

function mycarousel_itemLoadCallback(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        // Create an object from HTML
        var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList[i-1])).get(0);

        // Apply thickbox
        tb_init(item);

        carousel.add(i, item);
    }
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    var url_m = item.url.replace(/_s.jpg/g, '_m.jpg');
    return '<a href="' + url_m + '" title="' + item.title + '" style="color:#000000;"><img src="' + item.url + '" width="150" height="113" border="0" alt="' + item.title + '" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
		size: mycarousel_itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}, 
		visible: 4,
		scroll: 1
    });
	

});
