// Set thickbox loading image
tb_pathToImage = "Gallery/images/loading-thickbox.gif";

var mycarousel_itemList = [
    {url: 'http://www.losaltosdecerroazul.net/Gallery/Geranio/Geranio01_s.jpg', title: 'Front'},
    {url: 'http://www.losaltosdecerroazul.net/Gallery/Geranio/Geranio02_s.jpg', title: 'Rear'},
    {url: 'http://www.losaltosdecerroazul.net/Gallery/Geranio/Geranio03_s.jpg', title: 'Living Room'}
];

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
    });
	

});
