function addPhoto() {
	if (photoCount < maxPhotos) {
		photoCount++;
		$('.defPicture_1').show();
		$('#photo_upload_'+photoCount).show('slow');
		if (photoCount == maxPhotos) {
			$('#add_photo_link').hide('slow');
		}
	} else {
		alert('Maximum '+maxPhotos+' fotót tölthetsz fel!');
	}
}

function addVideo() {
	if (videoCount < maxVideos) {
		videoCount++;
		$('#video_link_'+videoCount).show('slow');
		if (videoCount == maxVideos) {
			$('#add_video_link').hide('slow');
		}
	} else {
		alert('Maximum '+maxVideos+' videót ágyazhatsz be!');
	}
}

function toggleMoreComments(aElement, postId) {
	if ('szerinted_tovabbi' == aElement.className) {
		aElement.innerHTML = 'kommentek vissza';
		aElement.className = 'szerinted_vissza';
	} else {
		aElement.innerHTML = 'további kommentek';
		aElement.className = 'szerinted_tovabbi';
	}
	$('#article_more_comments_'+postId).toggle('slow');
}

function setScore(evt) {
	var starNum = $(evt.currentTarget).attr('rel');
	$('#ertekel_stars a').unbind('mouseover').unbind('click').bind('click', function() {return false;});
	$('#ertekel_stars').unbind('mouseout');
	for (var i=1; i<=starNum; i++) {
		$('#ertekel_star_'+i).addClass('old');
	}
	$('#post_score_input').val(starNum)[0].form.submit();
	clearScore();
	return false;
}

function clearScore() {
	$('#ertekel_stars a.hover').removeClass('hover');
}

function showScore(evt) {
	var starNum = $(evt.currentTarget).attr('rel');
	clearScore();
	for (var i=1; i<=starNum; i++) {
		$('#ertekel_star_'+i).addClass('hover');
	}
}

function setupScoreEvents() {
	$('#ertekel_stars').unbind().bind('mouseout', clearScore);
	$('#ertekel_stars a').unbind().bind('mouseover', showScore).bind('click', setScore);
}
