$(function() {
	
	$("a[rel^='video']").prettyPhoto({theme: 'facebook'});
	
	/* XHTML menu */
	$('li.headlink').hover(
		function() { $('ul', this).css('display', 'block'); },
		function() { $('ul', this).css('display', 'none'); 
	});

	/* Shows */
	$(".description").hide();
	$("div.show a.read-more").toggle(function() {
		$(this).parent().find(".description").slideDown("slow");
		$(this).text("zwiń");
	}, function() {
		$(this).parent().find(".description").slideUp("slow");
		$(this).text("czytaj więcej");
	});
	
	/* Shows history.ctp */
	$(".description").hide();
	$("div.show-history a.read-more-history").toggle(function() {
		$(this).parent().find(".description").slideDown("slow");
		$(this)
	}, function() {
		$(this).parent().find(".description").slideUp("slow");
		$(this)
	});
	/* Shows program.ctp */
	$("div.details").hide();
	$("p.title").toggle(function() {
		$(this).parent().find("div.details").slideDown("slow");
		$(this)
	}, function() {
		$(this).parent().find("div.details").slideUp("slow");
		$(this)
	});
	/* Shows wydarzenia.ctp */
	$("div.biography").hide();
	$("div.bio p.show-bio").toggle(function() {
		$(this).parent().find("div.biography").slideDown("slow");
		$(this)
	}, function() {
		$(this).parent().find("div.biography").slideUp("slow");
		$(this)
	});

	var slimbox_options = {
		counterText: "Zdjęcie {x} z {y}"
	};
	/* Slimbox for Shows */
	$(".show .image-link").each(function() {
		$(this).slimbox(slimbox_options);
	});
	$(".sport .image-link").each(function() {
		$(this).slimbox(slimbox_options);
	});
	/* Slimbox for all Galleries */
	$(".gallery .image-link").slimbox(slimbox_options);
	
	$(".show .description").each(function() {
		$(this).find(".gallery-link").slimbox(slimbox_options);
	});
	$("map area").slimbox();
});
// $("map area").eq(0).attr("href")
