AudioPlayer.setup("scripts/player.swf", {  
    width: 320,  
	autostart: "no",
	animation: "yes",
    transparentpagebg: "yes",  
	bg: "303030",
	leftbg: "333333",
	lefticon: "666666", 
	voltrack: "666666",
	volslider: "cccccc",
	rightbg: "555555",
	rightbghover: "666666",
	righticon: "cccccc",
	righticonhover: "ededed",
	loader: "7dae1a",
	track: "303030",
	tracker: "111111",
	border: "444444",
	skip: "303030",
	text: "efefef"
});

$(document).ready(function() {

	$("div.box div.title.arrow").each(function() {
		var name = $(this).parent().attr("id");
		if(name != "") {	
			cookie = readCookie(name);
			if(cookie == "no") {
				$(this).children("span.arrow").toggleClass("hide");
				$(this).nextAll().hide();
				createCookie(name, "no", 365);
			}	
		}
	}).click(function() {
		$(this).children("span.arrow").toggleClass("hide");
		$(this).nextAll().slideToggle("fast");
		var name = $(this).parent().attr("id");
		if(name != "") {
			cookie = readCookie(name);
			if(!cookie || cookie == "yes")
				createCookie(name, "no", 365);
			else
				createCookie(name, "yes", 365);
		}
	});

	$("div.expandable div.trigger").click(function () {
		var content = $(this).parent().children("div.content");
        if (content.css('display') == 'none')
          content.show('slow');
        else
          content.hide('slow');
	});

	$("input[type=text], input[type=password]").not(".select").each(function () {
        $(this).attr("default", $(this).val())
    }).focus(function () {
        if ($(this).val() == $(this).attr("default")) $(this).val("")
    }).blur(function () {
        if ($(this).val() == "") $(this).val($(this).attr("default"))
    });

	$("input[type=text].select, input[type=password].select").focus(function() {
		$(this).select();
	}).click(function() {
		$(this).select();
	});
	
	$("div.box a.slider").click(function() {
		$(this).prev("ul.hide").slideToggle();
		if( $(this).text() == "∨ więcej ∨" )
			$(this).text("∧ mniej ∧");
		else
			$(this).text("∨ więcej ∨");
	});

	if ($("#config-dialog").length && $("#config").length)
	{
		$("#config-dialog").dialog({
			autoOpen: false,
			modal: true,
			closeText: 'Zamknij',
			dialogClass: 'config-dlg',
			draggable: true,
			buttons: {
				'Anuluj': function() {
					$(this).dialog("close");
				},
				'Zapisz': function() {
					$(this).children("form").submit();
				}
			}
		});
		$("#config").click(function() {
				$("#config-dialog").dialog("open");
		});
	}

    $("div[id^='ramowka-dialog']").dialog({
        autoOpen: false,
        modal: true,
        buttons: {
            'Anuluj': function() {
                $(this).dialog("close");
            },
            'Ustaw': function() {
                $(this).children("form").submit();
            }
        }
    });

   $(".box-program").mouseenter(function(event){
     $o = $(this).children(".box-program-overlay");
     $desc = $o.children(".box-program-overlay-details");
     $desc.show("fast");
     $o.animate({height:'100px'}, 200);
   });

   $(".box-program").mouseleave(function(event){
     $o = $(this).children(".box-program-overlay");
     $desc = $o.children(".box-program-overlay-details");
     $desc.hide("fast");
     $o.animate({height:'40px'}, 200, function() {
     // Animation complete.
     // $(this).hide();
     });
   });

   $(".halfpage-episodes-morebutton").click(function(){
     $(this).hide();
     $("#episodes-hidden").show("slow");
   });

   $("#episodes-button").click(function(){
     $(".col-fresh-episodes").toggle("slow");
   });

 });

