window.onload = function() {
	
document.getElementById('comment_author').onfocus = function () {
	this.style.backgroundColor="#D6CDBF";
}

document.getElementById('comment_author').onblur = function () {
	this.style.backgroundColor="#cbc0ab";
}

document.getElementById('comment_text').onfocus = function () {
	this.style.backgroundColor="#D6CDBF";
}

document.getElementById('comment_text').onblur = function () {
	this.style.backgroundColor="#cbc0ab";
}

$(document).ready(function () {

	$(".delete_but").hover(function () {
	
		$(this).attr("src", "grafika/layout/komentarze/delete.png");
			}, 
			function () {
				$(this).attr("src", "grafika/layout/komentarze/delete_off.png");
				 });

	 $(".delete_but").click(function () {
	
		var idKomentarza = $(this).parents("table:first").attr("id");
		
		 	var usunac = confirm("Czy na pewno chcesz usunaæ ten komentarz ?");
		 	if(usunac == true) {

		 		 usuwanieKomentu(idKomentarza);
		 	}
	

		 });
	
});

var ajaxReq = new AjaxRequest();

function usuwanieKomentu(idKomentarz) {
	


	ajaxReq.send('POST', 'strony/baza/usuwanie_komentarza.php', handleUsuwanie, 
	'application/x-www-form-urlencoded; charset=iso-8859-2',
	'id_koment=' + idKomentarz);
	
}

function handleUsuwanie() {
	if(ajaxReq.getReadyState() == 4 && ajaxReq.getStatus() == 200) {
	
	$(document).ready(function() {

		$.prompt(ajaxReq.getResponseText(),{ callback: function () {location.reload()} }); 
		
	});	

	}
}

}