/*á*/
function SearchInForums(){
	var text = $('#searchInForum').val();
	if(text.length >= 3){
		document.location.href='/forum/kereses/' + text;
	}else{
		alert('A keresendő kifejezés rövidebb, mint 3 katakter!');
	}
}

function NewTopic(){
	document.location.href='/forum/ujtopic';
}

function NewTopicSave(){
	if($('#name').val().length == 0){
		alert('Nem adtál meg nevet!');
		return;
	}

	$.post(
		'/@/newtopic.php?w=1',
		{name:$('#name').val(), category:$('#category').val(), description:$('#description').val()},
		function(html){
			var res = html.split(';');
			if(res[0] == 'ok'){
				document.location.href="/forum/tema/" + res[1];
			}else if(res[0] == 'datePara'){
				alert('Nem hozhatsz létre ilyen gyorsan másik témát!');
			}else if(res[0] == 'namePara'){
				alert('Ilyen névvel már létezik téma!');
			}else{
				alert('Nem sikerült létrehozni a témát!');
			}
		}
	)
}

function NewComment(url){	
	if($('#comment').val().length == 0){
		alert('Nem adtál meg hozzászólást!');
		return;
	}
	
	$.post(
		'/@/comment.php?w=1',
		{szoveg:$('#comment').val(), objectClass:'Topic', objectId:$('#topic').val(), replyId:$('#replyId').val()},
		function(html){
			var res = html.split(';');
			if(res[0] == 'ok'){
				document.location.href = url;
			}else if(res[0] == 'datePara'){
				alert('Nem hozhatsz létre ilyen gyorsan másik hozzászólást!');
			}else{
				alert('Nem sikerült létrehozni a témát!');
			}
		}
	)
}

function ReplyToComment(commentId, topicId){
	$('#replyId').val(commentId);	
	if(commentId > 0){
		$.post(
			'/!/comment.php?get=1',
			{commentId:commentId, topicId:topicId},
			function(html){				
				$('#comment').val('[quote]' + html + '[/quote]' + "\n");
				$('#comment').focus();
			}
		);
	}else{
		$('#comment').val('');
		$('#comment').focus();
	}
}