

function pokazFormatkeKomentarza(heightT)
{
	
	if($('#komentarz').height()>0)
	{
		$('#komentarz').animate({
			height: 0
		}, 400);		
	}
	else
	{
		$('#komentarz').animate({
				height: heightT
		}, 400);
		
		var i = 0;
		var inte = setInterval(function (){ $(document).scrollTop($(document).scrollTop()+20); i++; if(i==13) { clearInterval(inte); } }, 10);
	}
}

function dodajOcene(idKomentowanegoT, idKomentujacegoT, rodzaj)
{
	var trescT = document.getElementById("Komentarz_tresc").value;
	
	if(rodzaj!="")
		rodzaj = '?rodzaj='+rodzaj;
	else
		rodzaj='';
	
	jQuery.post("dodajKomentarz.php"+rodzaj, { idKomentowanego: idKomentowanegoT, idKomentujacego: idKomentujacegoT, tresc: trescT }, function(data){  });
	pokazFormatkeKomentarza('200px');
	var div = document.createElement("div");
	$(div).css("display","none");
	div.innerHTML = akcpetajaOceny;
	document.getElementById("komentarz").parentNode.insertBefore(div, document.getElementById("komentarz"));
	$(div).fadeIn("slow");
	
}

function dodajElement(idRelT, nazwaAutoraT, act)
{

	var trescT = document.getElementById("Komentarz_tresc").value;
	if(!trescT){
		trescT = document.getElementById("Komentarz_tresc_ifr").contentWindow.document.body.innerHTML;
	}
	var nazwaTematu ='';
	var msg="";
	if(act==1)
	{
		
		nazwaTematu = document.getElementById("Temat_nazwa").value;
		if(nazwaTematu=="")
			msg+="Nazwa tematu nie może być pusta \n";
		if(trescT=="" || trescT=='<p><br mce_bogus="1"></p>')
			msg+="Treść tematu nie może być pusta \n"
			
		if(msg)
		{
			alert(msg);
			return;
		}
	}
	else
	{		
		if(trescT=="" || trescT=='<p><br mce_bogus="1"></p>')
			msg+="Treść postu nie może być pusta \n"
			
		if(msg)
		{
			alert(msg);
			return;
		}
	}
	$.post("obsForum.php?act="+act, { idRel: idRelT, nazwaAutor: nazwaAutoraT, tresc: trescT.replace(/\n/g, '<br>'), temat:nazwaTematu}, function(data){submitform('forum_dodaj');});
}


