
function startSurvey() {
	var conteudoSurvey = $('#survey-container');

	conteudoSurvey.load('survey.php', '', function () { ActiveLinkQuestion(); });
}


function ActiveLinkSurveys() {
	var conteudoSurvey = $('#survey-container');
		
	$('#survey-container a').click(function(event){  
		event.preventDefault();
		conteudoSurvey.load('survey.php', {s: this.id }, function () { ActiveLinkQuestion(); });
	});

}

function ActiveLinkQuestion() {
	var conteudoSurvey = $('#survey-container');

	$('#survey-container a').click(function(event){  
		event.preventDefault();
		conteudoSurvey.load('survey.php', {s: this.id }, function () { ActiveLinkQuestion(); });
	});

	$('#survey-container #survey a').click(function(event){  
		event.preventDefault();
		
			question_id = $('#question_id').val();
			resposta    = "";
			
			$('#survey input:radio').each(function() {
				if ( $(this).is(':checked') ) {
					resposta = $(this).val();
				}
			});
			
			if (resposta == "") {
				alert("Marque uma das respostas!");
				return false;
			}
			
			conteudoSurvey.load('survey.php', {s: this.id, q: $('#question_id').val(), a: resposta }, function () { ActiveLinkQuestion(); });
		
	});

}

function CloseSurveyGraph() {
	$('.BarTable').empty();
	$('.BarTable').css('display', 'none');
}
