$(document).ready(function() { 
	$('a#cant_edit').fancybox({
		'autoDimensions'	: false,
		'width'         		: 350,
		'height'        		: 100
	});
	$('a#cant_edit').click(function(){
		$('#cantedit').parent().parent().css('background-color','#5A99B3');
		$('#cantedit').parent().css('background-color','#5A99B3');
		return false;
	});
});   

function checkComment(){
		if($("#comment_text").val()=="") 
			alert("Nie została podana treść komentarza!");
		else{
			$("#comment_form").submit();
		}
	}

	function komentuje(data, autor,id)
	{
		$('html, body').animate({ 
		      scrollTop: $('#doit').offset().top 
		  }, 3000);

		$("#reply_text").html("<a href='javascript:void(0)' onclick='reset_comment();'>Anuluj ></a>Odpowiadasz na posta <b>"+autor+"</b>");
    	$("#reply_text").slideDown("slow");
    	$("#reply").val(id);
    	$("#edit").val("0");
    	$("#comment_text").html('');
    	$("#comment_text").focus();
   	}
	
 	function reset_comment(){
		$("#reply_text").slideUp("slow");
    	$("#reply").val("0");
 	}
	
 	function reset_edit_comment(){
 	   	$('#comment_text').html('');
		$("#reply_text").slideUp("slow");
    	$("#edit").val("0");
 
 	}
 	
 	function edit_comment(id,data)
 	{
 		$("#comment_text").load("/action.php?action=edit_comment&id="+id);
 	}
 	
 	function showZasady()
 	{
 		$("#zasadyText").slideToggle("slow");
 	}

	$('#publikuj_link').click(function(){
		checkComment();
	});

	$('#zasady_link').click(function(){
		showZasady();
	});
 	
