function showQuestionsModal() {
	var $modalBackground = $('<div class="modal-background"></div>').appendTo('body');
	var $modal = $('<div class="modal"></div>').css('height', '400px').appendTo('body');
	$modalBackground.animate({ opacity: .7 });
	$modal.animate({ marginTop: '-200px', top: '50%' }, function() {
		$('#reply-composer').focus();
	});

	$modalBackground.on('click', closeQuestionsModal);

	var groupId = $(this).attr('data-group-id');

	$.ajax({
        url: "/dashboard/" + groupId + "/details",
        type: "GET",
        success: function(data) {
        	var template = $('#modal-question').html();

        	data.groupId = groupId;

			$modal.html(Mustache.to_html(template, data));
			$('.modal-close-button').on('click', closeQuestionsModal);
    	},
	    dataType: "json",
    	timeout: 2000
    });

	return false;
}

function closeQuestionsModal() {
	var $modalBackground = $('.modal-background');
	var $modal = $('.modal');
	$modal.animate({ marginTop: '0', top: '100%' }, function() { $modal.remove() });
	$modalBackground.animate({ opacity: 0 }, function() { $modalBackground.remove() });

	return false;
}

function polling() {

	var eventId = parseInt($('body').attr('data-event-id'), 10);

    $.ajax({
        url: "/dashboard/event/" + eventId + "/polling",
        type: "GET",
        success: function(data) {

            // Update page
            $('.questions-overview .content .value').text(data.questionsNumber);
			$('.users-overview .content .value').text(data.usersOverview);
			$('.questions-list tbody').html('');

			data.unansweredQuestions.sort(function(a,b){return b.frequency-a.frequency});

			jQuery.each(data.unansweredQuestions, function(index, value) {

				if(value.sentiment === 'positive') {
					data.totalPositive++;
					sentiment = 'green';
				} else {
					if(value.sentiment === 'negative') {
						data.totalNegative++;
						sentiment = 'red';
					} else {
						data.totalNeutral++;
						sentiment = 'grey';
					}
				}

				$('.questions-list tbody').append('<tr data-group-id="' + value.id + '">\
					<td class="sentiment ' + sentiment + '"></td>\
					<td class="question">' + value.question + '</td>\
		            <td class="frequency"><span>' + value.frequency + '</span></td>\
		        </tr>');
			});

			$('.positive').text('+' + data.totalPositive);
			$('.neutral').text(data.totalNeutral);
			$('.negative').text('-' + data.totalNegative);

			$('.questions-list tbody tr').on('click', showQuestionsModal);
        },
        dataType: "json",
        complete: setTimeout(function() { polling() }, 5000),
        timeout: 2000
    })
}


$(document).ready(function() {
	polling();
	$('.questions-list tbody tr').on('click', showQuestionsModal);

	$('#reply-button').on('click', function(){
		var groupId = $(this).attr('data-group-id');

		$.ajax({
	        url: "/dashboard/" + groupId + "/reply",
	        type: "POST",
	        data: {
	        	message: $('#reply-composer').val()	
	        },
	        success: function(data){
				closeQuestionsModal();
	        },
		    dataType: "json",
	    	timeout: 2000
	    });
	});
});#
@@ -647,16 +647,48 @@
 oupId;%0A%0A
+        %09console.log(groupId);%0A%0A
 %09%09%09$moda
@@ -786,24 +786,459 @@
 tionsModal);
+%0A%0A%09%09%09$('#reply-button').on('click', function()%7B%0A%09%09%09%09var groupId = $(this).attr('data-group-id');%0A%09%09%09%09console.log('a');%0A%09%09%09%09$.ajax(%7B%0A%09%09%09        url: %22/dashboard/%22 + groupId + %22/reply%22,%0A%09%09%09        type: %22POST%22,%0A%09%09%09        data: %7B%0A%09%09%09        %09message: $('#reply-composer').val()%09%0A%09%09%09        %7D,%0A%09%09%09        success: function(data)%7B%0A%09%09%09%09%09%09closeQuestionsModal();%0A%09%09%09        %7D,%0A%09%09%09%09    dataType: %22json%22,%0A%09%09%09    %09timeout: 2000%0A%09%09   %09%09%7D);%0A%09%09%09%7D);
 %0A    %09%7D,%0A%09  
@@ -3200,389 +3200,8 @@
 ;%0A%0A%09
-$('#reply-button').on('click', function()%7B%0A%09%09var groupId = $(this).attr('data-group-id');%0A%0A%09%09$.ajax(%7B%0A%09        url: %22/dashboard/%22 + groupId + %22/reply%22,%0A%09        type: %22POST%22,%0A%09        data: %7B%0A%09        %09message: $('#reply-composer').val()%09%0A%09        %7D,%0A%09        success: function(data)%7B%0A%09%09%09%09closeQuestionsModal();%0A%09        %7D,%0A%09%09    dataType: %22json%22,%0A%09    %09timeout: 2000%0A%09    %7D);%0A%09%7D);
 %0A%7D);

Update NLP thingie