/* quiz_template13.js
    Requires JavaScript1.2 or later
    (c) 1999, 2000, 2001 by L.W. Haynes, all rights reserved.
    Permission is granted to reuse, redistribute and modify so long as this copyright notice is retained.
    If you redistribute this code, please comment your additions.
    http://members.home.net/lwhaynes
    Only a single copy of this file is needed per site
*/
/**********************************************************************************************************************/
// constructor for multiple choice questions
// do not modify
// The fixed parameters are:
//  qtext: the text of the question
//  answer: the index (a, b, c ...) of the correct answer
//  comment: text printed if the question is answered incorrectly
//  shuffle_range: the number of answers (starting with the first) to be shuffled (use 0 for no shuffling)
//  atext: the first answer.
// Subsequent answers may be added as additional (unnamed) parameters
function mcQuestion(qtext, answer, comment, shuffle_range, atext)
{
var count1;
this.ordinal = 0;
this.qText = qtext;                                                 // the question text
this.comment = comment;                                             // printed if student chooses incorrect answer
if (shuffle_range > arguments.length - 4)
    shuffle_range = arguments.length - 4;
this.shuffleRange = shuffle_range;                                  // number of choices to shuffle, starting at 0
this.correctAnswer = new Array(arguments.length - 4);               // array of bool
for (count1 = 0; count1 < arguments.length - 4; count1++)
    this.correctAnswer[count1] = false;
this.correctAnswer[answer.charCodeAt(0) - 97] = true;               // 'a' == 97
this.aText = new Array(arguments.length - 4);
for (count1 = 0; count1 < arguments.length - 4; count1++)
    this.aText[count1] = arguments[count1 + 4];                     // copy the answer choices
this.indexes = new Array(arguments.length - 4);
for (count1 = 0; count1 < arguments.length - 4; count1++)
    this.indexes[count1] = count1;
this.element = null;                                                // the form element to be checked: array of radio buttons
}

mcQuestion.prototype.type = 'mc';

/**********************************************************************************************************************/
mcQuestion.prototype.toString = function()
{
return '[mcQuestion Object]';
}
/**********************************************************************************************************************/
// a method to write multiple choice questions
// do not modify
mcQuestion.prototype.write = function(qz)
{
var item = null;
this.shuffle(qz);
document.writeln(this.ordinal, '. ', this.qText, '<br>');
for (var count1 = 0; count1 < this.aText.length; count1++)
    {
    item = String.fromCharCode(97 + count1);                            // 'a' == 97
    document.writeln('<input type="radio" name="Q', this.ordinal, '" value="', item, '">', item, '. ', this.aText[this.indexes[count1]], '<br />');
    }
if (document.getElementsByName)                                         // remove when dom version complete
    this.element = document.getElementsByName('Q' + this.ordinal);
else
    this.element = eval('document.' + qz.theForm + '.Q' + this.ordinal); // the form element to be checked: array of radio buttons
}
/**********************************************************************************************************************/
// a method to write the incorrect answer for a multiple choice question
// do not modify
mcQuestion.prototype.writeError = function(qz)
{
var text = '';
if (this.element != null)
    {
    for (var count1 = 0; count1 < this.element.length; count1++)
        {
        if (this.element[count1].checked == true)
            {
            if (this.correctAnswer[this.indexes[count1]] == true)
                return text;
            else
                {                                                       // write out the question and answers
                var item = null;
                text += '<div>' + this.ordinal + '. ' + this.qText + '<br>\n';  // can't use <p> because qText may contain block elements
                for (var count2 = 0; count2 < this.aText.length; count2++)
                    {
                    item = String.fromCharCode(97 + count2);
                    if (count2 == count1)                               // students incorrect answer
                        text += '<img alt="Incorrect answer" height="16" width="16" title="Incorrect answer" src="' + qz.imagePath + 'quiz_incorrect.gif">';
                    else if (this.correctAnswer[this.indexes[count2]] == true) // the correct answer
                        text += '<img alt="Correct answer" height="16" width="16" title="Correct answer" src="' + qz.imagePath + 'quiz_correct.gif">';
                    else
                        text += '<img height="16" width="16" src="' + qz.imagePath + 'quiz_blank.gif">';
                    text += item + '. ' + this.aText[this.indexes[count2]] + '<br>\n';
                    }
                text += this.comment + '<br><br></div>\n';
                return text;
                }
            }
        }
    // fall through if no selection has been made
    text += '<div>' + this.ordinal + '. ' + this.qText + '<br>Your answer was <b>(none selected)';
    text += '</b><br>\n' + this.comment + '<br><br></div>\n';
    }
return text;
}
/**********************************************************************************************************************/
// a method to find if the answer to a multiple choice question was correct
// do not modify
mcQuestion.prototype.isCorrect = function()
{
if (this.element != null)
    {
    for (var count1 = 0; count1 < this.element.length; count1++)
        {
        if (this.element[count1].checked == true && this.correctAnswer[this.indexes[count1]] == true)
            return 1;
        }
    }
return 0;
}
/**********************************************************************************************************************/
// a method to find if a multiple choice question has been answered
// do not modify
mcQuestion.prototype.isBlank = function()
{
if (this.element != null)
    {
    for (var count1 = 0; count1 < this.element.length; count1++)
        {
        if (this.element[count1].checked == true)
            return false;
        }
    }
return true;
}
/**********************************************************************************************************************/
// a method to return the number of subquestions in the question
// do not modify
mcQuestion.prototype.number = function()
{
return 1;
}
/**********************************************************************************************************************/
// a method to shuffle the multiple choices
// do not modify
mcQuestion.prototype.shuffle = function(qz)
{
var count1;
var use_cookie = false;
var cookie_name = escape(qz.quizName) + '=';
if (document.cookie.length > 0)
    {
    var pos = document.cookie.indexOf(cookie_name);
    if (pos != -1)
        use_cookie = true;
    }
if (use_cookie)
    {                                                               // the cookie exists
    var start = pos + cookie_name.length;                           // starting after the '='
    var end = document.cookie.indexOf(';', start);                  // ending before the ';'
    if (end == -1)
        end = document.cookie.length;
    var text = unescape(document.cookie.substring(start, end));     // extract the data
    var values = text.split(',');
    for (count1 = 0; count1 < values.length; count1++)
        {
        if (qz.questions[qz.indexes[count1]] == this)
            {
            var subvalues = values[count1].split('_');
            for (var count2 = 1; count2 < subvalues.length; count2++)
                this.indexes[count2 - 1] = parseInt(subvalues[count2]);
            }
        }
    }
else
    {
    if (this.shuffleRange > 1)
        {
        var temp = 0;
        var index = 0;
        for (var count1 = 0; count1 < this.shuffleRange; count1++)
            {
            index = Math.floor(Math.random() * this.shuffleRange);
            temp = this.indexes[count1];
            this.indexes[count1] = this.indexes[index];
            this.indexes[index] = temp;
            }
        }
    }
}
/**********************************************************************************************************************/
/**********************************************************************************************************************/
// constructor for short answer questions
// do not modify
// ASSUMPTION: there are no consecutive question or answer elements.  Each alternates with the other
// The fixed parameters are:
//  qfirst: true if a question element comes first, otherwise an answer element comes first
//  numquestions: the number of question elements
//  numanswers: the number of answer elements
// all question elements, then all answer elements, then all comment elements (one per answer, optional) are appended as
// additional (unnamed) parameters
function saQuestion(qfirst, numquestions, numanswers)
{
this.qFirst = qfirst;
this.ordinal = 0;
this.qText = new Array(numquestions);                               // the question text
this.aText = new Array(numanswers);                                 // the answer text
this.cText = new Array(numanswers);                                 // the comment text
if (arguments.length >= 3 + numquestions)
    {
    for (var count1 = 0; count1 < numquestions; count1++)
        this.qText[count1] = arguments[count1 + 3];                 // copy the question text elements
    if (arguments.length >= 3 + numquestions + numanswers)
        { 
        for (count1 = 0; count1 < numanswers; count1++)
            this.aText[count1] = arguments[count1 + 3 + numquestions];  // copy the answer text elements
        if (arguments.length >= 3 + numquestions + numanswers + numanswers)
            {
            for (count1 = 0; count1 < numanswers; count1++)
                this.cText[count1] = arguments[count1 + 3 + numquestions + numanswers];  // copy the comment text elements
            }
        }
    }
this.element = new Array();
}

