total_points = 0; 

$(document).ready(function(){
	$('.results').hide();
	$('.correct_answer').hide();
	
  for (i = 1; i < 100; i++) {
	  if ($('#question_' + i)) {
			$('#question_' + i).hide();
		} else {
			break;
		}
  }	
});

function check_answer(question_id, value) {
	$('#question_' + question_id + ' ul').hide();
	if (value > 0) {
		$('#result_' + question_id + ' .correct_answer').prepend('CORRECT! ').addClass('correct');
		total_points += value;
		$('#progress').css('width',total_points * 30);
	} else {
		$('#result_' + question_id + ' .correct_answer').prepend('WRONG! ').addClass('wrong');
	}
	$('#result_' + question_id + ' .correct_answer').show();
	$('#result_' + question_id).show();

}

function transition(question_id) {

	$('#question_' + question_id).hide();	
	question_id++;
	if ($('#question_' + question_id).length > 0) {
		$('#question_' + question_id).show();			
	} else {
		$('#quiz_form #points').val(total_points);
		$('#quiz_form').submit();
	}
}

function show_html() {
	$('#html').hide();
	$('#html_code').show();
}