// JavaScript Document

// Set thickbox loading image
tb_pathToImage = "/images/loading-thickbox.gif";

var mycarousel_itemList = [
    {url: './images/facethemountain08/2008_0831mountaintheface0048.jpg', title: 'Balance Training'},
    {url: './images/facethemountain08/2008_0831mountaintheface0049.jpg', title: 'Balance Training2'},
	{url: './images/facethemountain08/2008_0831mountaintheface0051.jpg', title: 'Ippon Kumite'},
	{url: './images/facethemountain08/2008_0831mountaintheface0056.jpg', title: 'Knuckle Strengthening '},
	{url: './images/facethemountain08/2008_0831mountaintheface0058.jpg', title: 'Palm Strengthening'},
	{url: './images/facethemountain08/2008_0831mountaintheface0061.jpg', title: 'Shuto Fist Strengthening'},
	{url: './images/facethemountain08/2008_0831mountaintheface0062.jpg', title: 'Punch Strengthening'},
	{url: './images/facethemountain08/2008_0831mountaintheface0067.jpg', title: 'Broke Kumite'},
	{url: './images/facethemountain08/2008_0831mountaintheface0069.jpg', title: 'Broke Kumite'},
	{url: './images/facethemountain08/2008_0831mountaintheface0073.jpg', title: 'Ippon Kumite'},
	{url: './images/facethemountain08/2008_0831mountaintheface0074.jpg', title: 'Ippon Kumite'},
	{url: './images/facethemountain08/2008_0831mountaintheface0078.jpg', title: 'Kata Bunkai'},
	{url: './images/facethemountain08/2008_0831mountaintheface0082.jpg', title: 'Kata Bunkai'},
	{url: './images/facethemountain08/2008_0831mountaintheface0085.jpg', title: 'Kata Bunkai'},
	{url: './images/facethemountain08/2008_0831mountaintheface0085.jpg', title: 'Kata Bunkai'},
	{url: './images/facethemountain08/2008_0831mountaintheface0087.jpg', title: 'Kata Bunkai'},
	{url: './images/facethemountain08/2008_0831mountaintheface0090.jpg', title: 'Sensei Teaching'},
	{url: './images/facethemountain08/2008_0831mountaintheface0091.jpg', title: 'Sensei Teaching'},
	{url: './images/facethemountain08/2008_0831mountaintheface0092.jpg', title: 'Sensei Teaching'},
	{url: './images/facethemountain08/2008_0831mountaintheface0093.jpg', title: 'Sensei Teaching'},
	{url: './images/facethemountain08/2008_0831mountaintheface0094.jpg', title: 'Sensei Teaching'},
	{url: './images/facethemountain08/2008_0831mountaintheface0095.jpg', title: 'Sensei Teaching'},
	{url: './images/facethemountain08/2008_0831mountaintheface0097.jpg', title: 'Sensei Weapons Teaching'},
	{url: './images/facethemountain08/2008_0831mountaintheface0096.jpg', title: 'What a view'}
	
];

var mycarousel_itemList2 = [
    {url: './images/santos_promo/2008_1028promo0053.jpg', title: 'Before class starts'},
	{url: './images/santos_promo/2008_1028promo0052.jpg', title: 'Class in formation'},
	{url: './images/santos_promo/2008_1028promo0054.jpg', title: 'Sensie Santos'},
	{url: './images/santos_promo/2008_1028promo0055.jpg', title: 'Mr. Dutch Promotion'},
	{url: './images/santos_promo/2008_1028promo0056.jpg', title: 'Mr. Dutch Promotion'},
	{url: './images/santos_promo/2008_1028promo0059.jpg', title: 'Mr. Dutch Shodan'},
	{url: './images/santos_promo/2008_1028promo0062.jpg', title: 'Congratulation Mr. Dutch'},
	{url: './images/santos_promo/2008_1028promo0064.jpg', title: 'Sensei Santos Promotion'},
	{url: './images/santos_promo/2008_1028promo0073.jpg', title: 'Sensei Santos Red/White Belt '},
	{url: './images/santos_promo/2008_1028promo0078.jpg', title: 'Presenting 7th Dan Sensei Santos'},
	{url: './images/santos_promo/2008_1028promo0080.jpg', title: 'Sensei Santos Promotion'},
	{url: './images/santos_promo/2008_1028promo0087.jpg', title: 'Sensei Santos and Sensei Funk'},
	{url: './images/santos_promo/2008_1028promo0088.jpg', title: 'Sensei Santos Promotion'},
	{url: './images/santos_promo/2008_1028promo0090.jpg', title: 'Sensei Funk and his current black belts'}
	
	];
	
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);
    }
};

function mycarousel_itemLoadCallback2(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList2.length) {
            break;
        }

        // Create an object from HTML
        var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList2[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');
	var url_m = item.url
    return '<a href="' + url_m + '" title="' + item.title + '"><img src="' + item.url + '" width="75" height="75" border="0" alt="' + item.title + '" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        size: mycarousel_itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
    });
	jQuery('#mycarousel2').jcarousel({
        size: mycarousel_itemList2.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback2}
    });
});



