var number=0;
var onq=0;
var ans=false;
selectInput = new Array();
var answered = new Array();
var applause = new FlashSound();

var aww = new FlashSound();
    



    function checkit(qnum, useranswer){
    if (onq==number){
        number = qnum;
        onq=qnum;
        if(!answered[onq]){
            if (useranswer == answers[qnum-1]){
                answered[number]=true;
                correct();
            }//end if
            else{
                incorrect();
            }//end else
        }//end if
    }//end if
    }//end function checkit
    
    function checkSelect(qnum){
        number = qnum;
        if(document.select6.first.selectedIndex==selectanswers[0] && document.select6.second.selectedIndex==selectanswers[1] && document.select6.third.selectedIndex==selectanswers[2]){
            document.getElementById("check").style.display="none";
            answered[number]=true;
            onq = qnum;
            correct();
        }//end if
        else{
            incorrect();
        }//end else
    }//end function checkSelect
    
    function correct(){
        applause.TGotoAndPlay('/',1);
        document.getElementById("correct").style.display="block";
        onq=number;
        show();
    }//end function correct
    
    function incorrect(){
        aww.TGotoAndPlay('/',1);
        document.getElementById("question" + number).style.display="none";
        document.getElementById("errormsg" + number).style.display="block";
        document.getElementById("correct").style.display="none";
        document.getElementById("tryagain").style.display="block"
    }//end function incorrect
    
    function stay(){
        document.getElementById("errormsg" + number).style.display="none";
        document.getElementById("question" + number).style.display="block";
        document.getElementById("tryagain").style.display="none"
        hide();
    }//end function stay

    function stepforward(){
        
        if(onq==number){
            hide();
            document.getElementById("correct").style.display="none";
            document.getElementById("question" + number).style.display="none";
            document.getElementById("question" + (number + 1)).style.display="block";
            if (onq == (numProblems - 1)){
                document.getElementById("qarrows").style.display="none";
                document.getElementById("qnext").style.display="none";
                document.getElementById("qback").style.display="none";
                document.getElementById("arrows").style.display="block";
                document.getElementById("next").style.display="block";
                document.getElementById("back").style.display="block";
            }//end if
        }//end if
        else{
            document.getElementById("question" + onq).style.display="none";
            document.getElementById("question" + (onq + 1)).style.display="block";
            ++onq;
            show();
        }
    }//end function stepforward
    
    function stepback(){
        if (onq==2){
            document.getElementById("correct").style.display="block";
            document.getElementById("qback").style.display="none";
            document.getElementById("question" + onq).style.display="none";
            document.getElementById("question" + --onq).style.display="block";
        }//end if
        else{
            document.getElementById("question" + onq).style.display="none";
            document.getElementById("question" + --onq).style.display="block";
        }
    }//end function stepback
    
    function show(){
        if (number==1){
            document.getElementById("qarrows").style.display="block";
            document.getElementById("qnext").style.display="block";
        }//end if
        else if(onq == numProblems){
            hide();
        }//end else if
        else{
            document.getElementById("qarrows").style.display="block";
            document.getElementById("qnext").style.display="block";
            document.getElementById("qback").style.display="block";
        }//end else
    }//end function show
    
    function hide(){
        document.getElementById("qarrows").style.display="none";
        document.getElementById("qnext").style.display="none";
    }//end function show
