$(window).load(
	function()
	{
		$('.gallery-block').each(
			function()
			{
				$(this).css('visibility', 'visible');
			}
		);
	}
);

$(document).ready(
	function()
	{
		var pane_left 	= $('.left-inside-block');
		var pane_big 	= $('.big-place-body');

		pane_left.jScrollPane({
			showArrows: 		true,
			scrollbarWidth:		7,
			dragMaxHeight:		19
		});

		pane_big.jScrollPane({
			showArrows: 		true,
			scrollbarWidth:		7,
			dragMaxHeight:		19
		});

		var api_left 	= pane_left.data('jsp');
		var api_big 	= pane_big.data('jsp');

		$('.name-section').click(
			function()
			{
				var id_elem = $(this).attr('id');
				$('.dishes.' + id_elem).slideToggle("slow");
				api_big.reinitialise();
			}
		);

		$('.image-block').each(
			function()
			{
				$(this).cycle({
					fx: 'fade',
					delay: -(1 + Math.floor(Math.random()*1000))
				});
			}
		);

		$('.left-inside-block, .big-place-body').focus(
			function()
			{
				$(this).blur();
			}
		);

		$('a.fancybox-link').fancybox();

		$("a[rel=fancybox]").fancybox({
			'cyclic'			: true,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts)
			{
				var arr_title 	= title.split('|');
				arr_title[0] 	= ((arr_title[0] == undefined) ? '' : arr_title[0]);
				arr_title[1] 	= ((arr_title[1] == undefined) ? '' : arr_title[1]);

				//return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span> ';
				return '<span id="fancybox-title-over"><span>' + arr_title[0] + ' | <span>' + arr_title[1] + '</span></span>';
			}
		});
	}
);
