/* Showroom Slider */
jQuery(function($)
{
	// enable the carousel
	var visible_index = 0;
    var jc = $(".showroom .product-carousel").jCarouselLite(
    {
        btnPrev: $(".showroom .carousel-navigation .button-prev"),
        btnNext: $(".showroom .carousel-navigation .button-next"),
		visible: 1,
        start: visible_index,
        circular: false,
        arrowKeys: true,
        afterEnd: function(visible_elements)
        {
            var index = 0;
            $(".showroom .product-carousel ul > li").each(function(i, val)
            {
                if(this == visible_elements[0])
                {
                    index = i;
                    return false;
                }
            });
            $(".showroom .carousel-state > li").removeClass("active")
                .eq(index).addClass("active");
        }
    });
	
	// set up carousel navigation
	var state_buttons = $(".showroom .carousel-state > li");
	state_buttons.each(function(i)
	{
		$(this).click(function(){
			jc.go(i);
			return false;
		});
	});
	
	// show the navigation
	$(".showroom .carousel-navigation").show();
	
	// set the right nav item as active
	state_buttons.eq(visible_index).addClass("active");
});


