function wb_com_content() {
	var _this=this;
	this.rootUrl = '';
	this.init = function() {
	
		$('.comment_report').each(function(obj) {
			var strId = $(this).attr("id").replace(/comment_/ig,'');
			var strHtml = '<a id="comment_report_click_'+strId+'">&raquo; Beitrag melden</a>';
			$(this).html(strHtml);
			$('#comment_report_click_'+strId).click(function(obj) {
				_this.commentReport(strId);
			});
			
		});
	
	}
	
	this.commentReport = function(strCommentId) {
		var strLink = document.URL+'?pid=comment_report';
		var strReason=prompt("Bitte Kommentare nur melden, wenn er andere Menschen beleidigt, beschimpft oder diskriminiert, \noder Äußerungen enthält, die Gesetze verletzen (beispielsweise zu einer Straftat aufrufen).\n\nBitte nennen Sie den Grund für die Meldung:")
		if(strReason!='' && strReason!=null) {
			$.post(strLink,{comment_id:strCommentId,reason:strReason},function(json) {
				if(json.status) {
					alert("Kommentar wurde gemeldet!");
				}
			},"json");
		} else {
			if(strReason!=null) {
				alert("Sie müssen eine Begründung eingeben!");
			}
		}
		
	}
	
}

jQuery(function($) {
	$.wb_com_content = new wb_com_content();
	$.wb_com_content.init();
});

