function custom_confirm(prompt, action, title){
    if (title === undefined) title = "Czy na pewno?";
    $("#dialog").append('<div id="confirm" title="' + title + '">' + prompt + '</div>');
    $("#confirm").dialog({position: 'center', width: 400, modal: true, resizable: false, show: "fold", hide: "blind", buttons: {'Nie' : function(){ $(this).dialog('close'); }, 'Tak': function(){ $(this).dialog('close'); action(); }}, close: function(ev, ui) { $(this).remove();}});
}
function custom_confirm2(prompt, action, title){
    if (title === undefined) title = "Czy na pewno?";
    $("#dialogFriend").append('<div id="confirm" title="' + title + '">' + prompt + '</div>');
    $("#confirm").dialog({position: 'center', width: 400, modal: true, resizable: false, show: "fold", hide: "blind", buttons: {'Nie' : function(){ $(this).dialog('close'); }, 'Tak': function(){ $(this).dialog('close'); action(); }}, close: function(ev, ui) { $(this).remove();}});
}

$(function(){
	$("a.f_usun").click(function(e){
	    e.preventDefault();
	    var href = $(this).attr('href');
	    custom_confirm('Potwierdź usunięcie posta',
	        function(){
	                location.href = href;
	        }
	    );
	});
	$("a.avatar_delete").click(function(e){
	    e.preventDefault();
	    var href = $(this).attr('href');
	    custom_confirm2('Potwierdź usunięcie użytkownika',
	        function(){
	                location.href = href;
	        }
	    );
	});
	$("a.image_delete").click(function(e){
	    e.preventDefault();
	    var href = $(this).attr('href');
	    custom_confirm('Potwierdź usunięcie zdjęcia',
	        function(){
	                location.href = href;
	        }
	    );
	});
});