/**
 * 参考になりましたか。「はい」。
 */

/**
 * 参考になりましたか。「はい」。
 */
function CommunityResponse() {

    /**
     * 「はい」を送信する。
     *
     * @param reviewId  レビューID
     * @param targetElementId  送信後、非表示にする HTML 要素ID
     */
	this.send = function(reviewId, targetElementId) {

		$.ajax({
			url: 'api.php',
			type: 'GET',
			data: {
				'cmd': 'community_response',
				'review_id': reviewId
			},
			dataType: 'json',
			timeout: 5000,
			complete: function(data) {

				eval(data.responseText);
				
				if ( community_response['result'] != 'OK' ) {

						alert(community_response['message']);
						return;
				
				}

				$('#judge_'+reviewId).html('<button class=\"btn disabled\"><i class=\"icon-thumbs-up icon-white\"></i> 投票有難うございます。</button>');


			}

		});

	}
}



function CommunityResponse_s() {

    /**
     * 「はい」を送信する。
     *
     * @param reviewId  レビューID
     * @param targetElementId  送信後、非表示にする HTML 要素ID
     */
	this.send = function(reviewId, targetElementId) {

		var myAjax = new Ajax.Request(
			KAKEHASHI_API_URL,
			{
				method: 'GET',
				parameters: 'cmd=community_response&review_id=' + reviewId,
				onComplete: function(oXmlHttp) {
					eval(oXmlHttp.responseText);

					if ( community_response['result'] != 'OK' ) {
						showErrorMessage(community_response['error_code'], community_response['message']);
						return;
					}

					var oElement = $('judge_'+reviewId);
					oElement.innerHTML = '投票ありがとうございます。';

				}.bindAsEventListener(this, false)
			});
	}
}
