$(function() {
	if ($("#recipe_slider").length) 
	{
		var items = $("#recipe_slider .recipe_txt");
		
		$(items).hide();
		$(items[0]).show();
		
		setInterval(function() {
			var actItem = $("#recipe_slider .recipe_txt:visible")[0];
			var nextItem = $(actItem).next();
			
			if (!nextItem.length) {
				nextItem = items[0];
			}
			
			$(actItem).fadeOut(function() {
				$(nextItem).fadeIn();
			});
		}, 15000);
	}
	
	if ($(".map-link").length) 
	{
		var winH = $(window).height();
		var mapH = Math.min(Math.max(winH  - 30, 500), 625);
		var propor = 900/625;
		var mapW = Math.floor(mapH * propor);
		
		$("a.map-link").fancybox({
			'autoScale'		: false,
			'width'			: mapW,
			'height'		: mapH,
			'href'			: '/userfiles/map/map.swf',
			'type'			: 'swf',
			'margin'		: -15,
			'autoDimensions': false,
			'swf'			: {
			   	'wmode'		: 'opaque',
				'allowfullscreen'	: 'true'
			}
		});
		$('body').attr('class', 'map-page');
		/*var topPos = $(window).scrollTop() + 20;
		$('.map-page #fancybox-wrap').css('top', topPos + 'px !important');
		$(window).resize(function(){
			$('.map-page #fancybox-wrap').css('top', topPos + 'px !important');
		});
		*/
		
	}
});

