$().ready(function(){											

	$("a[rel^='fancybox'], a[rel^='clearbox']").fancybox({ 'zoomSpeedIn': 1000, 'zoomSpeedOut': 500, 'overlayShow': true });
	
	$('.carousel').jcarousel({
     	scroll: 1,
		 	initCallback: mycarousel_initCallback,
		 	itemVisibleInCallback: {
      		onAfterAnimation:  mycarousel_itemVisibleInCallbackAfterAnimation
     	}
  	});
		
//	$('#menu ul li ul').hide();
//	$('#menu ul li').hover(
//		function () {
//			$(this).children("ul").slideDown(600);
//		},
//		function() {
//			$(this).children("ul").hide();
//		}
//	);

});

function mycarousel_initCallback(carousel) {
	jQuery('.jcarousel-control a').bind('click', function() {
			carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
			return false;
	});
};

function mycarousel_itemLastInCallback(carousel, item, idx, state) {
	display('Item #' + idx + ' is now the last item');
};
	
function mycarousel_itemVisibleInCallbackAfterAnimation(carousel, item, idx, state) {
	display('Strana ' + idx + ' z ' );
	jQuery('.jcarousel-control a').removeClass('active');
	jQuery('.jcarousel-control a:eq(' + (idx-1) + ')').addClass('active');
};


function display(s) {
	$('#display').html(s + $('.carousel').children().size() );
};
