$(document).ready(function() {
	var status = "play";

	if (GetCookie('mute') == true) {
		SetCookie( 'mute', 1, 180);
		$("#header a.mute").addClass('active');
		status = "stop";
	}

	$("#audio").jPlayer({
		ready: function () {
			$(this).jPlayer("setMedia", {
				oga: URL+"media/music/stefka.ogg",
				mp3: URL+"media/music/stefka.mp3"
			}).jPlayer(status);
		},
		ended: function (event) {
			$(this).jPlayer("play");
		},
		swfPath: URL+"media/players",
		supplied: "oga, mp3"
	});

	$("a.mute").css('display', 'block');

	$("a.mute").click(function() {
		$("#audio").jPlayer("unmute");
		if ($(this).hasClass('active')) {
			$(this).removeClass('active');
			$("#audio").jPlayer("play");
			DeleteCookie('mute');
		}
		else {
			$(this).addClass('active');
			$("#audio").jPlayer("pause");
			SetCookie('mute', 1, 180);
		}

		return false;
	});


	$("a, img, .hint").tipsy({
		gravity: 's',
		fade: true,
		delayOut: 50,
		delayIn: 500
	});


	$("a.toggle-comment").click(function() {
		if ($("#comment").hasClass('show')) {
			$("#comment").css('display', 'block');
			$("#comment").removeClass('show');
		}

		var status = $("#comment").css('display');

		if (status == 'none' || status == '') {
			$("#comment").slideDown('slow');
		}
		else {
			$("#comment").slideUp('fast');
		}
		return false;
	});

	$("a[rel=gallery]").fancybox({
		'transitionIn': 'none',
		'transitionOut': 'none',
		'titlePosition': 'over',
		'titleFormat': ''
	});

	$("a.zoom").fancybox({
		'transitionIn': 'none',
		'transitionOut': 'none',
		'titlePosition': 'over',
		'titleFormat': ''
	});

	$("a.player").each(function(){
		flowplayer(this, URL + "media/players/flowplayer.swf", {
			clip: {
				autoPlay: false,
				autoBuffering: true
			}
		});
	});



});

