function hideall()
{
	$("ul[id^='submenu_']").hide();
}

function time_hide()
{

}

$(function(){
	$(".calendar").datepicker(
	{
		dateFormat:'dd.mm.yy',
		dayNamesMin: ['Ne', 'Po', 'Ut', 'St', 'Čt', 'Pá', 'So', 'Ne'],
		firstDay: 1,
		monthNames: ['Leden','Únor','Březen','Duben','Květen','Červen','Červenec','Srpen','Září','Říjen','Listopad','Posinec']
	}
	);
});

$(document).ready(function(){
	$("ul[id^='submenu_']").hover(
		function(){
			return true;
		},
		function(){
			time_hide();
		}
		);
  
	$("li[id^='menuitem_']").hover(function(){
		var myid     = $(this).attr("id");
		hideall();
		var submenu = $("#submenu_"+myid.split("menuitem_")[1]);
		submenu.show()
		.css("position","absolute")
	});

	$("a.zoom").fancybox({
		'overlayOpacity':0.8,
		'overlayColor':'#000000'
	});
  
	$("a.zoom1").fancybox({
		'overlayOpacity':0.0,
		'overlayColor':'#FFFFFF'
	});



	$("a.zoom2").fancybox({
		'zoomSpeedIn':500,
		'zoomSpeedOut':500,
		'overlayOpacity':0.8,
		'overlayColor':'#000000'
	});

	$(".iframe").fancybox({
		'frameWidth'			: 674,
		'frameHeight'			: 425,
		'autoScale'     	: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'overlayOpacity': '0.0',
		'overlayColor': '#000000',
		'centerOnScroll' : false
	});
	$("a.zoom-yt").click(function() {
		$.fancybox({
			'padding'             : 0,
			'autoScale'   : false,
			'transitionIn'        : 'none',
			'transitionOut'       : 'none',
			'title'               : this.title,
			'overlayOpacity'		: 0.8,
			'overlayColor'		: '#000000',
			'width'               : 680,
			'height'              : 495,
			'href'                : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'                : 'swf',    // <--add a comma here
			'swf'                 : {
				'allowfullscreen':'true'
			} // <-- flashvars here
		});
		return false;

	});
	
	
	$('a.email').each(function(){
		e = this.title.replace('[A]','@');
		var mail_array = e.split('[+]');
		var mail = mail_array.join('')
		this.href = 'mailto:' + mail;
		this.title = 'email';
		$(this).text(mail);
	});
	// Namotání fancyfoxu na Ad-Gallerie
	/*	$(".master-gallery .ad-image-wrapper, .natali-gallery .ad-image-wrapper, .frontsmall-gallery .ad-image-wrapper").click(function() {
		var mImg = $(this).find("img");
		var iUrl = mImg.attr("src");
  		mImg.fancybox({
			'overlayOpacity':0.6,
			'overlayColor':'#000',
			'width' : '95%',
			'height' : '95%',
			'href':  mImg.attr("src"),
			'title':  $(this).find("strong.ad-description-title").html()
		});
	});
*/
	// jednotlive Ad-Gallerie
	/*	$('.master-gallery .ad-gallery').adGallery();
 	$('.natali-gallery .ad-gallery').adGallery(); 
 	$('#ad-slider_1').adGallery({
        height : 88,
        width : 314,
        animate_first_image: false, // Should first image just be displayed, or animated in?
        animation_speed: 3500, // Which ever effect is used to switch images, how long should it take?
        display_next_and_prev: false, // Can you navigate by clicking on the left/right on the image?
        slideshow: {
            enable: true,
            autostart: true,
            speed: 5000
        },
        effect: 'slide-hori', // 'slide-hori'or 'slide-vert', 'resize', 'fade', 'none' or false
  		enable_keyboard_move: false, // Move to next/previous image with keyboard arrows?
  		cycle: false // If set to false, you can't go from the last image to the first, and vice versa
    });
$('.ad-gallery').adGallery({
        height : 422,
        width : 978,
        animate_first_image: false, // Should first image just be displayed, or animated in?
        animation_speed: 1500, // Which ever effect is used to switch images, how long should it take?
        display_next_and_prev: true, // Can you navigate by clicking on the left/right on the image?
        slideshow: {
            enable: true,
            autostart: true,
            speed: 5000
        },
        effect: 'fade', // 'slide-hori'or 'slide-vert', 'resize', 'fade', 'none' or false
  		enable_keyboard_move: false, // Move to next/previous image with keyboard arrows?
  		cycle: true // If set to false, you can't go from the last image to the first, and vice versa
    });*/

	$("#akce-slider").easySlider({
		continuous: true,
		pause: 3000,
		auto: true
	});

});


