$(document).ready(function(){
	$("#add_div_right").hide();
	$("#add_image_right").click(function () {
      $("#add_div_right").slideToggle("slow");
    });
	
	var link = location.href;
	link = link.split('/');
	if( link[link.length-1] == 'show' ){
		$('.comm_cont').truncate({max_length: 200, more: 'rozwiń', less: 'zwiń'});
	}
	
	// [P]:Start

	$(".add_subcomment_form").hide();
	$(".add_subcomment_form_span").click(function () {
		$("#" + $(this).attr("id") + "F").toggle("slow");
   	});
	
	$("#add_comment_form2").hide();
	$("#comm_list_bottom_span").click(function () {
	      $("#add_comment_form2").toggle("slow");
	});

   	$(".show_subcomments").click(function() {
 		$("#" + $(this).attr("id") + "C").fadeIn();
		$("#" + $(this).attr("id") + "H").show();
		$(this).hide();
		$("#" + $(this).attr("id") + "H").click(function () {
			ids = $(this).attr("id").substr(0,$(this).attr("id").length-1);
			$("#" + ids).show();
			$("#" + ids + "C").fadeOut();
			$(this).hide();
		});
   	});

	// [P]:End
	
	$('#news_gallery_bottom_bar').cycle({
    	fx:    'scrollHorz',
	    timeout: 0,
	    next:   '#gallery_next',
	    prev:   '#gallery_prev'
	});

	var $container = $('#medium_img').cycle({
	    fx:     'fade',
	    speed:  2000,
    	timeout: 0
	});

	$('#news_gallery_bottom_bar div').children("img").each(function(i) {
    $(this).click(function() {
        $container.cycle(i);
        return false;
        });
	});
	
	$("#add_comment_form").hide();
	$("#show_add_comment_form_text").click(function () {
      $("#add_comment_form").toggle("slow");
    });
});