function SubmitQuiz(iTotalQuestions, sUrl) {
    
    for (i=1; i < (iTotalQuestions + 1); i++) {
        var aAnswers = document.getElementsByName(i + "-answer");
            
        var isValid = false;
        for (j=0; j < aAnswers.length; j++) {            
            if(aAnswers[j].checked) isValid = true;
        }
        
        if(!isValid) { 
            alert("You have not answered question " + i + "\nPlease answer the question and submit again");
            //if(aAnswers[j].focus) 
            aAnswers[0].focus();
            return false;
        }
    }
    
    if ((document.quiz.participantname.value).length > 0 | (document.quiz.participantemail.value).length > 0) {
        if (document.quiz.participantname.value != "" & document.quiz.participantemail.value != "") {
            document.quiz.action = sUrl;
            document.quiz.submit();
        }
        else {
            alert("You have not filled in both name and email! In order to participate in the competition you need to provide name and email!");
            document.quiz.participantname.focus();
            return false;
        }
        
    }
    else {
        document.quiz.action = sUrl;
        document.quiz.submit();
    } 
    
    
}