/** article review */
(function ($, LOGA) {

$('.review_support').one('click', function() {
	var article_review_id = $(this).attr('article_review_id');
	$.getJSON(GV.URL.REVIEW_SUPPORT+'&'+Math.random(), {article_review_id:article_review_id}, function(data) {
		if(data.data == 1) {
			$('.review_support[article_review_id='+article_review_id+'] span').text(parseInt($('.review_support[article_review_id='+article_review_id+'] span').text()) + 1);
		}
		$('.review_support[article_review_id='+article_review_id+'],.review_oppose[article_review_id='+article_review_id+']').addClass('disabled').unbind();
		$('.review_support[article_review_id='+article_review_id+']').addClass('active');
	});
});
$('.review_oppose').one('click', function() {
	var article_review_id = $(this).attr('article_review_id');
	$.getJSON(GV.URL.REVIEW_OPPOSE+'&'+Math.random(), {article_review_id:article_review_id}, function(data) {
		if(data.data == 1) {
			$('.review_oppose[article_review_id='+article_review_id+'] span').text(parseInt($('.review_oppose[article_review_id='+article_review_id+'] span').text()) + 1);
		}
		$('.review_support[article_review_id='+article_review_id+'],.review_oppose[article_review_id='+article_review_id+']').addClass('disabled').unbind();
		$('.review_oppose[article_review_id='+article_review_id+']').addClass('active');
	});
});

$(document).on('click', '.review_reply', function() {
	var article_review_id = $(this).attr('article_review_id'),
		author = $('#author-'+article_review_id).html();

	$('#fromAddReview input[name="ar_qoute_id"]').val(article_review_id);
	$('#replyTip').html('<strong>'+LOGA.L('REPLY')+'</strong>: '+author+' <i class="icon-cannel pointer"></i>').show();
	document.getElementById('ar_content').focus();
})
.on('click', '#replyTip i', function() {
	$('#fromAddReview input[name="ar_qoute_id"]').val(0);
	$('#replyTip').hide();
});

})(jQuery, LOGA);
