
// Title: js/demo.js
// Date: 15:19 23 May 2009
// Version: 
// Copyright: Copyright (c) 1994-2010 Global Web Limited 
// Telephone: +44 1224 454000
// Web: http://www.globalweb.co.uk


var j = null;

function mycarousel_initCallback(carousel) 
{
    jQuery('.jcarousel-control button').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(this.value));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

function mycarousel_itemFirstInCallback(carousel, item, idx, state)
{
    display('Item #' + idx + ' is now the first item');
};

function mycarousel_itemVisibleOutCallbackBeforeAnimation(carousel, item, idx, state)
{
	display('Hide text...'+idx);

	// jQuery('#message').html("");

	jQuery('#message').fadeOut("fast");
};

function mycarousel_itemVisibleInCallbackAfterAnimation(carousel, item, idx, state)
{
        j = carousel;
       
        display('Start timer...'+idx);

	jQuery('#message').html( jQuery('#text'+idx).html() );
	jQuery('#message').fadeIn("slow");
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 4,
        wrap: 'last',
	scroll : 1,
	initCallback: mycarousel_initCallback,
	itemFirstInCallback:  mycarousel_itemFirstInCallback,
	itemVisibleOutCallback: { onBeforeAnimation: mycarousel_itemVisibleOutCallbackBeforeAnimation },
	itemVisibleInCallback:  { onAfterAnimation:  mycarousel_itemVisibleInCallbackAfterAnimation   }
    })
})

function display(s) 
{
jQuery('#display').html(s);
}

function jump(x)
{
j.scroll(x); 
}

 
