
// Set thickbox loading image
tb_pathToImage = "images/loading-thickbox.gif";

var mycarousel_itemList = [
	{url: "photos/portal_store.jpg", title: "Portal"},
    {url: "photos/jaguar_store.jpg", title: "Jaguar"},
    {url: "photos/cindy.jpg", title: "Cindy"},
    {url: "photos/misrepresentation_store.jpg", title: "Misrepresentation"},
    {url: "photos/tricia.jpg", title: "Tricia"},
    {url: "photos/wolf_store.jpg", title: "Wolf Spirit"},
    {url: "photos/amanda.jpg", title: "Amanda"}, 
    {url: "photos/armageddon_store.jpg", title: "Armageddon"},
    {url: "photos/brokenheart_store.jpg", title: "Broken Heart"},
    {url: "photos/brycet_store.jpg", title: "Bryce"},
    {url: "photos/cardinals_store.jpg", title: "Cardinals"},
    {url: "photos/casey.jpg", title: "Casey"},
    {url: "photos/revolver_store.jpg", title: "Revolver"},
    {url: "photos/chiseled_store.jpg", title: "Chiseled"},
    {url: "photos/concentric_store.jpg", title: "Concentric"},
    {url: "photos/rose_store.jpg", title: "Rose"},
    {url: "photos/cross_store.jpg", title: "Cross"},
    {url: "photos/eclipse_store.jpg", title: "Eclipse"},
    {url: "photos/elevation_store.jpg", title: "Elevation"},
    {url: "photos/flames_store.jpg", title: "Flames"},
    {url: "photos/lavaflow_store.jpg", title: "Lava Flow"},
    {url: "photos/libby.jpg", title: "Libby"},
    {url: "photos/meteor_store.jpg", title: "Meteor"},
    {url: "photos/mike.jpg", title: "Mike"},
    {url: "photos/mom.jpg", title: "Mom"},
    {url: "photos/ocean_store.jpg", title: "Ocean"},
    {url: "photos/overlord_store.jpg", title: "Overlord"},
    {url: "photos/owl_store.jpg", title: "Owl"},
    {url: "photos/plume_store.jpg", title: "Plume"},
    {url: "photos/puzzle.jpg", title: "Puzzle"},
    {url: "photos/render.jpg", title: "Render"},
    {url: "photos/rocko.jpg", title: "Rocko"},
    {url: "photos/spinal_store.jpg", title: "Spinal"},
    {url: "photos/stairway_store.jpg", title: "Stairway"},
    {url: "photos/tiger_store.jpg", title: "Tiger"},
    {url: "photos/transformer.jpg", title: "Transform"},
    {url: "photos/triascle.jpg", title: "Triascle"},
    {url: "photos/triwave.jpg", title: "Triwave"}, 
    {url: "photos/whale_store.jpg", title: "Isn't My Whale Pretty?"}
];

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(/_z.jpg/g, '_m.jpg');
    return '<a href="' + url_m + '" title="' + item.title + '"><img src="' + item.url + '" width="125" height="125" border="0" alt="' + item.title + '" /></a>';
};

 
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        size: mycarousel_itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
    });
});