saQuestion.prototype.type = 'sa';

/**********************************************************************************************************************/
saQuestion.prototype.toString = function()
{
return '[saQuestion Object]';
}
/**********************************************************************************************************************/
// a method to write short answer questions
// do not modify
saQuestion.prototype.write = function(qz)
{
if (this.qText != null && this.aText != null)
    {
    var name;
    var count1;
    var maxcount = this.qText.length;
    if (this.aText.length < maxcount)
        maxcount = this.aText.length;
    document.write(this.ordinal, '.  ');
    if (this.qFirst == true)
        {
        for (count1 = 0; count1 < maxcount; count1++)
            {
            name = 'Q' + this.ordinal + String.fromCharCode(97 + count1);  // 'a' == 97
            document.writeln(this.qText[count1]);
            document.writeln('<input type="text" name="', name, '" id="', name, '" value="">');
            }
        if (this.qText.length > maxcount)
            document.writeln(this.qText[count1]);
        document.writeln('<br>');
        }
    else
        {
        for (count1 = 0; count1 < maxcount; count1++)
            {
            name = 'Q' + this.ordinal + String.fromCharCode(97 + count1);  // 'a' == 97
            document.writeln('<input type="text" name="', name, '" id="', name, '" value="">');
            document.writeln(this.qText[count1]);
            }
        if (this.aText.length > maxcount)
            {
            name = 'Q' + this.ordinal + String.fromCharCode(97 + count1);  // 'a' == 97
            document.writeln('<input type="text" name="', name, '" id="', name, '" value="">');
            }
        document.writeln('<br>');
        }
    if (document.getElementById)                                    // remove when dom version complete
        {
        var obj;
        for (count1 = 0; count1 < this.aText.length; count1++)
            {
            name = 'Q' + this.ordinal + String.fromCharCode(97 + count1);  // 'a' == 97
            this.element[count1] = document.getElementById(name);
            }
        }
    else
        {
        for (count1 = 0; count1 < this.aText.length; count1++)
            this.element[count1] = eval('document.' + qz.theForm + '.Q' + this.ordinal + String.fromCharCode(97 + count1));
        }
    }
}
/**********************************************************************************************************************/
// a method to write the incorrect answer for a short answer question
// do not modify
saQuestion.prototype.writeError = function()
{
var text = ''
if (this.qText != null && this.aText != null)
    {
    var count1;
    var element;
    var bad_answer = false;
    var re = new RegExp(this.aText[0]);
    for (count1 = 0; count1 < this.aText.length; count1++)
        {
        re.compile(this.aText[count1]);
        if (re.exec(this.element[count1].value) == null)
            bad_answer = true;
        }
    if (bad_answer)
        {
        var correct_answer;
        var maxcount = this.qText.length;
        if (this.aText.length < maxcount)
            maxcount = this.aText.length;
        text += '<div>' + this.ordinal + '.  ';
        if (this.qFirst == true)
            {
            for (count1 = 0; count1 < maxcount; count1++)
                {
                re.compile(this.aText[count1]);
                text += this.qText[count1];
//                correct_answer = this.aText[count1].substring(1, this.aText[count1].length - 1);
                correct_answer = this.extractPattern(count1);
                if (re.exec(this.element[count1].value) == null)
                    {
                    text += '<u>&nbsp;<font color="#FF0000"><s>';
                    text += this.element[count1].value.length ? this.element[count1].value : '(blank)';
                    text += '</s></font>&nbsp;' + correct_answer + '&nbsp;</u>';
                    if (this.cText[count1] != null)
                        text += '[' + this.cText[count1] + ']';
                    }
                else
                    text += '<u>&nbsp;' + correct_answer + '&nbsp;</u>';
                }
            if (this.qText.length > maxcount)
                text += this.qText[count1];
            text += '<br><br></div>\n';
            }
        else
            {
            for (count1 = 0; count1 < maxcount; count1++)
                {
                re.compile(this.aText[count1]);
//                correct_answer = this.aText[count1].substring(1, this.aText[count1].length - 1);
                correct_answer = this.extractPattern(count1);
                if (re.exec(this.element[count1].value) == null)
                    {
                    text += '<u>&nbsp;<font color="#FF0000"><s>';
                    text += this.element[count1].value.length ? this.element[count1].value : '(blank)';
                    text += '</s></font>&nbsp;' + correct_answer + '&nbsp;</u>';
                    if (this.cText[count1] != null)
                        text += '[' + this.cText[count1] + ']';
                    }
                else
                    text += '<u>&nbsp;' + correct_answer + '&nbsp;</u>';
                text += this.qText[count1];
                }
            if (this.aText.length > maxcount)
                {
                re.compile(this.aText[count1]);
//                correct_answer = this.aText[count1].substring(1, this.aText[count1].length - 1);
                correct_answer = extractPattern(this.aText[count1]);
                if (re.exec(this.element[count1].value) == null)
                    {
                    text += '<u>&nbsp;<font color="#FF0000"><s>';
                    text += this.element[count1].value.length ? this.element[count1].value : '(blank)';
                    text += '</s></font>&nbsp;' + correct_answer + '&nbsp;</u>';
                    if (this.cText[count1] != null)
                        text += '[' + this.cText[count1] + ']';
                    }
                else
                    text += '<u>&nbsp;' + correct_answer + '&nbsp;</u>';
                }
            text += '<br><br></div>\n';
            }
        }
    }
return text;
}
/**********************************************************************************************************************/
saQuestion.prototype.extractPattern = function(index)
{
var base = this.aText[index].replace(/\\s\+/g, ' ');                // replace white space with single space
base = base.replace(/\\s/g, ' ');
base = base.replace(/\?/g, '');                                     // replace '?' with nothing
if (base.charAt(0) == '^')
    base = base.substring(1, base.length - 1);                      // discard leading '^' and trailing '$'
var choices = base.split('|');                                      // array of possible matching words
var output = "";
for (var count1 = 0; count1 < choices.length; count1++)
    {
    if (choices[count1].charAt(0) == '(')
        base = choices[count1].substring(1, choices[count1].length - 1);    // kill '(' and ')'
    else
        base = choices[count1];
    var index1 = base.indexOf('[')
    if (index1 != -1)
        {
        if (index1 > 0)
            output += base.substring(0, index1);                    // copy leading characters
        while (index1 != -1)
            {
            output += base.charAt(index1 + 1);                      // use first char of [xxxx] set
            index2 = base.indexOf(']', index1 + 1);
            index1 = base.indexOf('[', index2 + 1);                 // find next '['
            if (index1 != -1)
                {                                                   // if found
                if (index2 + 1 < index1)                            // and not adjacent ']['
                    output += base.slice(index2 + 1, index1);       // copy stuff between
                }
            else if (index2 < base.length - 1)                      // not found and trailing stuff
                output += base.slice(index2 + 1);
            }
        }
    else
        output += base;
    if (count1 < choices.length - 1)
        output += ' <i>or</i> ';
    }
return output;
}
/**********************************************************************************************************************/
// a method to find if the answer to a short answer question was correct
// do not modify
saQuestion.prototype.isCorrect = function()
{
var num_correct = 0;
var re = new RegExp(this.aText[0]);
for (var count1 = 0; count1 < this.aText.length; count1++)
    {
    re.compile(this.aText[count1]);
    if (!this.element[count1] && document.getElementById)           // remove when dom version complete
        {
        name = 'Q' + this.ordinal + String.fromCharCode(97 + count1);  // 'a' == 97
        this.element[count1] = document.getElementById(name);
        }
    if (re.exec(this.element[count1].value) != null)
        num_correct++;
    }
return num_correct;
}
/**********************************************************************************************************************/
// a method to find if a short answer question has been answered
// do not modify
saQuestion.prototype.isBlank = function()
{
for (var count1 = 0; count1 < this.aText.length; count1++)
    {
    if (this.element[count1].value.length == 0)
        return true;
    }
return false;
}
/**********************************************************************************************************************/
// a method to determine the number of subquestions in the question
// do not modify
saQuestion.prototype.number = function()
{
return this.aText.length;
}
/**********************************************************************************************************************/
/**********************************************************************************************************************/
// constructor for the Quiz object
// do not modify
function Quiz(quiz_name, background, image_path, backcolor, textcolor, shuffle_questions, num_questions, var_name, form_name)
{
if (quiz_name)
    this.quizName = quiz_name;
else
    this.quizName = "Quiz";
if (background)
    this.bgImage = background;
else
    this.bgImage = null;
if (image_path)
    this.imagePath = image_path;
else
    this.imagePath = null;
if (backcolor)
    this.bgColor = backcolor;
else
    this.bgColor = 'white';
if (textcolor)
    this.textColor = textcolor;
else
    this.textColor = 'black';
if (shuffle_questions)
    this.shuffleQuestions = shuffle_questions;
else
    this.shuffleQuestions = false;
if (num_questions)
    this.numQuestions = num_questions;
else
    this.numQuestions = 1;
if (var_name)
    this.varName = var_name;
else
    this.varName = 'quiz';
if (form_name)
    this.theForm = form_name;
else
    this.theForm = 'theQuiz';
this.feedbackWin = null;
this.qOrder = '';
}
/**********************************************************************************************************************/
// event handler
// Ordinarily, you would modify the return value to true if the form is to be mailed to instructor, but this function
// never actually returns, since its document and form is destroyed.  Instead, uncomment the submit() method and comment
// out the "Change answers" button.
Quiz.prototype.correctQuiz = function (myForm)
{
this.setCookie();

//IGOR>>>
//{
//    if (textarea.E-mail.isBlank())
//        {
//        alert("One or more questions have not been answered.\nPlease answer all of the questions //and try again.");
//        return false;
//        }
//    }
//<<<IGOR



// if blank answeres are not allowed, uncomment this section.  Note: this only checks quiz questions, not added form elements

for (var count1 = 0; count1 < this.numQuestions; count1++)        // find blank answers
    {
    if (this.questions[this.indexes[count1]].isBlank())
        {
        alert("One or more questions have not been answered.\nPlease answer all of the questions and try again.");
        return false;
        }
    }



var num_correct = 0;
var num_answers = 0;
for (var count1 = 0; count1 < this.numQuestions; count1++)        // count correct answers
    {
    num_correct += this.questions[this.indexes[count1]].isCorrect();
    num_answers += this.questions[this.indexes[count1]].number();
    }
var percentage = Math.round(num_correct / num_answers * 10000) / 100;
myForm.score.value = percentage;
myForm.qorder.value = this.qOrder;
myForm.submit();                                                // uncomment this to have the form emailed to you (or otherwise processed)
// return false;                                                    // uncomment this to prevent user from receiving feedback
new_page = '<html>\n<head>\n<title>Corrections</title>\n<script language="JavaScript">\n';
new_page += 'var quiz_name = "' + this.quizName + '";\n';
new_page += 'function kill_cookie()\n{\nif (document.cookie.indexOf(escape(quiz_name) + "=") != -1)\n';
new_page += '    {\n    var now = new Date();\n    var expires = new Date(now.getTime - 5000);\n';
new_page += '    document.cookie = escape(quiz_name) + "=no; EXPIRES=" + expires.toUTCString();\n    }\n}\n';
new_page += '</script>\n</head>\n<body ';
if (this.bgImage != null)
    new_page += 'background="' + this.bgImage + '" ';
new_page += 'bgcolor="' + this.bgColor + '" text="' + this.textColor + '">\n';
new_page += '<center><h1>' + this.quizName + '</h1></center>\n' +
           '<p>You gave ' + num_correct + ' correct answers out of ' + num_answers + ' questions (' + percentage +
           '%).  '
if (percentage >= 80)
    new_page += 'Well done. Congratulations! </p>\n';
else if (percentage >= 60)
    new_page += 'You need to work a bit more on these topics.</p>\n';
else
    new_page += 'You have serious difficulty with this material. </p>\n';
if (num_correct != num_answers)
    {                                                               // write incorrect elements with correct answers
    new_page += '<p><b> Please hit "Refresh" if the diagrams are not displayed properly! Also, make sure that you provided accurate information and hit "ok" on the previous screen. Otherwise, simply hit "Back" button and fill in all of the missing information. Please do not change your answers, there is no point in cheating as I will not be able to assess your skills appropriately and offer valuable advise! Try harder next week! If you have not done this yet, please try my <a href="../test_1.htm" target="_blank"><font size="4">Free Evaluation Test.</a> </b></p>';

    new_page += '<p>You gave incorrect answers to the following questions: </p>';
    for (count1 = 0; count1 < this.numQuestions; count1++)
        {
        new_page += this.questions[this.indexes[count1]].writeError(this);
        }
    }
new_page += '<br>\n<form>';
if (this.varName != 'quiz')
    {
    new_page += '<input type="button" value="Change answers" alt="Change answers" onclick="window.close();">&nbsp;';
    new_page += '<input type="button" value="Finished" alt="Finished" onclick="kill_cookie();';
    new_page += 'window.close();history.go(-1);">\n';
    new_page += '</form>\n</body>\n</html>\n';
    if (this.feedbackWin != null && !this.feedbackWin.closed)
        this.feedbackWin.close();
    this.feedbackWin = window.open('', 'AnsWin', 'height=' + getInsideWindowHeight() + ',width=' + getInsideWindowWidth() + ',scrollbars');
    this.feedbackWin.document.write(new_page);
    this.feedbackWin.document.close();                                  // close document
    }
else
    {
    if (document.cookie.indexOf(escape(this.quizName)) != -1)
        new_page += '<input type="button" value="Change answers" alt="Change answers" onclick="history.go(-1);">&nbsp;';
    new_page += '<input type="button" value="Finished" alt="Finished" onclick="kill_cookie(); history.go(-2);">\n';
    new_page += '</form>\n</body>\n</html>\n';
    document.write(new_page);
    document.close();                                                   // close document
    }
return false;
}
/**********************************************************************************************************************/
Quiz.prototype.setCookie = function()
{
var text = '';
for (var count1 = 0; count1 < this.numQuestions; count1++)
    {
    text += this.indexes[count1];
    var question = this.questions[this.indexes[count1]];
    if (question.type == 'mc' && question.shuffleRange > 0)
        {
        for (var count2 = 0; count2 < question.indexes.length; count2++)
            {
            text += '_' + question.indexes[count2];
            }
        }
    if (count1 < this.numQuestions - 1)
        text += ',';
    }
this.qOrder = text;
document.cookie = escape(this.quizName) + '=' + escape(text);
}
/**********************************************************************************************************************/
Quiz.prototype.shuffle = function()
{
var count1;
var use_cookie = false;
var cookie_name = escape(this.quizName) + '=';
if (document.cookie.length > 0)
    {
    var pos = document.cookie.indexOf(cookie_name);
    if (pos != -1)
        use_cookie = true;
    }
if (use_cookie)
    {                                                               // the cookie exists
    var start = pos + cookie_name.length;                           // starting after the '='
    var end = document.cookie.indexOf(';', start);                  // ending before the ';'
    if (end == -1)
        end = document.cookie.length;
    var text = unescape(document.cookie.substring(start, end));     // extract the data
    var values = text.split(',');
    this.indexes = new Array(values.length);                        // only as long as the data written
    for (count1 = 0; count1 < values.length; count1++)
        this.indexes[count1] = parseInt(values[count1]);
    }
else
    {
    this.indexes = new Array(this.questions.length);                // long enough for all the questions
    for (count1 = 0; count1 < this.questions.length; count1++)
        this.indexes[count1] = count1;
    if (this.shuffleQuestions == true)
        {
        var temp = 0;
        var index = 0;
        for (var count1 = 0; count1 < this.questions.length; count1++)
            {
            index = Math.floor(Math.random() * this.questions.length);
            temp = this.indexes[count1];
            this.indexes[count1] = this.indexes[index];
            this.indexes[index] = temp;
            }
        }
    }
}
/**********************************************************************************************************************/
Quiz.prototype.toString = function()
{
return '[Quiz Object]';
}
/**********************************************************************************************************************/
Quiz.prototype.unload = function()
{
if (this.feedbackWin != null && !this.feedbackWin.closed)
    this.feedbackWin.close();
}
/**********************************************************************************************************************/
// MODIFY mailto: address if form is to be mailed to instructor
// If a CGI script is used for processing, modify action and possibly method (to "get")
Quiz.prototype.write = function()
{
document.writeln('<center><h1>' + this.quizName + '</h1></center>');
document.write('<form name="', this.theForm, '" action="mailto:i_key@yahoo.com" method="post" enctype="text/plain" ');
document.writeln('onsubmit="return ', this.varName, '.correctQuiz(this);">');
document.writeln('<input id="score" name="score" value="0" type="hidden">');
document.writeln('<input id="qorder" name="qorder" value="" type="hidden">');


//IGOR
//>>>>>>
// Add any necessary static form elements here if they come before the questions
document.writeln('<labelarea rows="1" cols="15" name="Label0"><font color="#FF0000"><font size="4">5 Positions - 10 Questions! Level of difficulty varies! Take your time in answering each question! Use chessboard if you have it available. Also, make sure you have provided accurate info, so your scores can be tracked, valuable training recommendations can be provided and your progress can be evaluated over time. </font></font></textarea>');
document.writeln('<br>')
document.writeln('<br>')
document.writeln('<labelarea rows="1" cols="15" name="Label1">Name </textarea>');
document.writeln('<textarea rows="1" cols="15" name="Name"></textarea>');
document.writeln('<br>')
document.writeln('<labelarea rows="1" cols="15" name="Label2">E-mail </textarea>');
document.writeln('<textarea rows="1" cols="15" name="Email"></textarea>');
document.writeln('<br>')

document.writeln('<labelarea rows="1" cols="15" name="Label3">Country </textarea>');
document.writeln('<select name="Country">');

document.writeln('<OPTION VALUE = "">&lt;Select One&gt;<OPTION VALUE ="US">USA</OPTION><OPTION VALUE ="AF">Afghanistan</OPTION><OPTION VALUE = "AL">Albania</OPTION><OPTION VALUE = "DZ">Algeria</OPTION><OPTION VALUE = "AS">American Samoa</OPTION><OPTION VALUE = "AD">Andorra</OPTION><OPTION VALUE = "AO">Angola</OPTION><OPTION VALUE = "AI">Anguilla</OPTION><OPTION VALUE = "AQ">Antarctica</OPTION><OPTION VALUE = "AG">Antigua</OPTION><OPTION VALUE = "AR">Argentina</OPTION><OPTION VALUE = "AM">Armenia</OPTION><OPTION VALUE = "AW">Aruba</OPTION><OPTION VALUE = "AU">Australia</OPTION><OPTION VALUE = "AT">Austria</OPTION><OPTION VALUE = "AZ">Azerbaijan</OPTION><OPTION VALUE = "BS">Bahamas</OPTION><OPTION VALUE = "BH">Bahrain</OPTION><OPTION VALUE = "BD">Bangladesh</OPTION><OPTION VALUE = "BB">Barbados</OPTION><OPTION VALUE = "AG">Barbuda</OPTION><OPTION VALUE = "BY">Belarus</OPTION><OPTION VALUE = "BE">Belgium</OPTION><OPTION VALUE = "BZ">Belize</OPTION><OPTION VALUE = "BJ">Benin</OPTION><OPTION VALUE = "BM">Bermuda</OPTION><OPTION VALUE = "BT">Bhutan</OPTION><OPTION VALUE = "BO">Bolivia</OPTION><OPTION VALUE = "BA">Bosnia</OPTION><OPTION VALUE = "BW">Botswana</OPTION><OPTION VALUE = "BV">Bouvet Island</OPTION><OPTION VALUE = "BR">Brazil</OPTION><OPTION VALUE = "IO">British Indian Ocean Trty.</OPTION><OPTION VALUE = "BN">Brunei Darussalam</OPTION><OPTION VALUE = "BG">Bulgaria</OPTION><OPTION VALUE = "BF">Burkina Faso</OPTION><OPTION VALUE = "BI">Burundi</OPTION><OPTION VALUE = "TC">Caicos Islands</OPTION><OPTION VALUE = "KH">Cambodia</OPTION><OPTION VALUE = "CM">Cameroon</OPTION><OPTION VALUE = "CA">Canada</OPTION><OPTION VALUE = "CV">Cape Verde</OPTION><OPTION VALUE = "KY">Cayman Islands</OPTION><OPTION VALUE = "CF">Central African Republic</OPTION><OPTION VALUE = "TD">Chad</OPTION><OPTION VALUE = "CL">Chile</OPTION><OPTION VALUE = "CN">China</OPTION><OPTION VALUE = "CX">Christmas Island</OPTION><OPTION VALUE = "CC">Cocos (Keeling) Islands</OPTION><OPTION VALUE = "CO">Colombia</OPTION><OPTION VALUE = "KM">Comoros</OPTION><OPTION VALUE = "CG">Congo</OPTION><OPTION VALUE = "CK">Cook Islands</OPTION><OPTION VALUE = "CR">Costa Rica</OPTION><OPTION VALUE = "CI">Cote DIvoire</OPTION><OPTION VALUE = "HR">Croatia</OPTION><OPTION VALUE = "CU">Cuba</OPTION><OPTION VALUE = "CY">Cyprus</OPTION><OPTION VALUE = "CZ">Czech Republic</OPTION><OPTION VALUE = "DK">Denmark</OPTION><OPTION VALUE = "DJ">Djibouti</OPTION><OPTION VALUE = "DM">Dominica</OPTION><OPTION VALUE = "DO">Dominican Republic</OPTION><OPTION VALUE = "TP">East Timor</OPTION><OPTION VALUE = "EC">Ecuador</OPTION><OPTION VALUE = "EG">Egypt</OPTION><OPTION VALUE = "SV">El Salvador</OPTION><OPTION VALUE = "GQ">Equatorial Guinea</OPTION><OPTION VALUE = "ER">Eritrea</OPTION><OPTION VALUE = "EE">Estonia</OPTION><OPTION VALUE = "ET">Ethiopia</OPTION><OPTION VALUE = "FK">Falkland Islands (Malvinas)</OPTION><OPTION VALUE = "FO">Faroe Islands</OPTION><OPTION VALUE = "FJ">Fiji</OPTION><OPTION VALUE = "FI">Finland</OPTION><OPTION VALUE = "FR">France</OPTION><OPTION VALUE = "FX">France, Metropolitan</OPTION><OPTION VALUE = "GF">French Guiana</OPTION><OPTION VALUE = "PF">French Polynesia</OPTION><OPTION VALUE = "TF">French Southern Territories</OPTION><OPTION VALUE = "WF">Futuna Islands</OPTION><OPTION VALUE = "GA">Gabon</OPTION><OPTION VALUE = "GM">Gambia</OPTION><OPTION VALUE = "GE">Georgia</OPTION><OPTION VALUE = "DE">Germany</OPTION><OPTION VALUE = "GH">Ghana</OPTION><OPTION VALUE = "GI">Gibraltar</OPTION><OPTION VALUE = "GR">Greece</OPTION><OPTION VALUE = "GL">Greenland</OPTION><OPTION VALUE = "GD">Grenada</OPTION><OPTION VALUE = "GP">Guadeloupe</OPTION><OPTION VALUE = "GU">Guam</OPTION><OPTION VALUE = "GT">Guatemala</OPTION><OPTION VALUE = "GN">Guinea</OPTION><OPTION VALUE = "GW">Guinea-Bissau</OPTION><OPTION VALUE = "GY">Guyana</OPTION><OPTION VALUE = "HT">Haiti</OPTION><OPTION VALUE = "HM">Heard</OPTION><OPTION VALUE = "BA">Herzegovina</OPTION><OPTION VALUE = "HN">Honduras</OPTION><OPTION VALUE = "HK">Hong Kong</OPTION><OPTION VALUE = "HU">Hungary</OPTION><OPTION VALUE = "IS">Iceland</OPTION><OPTION VALUE = "IN">India</OPTION><OPTION VALUE = "ID">Indonesia</OPTION><OPTION VALUE = "IR">Iran (Islamic Republic of)</OPTION><OPTION VALUE = "IQ">Iraq</OPTION><OPTION VALUE = "IE">Ireland</OPTION><OPTION VALUE = "IL">Israel</OPTION><OPTION VALUE = "IT">Italy</OPTION><OPTION VALUE = "JM">Jamaica</OPTION><OPTION VALUE = "SJ">Jan Mayen Islands</OPTION><OPTION VALUE = "JP">Japan</OPTION><OPTION VALUE = "JO">Jordan</OPTION><OPTION VALUE = "KZ">Kazakhstan</OPTION><OPTION VALUE = "KE">Kenya</OPTION><OPTION VALUE = "KI">Kiribati</OPTION><OPTION VALUE = "KR">Korea</OPTION><OPTION VALUE = "KP">Korea (Democratic)</OPTION><OPTION VALUE = "KW">Kuwait</OPTION><OPTION VALUE = "KG">Kyrgystan</OPTION><OPTION VALUE = "LA">Lao</OPTION><OPTION VALUE = "LV">Latvia</OPTION><OPTION VALUE = "LS">Lesotho</OPTION><OPTION VALUE = "LR">Liberia</OPTION><OPTION VALUE = "LY">Libyan Arab Jamahiriya</OPTION><OPTION VALUE = "LI">Liechtenstein</OPTION><OPTION VALUE = "LT">Lithuania</OPTION><OPTION VALUE = "LU">Luxembourg</OPTION><OPTION VALUE = "MO">Macau</OPTION><OPTION VALUE = "MG">Madagascar</OPTION><OPTION VALUE = "MW">Malawi</OPTION><OPTION VALUE = "MY">Malaysia</OPTION><OPTION VALUE = "MV">Maldives</OPTION><OPTION VALUE = "ML">Mali</OPTION><OPTION VALUE = "MT">Malta</OPTION><OPTION VALUE = "MH">Marshall Islands</OPTION><OPTION VALUE = "MQ">Martinique</OPTION><OPTION VALUE = "MR">Mauritania</OPTION><OPTION VALUE = "MU">Mauritius</OPTION><OPTION VALUE = "YT">Mayotte</OPTION><OPTION VALUE = "HM">Mc Donald Islands</OPTION><OPTION VALUE = "MX">Mexico</OPTION><OPTION VALUE = "FM">Micronesia</OPTION><OPTION VALUE = "PM">Miquelon</OPTION><OPTION VALUE = "MD">Moldova</OPTION><OPTION VALUE = "MC">Monaco</OPTION><OPTION VALUE = "MN">Mongolia</OPTION><OPTION VALUE = "MS">Montserrat</OPTION><OPTION VALUE = "MA">Morocco</OPTION><OPTION VALUE = "MZ">Mozambique</OPTION><OPTION VALUE = "MM">Myanmar</OPTION><OPTION VALUE = "NA">Namibia</OPTION><OPTION VALUE = "NR">Nauru</OPTION><OPTION VALUE = "NP">Nepal</OPTION><OPTION VALUE = "NL">Netherlands</OPTION><OPTION VALUE = "AN">Netherlands Antilles</OPTION><OPTION VALUE = "NT">Neutral Zone</OPTION><OPTION VALUE = "KN">Nevis</OPTION><OPTION VALUE = "NC">New Caledonia</OPTION><OPTION VALUE = "NZ">New Zealand</OPTION><OPTION VALUE = "NI">Nicaragua</OPTION><OPTION VALUE = "NE">Niger</OPTION><OPTION VALUE = "NG">Nigeria</OPTION><OPTION VALUE = "NU">Niue</OPTION><OPTION VALUE = "NF">Norfolk Island</OPTION><OPTION VALUE = "MP">Northern Mariana Islands</OPTION><OPTION VALUE = "NO">Norway</OPTION><OPTION VALUE = "OM">Oman</OPTION><OPTION VALUE = "PK">Pakistan</OPTION><OPTION VALUE = "PW">Palau</OPTION><OPTION VALUE = "PA">Panama</OPTION><OPTION VALUE = "PG">Papua New Guinea</OPTION><OPTION VALUE = "PY">Paraguay</OPTION><OPTION VALUE = "PE">Peru</OPTION><OPTION VALUE = "PH">Philippines</OPTION><OPTION VALUE = "PN">Pitcairn</OPTION><OPTION VALUE = "PL">Poland</OPTION><OPTION VALUE = "PT">Portugal</OPTION><OPTION VALUE = "ST">Principe</OPTION><OPTION VALUE = "PR">Puerto Rico</OPTION><OPTION VALUE = "QA">Qatar</OPTION><OPTION VALUE = "RE">Reunion</OPTION><OPTION VALUE = "RO">Romania</OPTION><OPTION VALUE = "RU">Russian Federation</OPTION><OPTION VALUE = "RW">Rwanda</OPTION><OPTION VALUE = "SH">Saint Helena</OPTION><OPTION VALUE = "KN">Saint Kitts</OPTION><OPTION VALUE = "LC">Saint Lucia</OPTION><OPTION VALUE = "PM">Saint Pierre</OPTION><OPTION VALUE = "VC">Saint Vincent</OPTION><OPTION VALUE = "WS">Samoa</OPTION><OPTION VALUE = "SM">San Marino</OPTION><OPTION VALUE = "ST">Sao Tome</OPTION><OPTION VALUE = "SA">Saudi Arabia</OPTION><OPTION VALUE = "SN">Senegal</OPTION><OPTION VALUE = "SC">Seychelles</OPTION><OPTION VALUE = "SL">Sierra Leone</OPTION><OPTION VALUE = "SG">Singapore</OPTION><OPTION VALUE = "SK">Slovakia</OPTION><OPTION VALUE = "SI">Slovenia</OPTION><OPTION VALUE = "SB">Solomon Islands</OPTION><OPTION VALUE = "SO">Somalia</OPTION><OPTION VALUE = "ZA">South Africa</OPTION><OPTION VALUE = "GS">South Georgia</OPTION><OPTION VALUE = "GS">South Sandwich Islands</OPTION><OPTION VALUE = "ES">Spain</OPTION><OPTION VALUE = "LK">Sri Lanka</OPTION><OPTION VALUE = "SD">Sudan</OPTION><OPTION VALUE = "SR">Suriname</OPTION><OPTION VALUE = "SJ">Svalbard</OPTION><OPTION VALUE = "SZ">Swaziland</OPTION><OPTION VALUE = "SE">Sweden</OPTION><OPTION VALUE = "CH">Switzerland</OPTION><OPTION VALUE = "SY">Syrian Arab Republic</OPTION><OPTION VALUE = "TW">Taiwan</OPTION><OPTION VALUE = "TJ">Tajikistan</OPTION><OPTION VALUE = "TZ">Tanzania</OPTION><OPTION VALUE = "TH">Thailand</OPTION><OPTION VALUE = "VC">The Grenadines</OPTION><OPTION VALUE = "TT">Tobago</OPTION><OPTION VALUE = "TG">Togo</OPTION><OPTION VALUE = "TK">Tokelau</OPTION><OPTION VALUE = "TO">Tonga</OPTION><OPTION VALUE = "TT">Trinidad</OPTION><OPTION VALUE = "TN">Tunisia</OPTION><OPTION VALUE = "TR">Turkey</OPTION><OPTION VALUE = "TM">Turkmenistan</OPTION><OPTION VALUE = "TC">Turks Islands</OPTION><OPTION VALUE = "TV">Tuvalu</OPTION><OPTION VALUE = "UG">Uganda</OPTION><OPTION VALUE = "UA">Ukraine</OPTION><OPTION VALUE = "AE">United Arab Emirates</OPTION><OPTION VALUE = "GB">United Kingdom</OPTION><OPTION VALUE = "UY">Uruguay</OPTION><OPTION VALUE = "UM">US Minor Outlying Islands</OPTION><OPTION VALUE = "UZ">Uzbekistan</OPTION><OPTION VALUE = "VU">Vanuatu</OPTION><OPTION VALUE = "VA">Vatican City State</OPTION><OPTION VALUE = "VE">Venezuela</OPTION><OPTION VALUE = "VN">Viet Nam</OPTION><OPTION VALUE = "VG">Virgin Islands (British)</OPTION><OPTION VALUE = "VI">Virgin Islands (US)</OPTION><OPTION VALUE = "WF">Wallis</OPTION><OPTION VALUE = "EH">Western Sahara</OPTION><OPTION VALUE = "YE">Yemen</OPTION><OPTION VALUE = "YU">Yugoslavia</OPTION><OPTION VALUE = "ZR">Zaire</OPTION><OPTION VALUE = "ZW">Zimbabwe</OPTION>');

document.writeln('</select>');



document.writeln('<labelarea rows="1" cols="15" name="Label4">Rating </textarea>');
document.writeln('<select name="Rating" size="1">');

document.writeln('<OPTION VALUE = "" disabled>&lt;Select One&gt;<option value="Unrated - 1000">Unrated-1000</option><option value="1000-1400">1000-1400</option><option value="1400-1800">1400-1800</option><option value="1800-2200">1800-2200</option><option value="2200-2400">2200-2400</option><option value="2400+">2400+</option>');


document.writeln('</select>');
document.writeln('<br>')
document.writeln('<br>')
//<<<<<
//IGOR


if (this.numQuestions > this.questions.length)
    this.numQuestions = this.questions.length;
for (var count1 = 0; count1 < this.numQuestions; count1++)
    {
    this.questions[this.indexes[count1]].ordinal = count1 + 1;
    this.questions[this.indexes[count1]].write(this);
    document.writeln('<br>');
    }
// Add any necessary static form elements here if they come after the questions
document.writeln('<input type="submit" value="Grade Quiz">&nbsp;<input type="reset" value="Reset"></form></body>');
}

