
function small_initCallback(carousel)
{
	// Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function big_initCallback(carousel)
{
	// Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
	
	$('#mycarousel').find('img').click(function(){
		$var = '#'+$(this).attr('ext');
		var number = 0;
		$('#containM').fadeOut(400, function(){
			$(this).fadeIn(400);
			$($var).find('li').each(function(){
				carousel.add(number++, '<li><div style="width:810px; height:290px">'+$(this).html()+'</div></li>');
			})
		});
		carousel.scroll(0,false);
		
	});
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        wrap: 'last',
		scroll: 1,
        initCallback: small_initCallback
    });
	jQuery('#containM').jcarousel({
		scroll: 1,
		animation: 700,
        initCallback: big_initCallback
    });
});