/* JavaScript Document

--------------------------------
Animal Music
(c) Adam Kudrna 2010
Last edited: 2010-04-27
--------------------------------

*/



// Initialize
$(document).ready(function () {



	// TEMPORARY: E-shop Popup
	/*$("#f-buy a.button").addClass("popup at-the-bottom").append(
		'<span class="title"><span>Otevře nové okno s&nbsp;původní verzí našeho e-shopu</span></span>'
	);*/

/*---------------------------------------------------------------
GENERIC EFFECTS
---------------------------------------------------------------*/

	// External Links & Files
	$('a[href^="http://"], a.file').click(function() {
		this.target="_blank";
	});

	// Animated On-Page Scrolling
	$('a[href^="#"]').not(".slide-toggle-next, .show-toggle-next").click(function() {
		$.scrollTo(this.hash, "slow");
		return false;
	});

	// Fancybox Gallery
	$("a.gallery").fancybox({
		"centerOnScroll": true,
		"hideOnContentClick": true,
		"titleShow": false
	});

	// Custom Title
	/*$("a.play").addClass("popup").append('<span class="title"><span></span></span>');
	$("a.play.popup span.title span").text(this.parents().eq(2).attr("title"));*/

	// Popups
	$(".popup span.title").hide();
	$(".popup").removeClass("css-fx").mouseenter(function() {
		$("span.title", this).fadeIn("fast");
		//$("span.title", this).show("drop"); // rozbity
	}).mouseleave(function() {
		$("span.title", this).fadeOut(500);
		//$("span.title", this).hide("drop");
	});

	// Show Effect
	$(".show-toggle-next").next().hide();
	$(".show-toggle-next").click(function() {
		$(this).toggleClass("selected");
		$(this).next().animate(
			{"height": "toggle", "opacity": "toggle"},
			{duration: 800, queue: false}
		);
		if ($(this).is(".selected")) {
			$.scrollTo($(this).next(), "slow");
		}
		return false;
	});

	// Slide Down Effect
	$(".slide-toggle-next").next().hide();
	$(".slide-toggle-next").toggle(
		function() {
			$(this).addClass("selected").next().show("slide", {direction: "up"}, "normal");
			return false;
		},
		function() {
			$(this).removeClass("selected").next().hide("slide", {direction: "up"}, "slow");
			return false;
		}
	);



/*---------------------------------------------------------------
CONTENT-SPECIFIC EFFECTS
---------------------------------------------------------------*/

	// Top Link
	$topLinkMarginRight = parseInt($("#top-link a").css("marginRight"));
	$topLinkBackgroundColor = $("#top-link a").css("backgroundColor");
	$("#top-link a").mouseenter(function() {
		$(this).animate({
			marginRight: "0",
			backgroundColor: "#999"
		}, {queue: false, duration: "fast"});
	}).mouseleave(function() {
		$(this).animate({
			marginRight: $topLinkMarginRight,
			backgroundColor: $topLinkBackgroundColor
		}, {queue: false, duration: 500});
	});

	// Album Previews
	$("a.album-preview span.info").hide();
	$("a.album-preview").removeClass("css-fx").mouseenter(function() {
		$("span.info", this).fadeIn(100); // queue: false to rozbiji
	}).mouseleave(function() {
		$("span.info", this).fadeOut(333);
	});

	// E-shop: Drop-All Confirm
	$('#eshop-drop-all').click(function() {
		if (window.confirm('Opravdu si přejete vysypat celý košík?')) {
			return true;
		} else {
			return false;
		}
	});
	$('#eshop-drop-all-2').click(function() {
		if (window.confirm('Do you really wish to remove all items?')) {
			return true;
		} else {
			return false;
		}
	});

	// Mailing List Subscribe Conditions
	//$('#subscribe-conditions-link').click(function() {
		$('#subscribe-conditions').dialog({
			resizable: false,
			height: 140,
			modal: true,
			buttons: {
				'Souhlasím': function() {
					$(this).dialog('close');
				},
				'Zrušit': function() {
					$(this).dialog('close');
				}
			}
		});
		/*return false;
	});*/



});
