	$(function(){	// shorthand for $(document).ready() BTW

	 	$(document).pngFix();
	 
		$("[rel='_blank']").attr('target', '_blank'); 

		$('ul a:path').addClass('active').parent(this).addClass('active');
		
		$('.news, .sekce, .clanky-nahled').each(function() {
			var link = $("a", this).attr('href');
			$(this).wrap('<a href="'+link+'" class="no-underline"></a>');
		});

		$('.sekce, .clanky-nahled').hover(
			function(){ $(".showMore", this).css("visibility", "visible");},
	 		function(){  $(".showMore", this).css("visibility", "hidden");}
		);
	
		$('.newsAnotace p').truncate(150);

		$("a:not([target=_blank], [href^=mailto:], [href^=#], [class=truncate_hide], [class=truncate_show])").click(function(){
			$("#slogan").fadeOut();
			$("#header .menu").fadeOut("slow");
			$("#slogan").fadeIn();
			$("#header .menu").fadeIn("slow");		
		});

	    $("a[rel='lightbox']").lightBox({
			overlayOpacity: 0.7,
			imageBlank: '/img/lightbox/lightbox-blank.gif',
			imageLoading: '/img/lightbox/lightbox-ico-loading.gif',
			imageBtnClose: '/img/lightbox/lightbox-btn-close.gif',
			imageBtnPrev: '/img/lightbox/lightbox-btn-prev.gif',
			imageBtnNext: '/img/lightbox/lightbox-btn-next.gif',
			txtImage: 'Obrázek',
			txtOf: 'z'
		   });


		if ($("#player").length > 0) 
		{
			flowplayer("player", "/_js/flowplayer/flowplayer-3.1.1.swf", { 
		    clip: { 
		         
		        // these two configuration variables does the trick 
		        autoPlay: false,  
		        autoBuffering: true // <- do not place a comma here   
		    } 
			});
		}


		var mh = $('#main .main').height();
		var ph = $('#main .rightPanel').height();
		
		if (mh < ph) $('#main .main').css('min-height', ph);
		else $('#main .rightPanel').css('min-height', mh);
		

		if ($("#kontakt_mapa").length > 0) 
		{
			var mapTimer = null;
			var mapDescrInterval = 1000;
			var i = 290;//-180;
			
			$("area", this).each(function(){
				var id = $(this).attr("class");
				
				$("#"+id)
					.css({right: i+'px'})
					.hide();

			})

			$("area", this).mouseover(function(){
				var id = $(this).attr("class");
				$(".mapaDescr").hide();
				$("#komtakt_mapa_img").attr("src", "/img/mapa/"+id+".jpg");
				$("#"+id).fadeIn();
				
			});

			$("area", this).mouseout(function(){
				mapTimer = setInterval(function() {
					//$("#komtakt_mapa_img").attr("src", "/img/mapa/map_default.jpg");
					var id = $(this).attr("class");
					$("#"+id).hide();
				}, mapDescrInterval);		
			});

			$(".mapaDescr").mouseover(function(){
					clearInterval(mapTimer);	
			});
			

			$(".main, .container").hover(function(){
				$("#komtakt_mapa_img").attr("src", "/img/mapa/map_default.jpg");
				$(".mapaDescr").hide();
				
			},function(){});

		}

	
	});


