var num_qs_answered = 0;
var num_questions = 13;
var num_correct = 0;
var question = new Array();
var user_answers = new Array();

for(var i = 0; i <= num_questions; i++)
{

    question[i] = new Array();
    user_answers[i] = null;

}

question[1]['answer_text'] = "FICTION: Edgar Allan Poe was born on January 19, 1809 in Boston, Massachusetts, probably on Carver Street.";
question[1]['answer'] = false;

question[2]['answer_text'] = "FICTION: Poe was from Richmond, Virginia where he spent thirteen years of his life, he only lived in Baltimore for a few years.";
question[2]['answer'] = false;

question[3]['answer_text'] = "FACT";
question[3]['answer'] = true;

question[4]['answer_text'] = "FACT";
question[4]['answer'] = true;

question[5]['answer_text'] = "FICTION: Poe’s mother died about two weeks before the fire, and the date his father, who had already abandoned his family, died is unknown.";
question[5]['answer'] = false;

question[6]['answer_text'] = "FACT";
question[6]['answer'] = true;

question[7]['answer_text'] = "FACT";
question[7]['answer'] = true;

question[8]['answer_text'] = "FACT";
question[8]['answer'] = true;

question[9]['answer_text'] = "FICTION: Poe was dismissed from West Point for “Gross neglect of duty” and “Disobedience of Orders.”";
question[9]['answer'] = false;

question[10]['answer_text'] = "FACT";
question[10]['answer'] = true;

question[11]['answer_text'] = "FACT";
question[11]['answer'] = true;

question[12]['answer_text'] = "FICTION: while Poe was not wealthy his notoriety started during his time at the Southern Literary Messenger and continued throughout his life.";
question[12]['answer'] = false;

question[13]['answer_text'] = "FACT";
question[13]['answer'] = true;

function get_answer_text(index)
{
	
	if(index <= num_questions)
	{
	
		return question[index]['answer_text'];
		
	}
	else
	{
		
		alert('invalid index');
		
	}
	
}

function get_num_correct()
{
	
	
}

function set_num_correct()
{
	
	num_correct++;
	
}

function check_answer(input)
{
    question_index = input.name.replace("q", "");
    //alert(input)
    
    if(input.value == "fiction")
    {
    
        answer = false;
        
    }
    else
    {
    
        answer = true;
        
    }
    
    //alert("answer " + answer + " array: " + question[question_index]['answer'])
    if(user_answers[question_index] == null)
    {
    
        if(answer == question[question_index]['answer'])
        {
        
            num_correct++;
            update_results();
        
        }
        else
        {
        
            
            //show_answer_detail(question_index);
            
        }
        
        document.getElementById("a_" + question_index).innerHTML = question[question_index]['answer_text'];
        //alert(question[question_index]['answer_text']);
        document.getElementById("a_" + question_index).style.display = "block";
        
        user_answers[question_index] = "set";
        
    }
}

function update_results()
{
    
    result_el = document.getElementById('quiz_state');
    result_el.innerHTML = "Your Score: " + num_correct + "/" + num_questions;
    
}
