

/**
 * Event handler called when carousel initialized
 */
function initHandler(carousel) {


	jQuery('.jcarousel-control a').bind('click', function() {


		var link = $(this);
 
		rel = link.attr('rel');

		 

        carousel.scroll(jQuery.jcarousel.intval(rel));
        return false;
    });


    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
	
};



/**
 * Event handler for when the carousel is displayed to do the animation of fading
 */
function visibleHandler() {
	$('#home-carousel').css({display:'none'});
	$('#home-carousel').fadeIn("slow");
	 
}


/**
 * Loaded when doc is ready
 */
jQuery(document).ready(function() {

	//display the carousel since its ready to be displayed
	$('#home-carousel').css({display:'block'});
	
	jQuery('#home-carousel').jcarousel({
		auto: 7,
		wrap: 'last',
		initCallback: initHandler,
		scroll:1, 
		animation:0,
		itemVisibleInCallback: visibleHandler
	});
});


