<!--
function makeArray(len) {
    for (var i = 0; i < len; i++) this[i] = null;
this.length = len;
}

function makeQuestion(question, correctAnswer) {
var args = makeQuestion.arguments;
this.question = question;
this.correctAnswer = correctAnswer;
this.userAnswer = null;
this.isCorrect = isCorrect;
this.showForm = showForm;
this.userChoices = new makeArray(args.length - 2);
   for (var i = 0; i < args.length - 2; i++) { 
   this.userChoices[i] = args[i + 2];
   }
}
function isCorrect() {
if (this.correctAnswer == this.userAnswer) return true;
else return false;
}
// Method to display contents of question object.
function showForm(n) {
document.write('<p>' + (n + 1) + '. ' + this.question + '<BLOCKQUOTE><FORM>');
    for (var i = 0; i < this.userChoices.length; i++) {
        document.write('<INPUT TYPE = "RADIO" NAME = "q' + n + 
                       '" onClick = "quiz[' + n + '].userAnswer = ' + i + '">');
        document.write(this.userChoices[i] + '<BR>');
    }
document.write('</FORM></BLOCKQUOTE>');
}
// Function to correct the quiz and display score, correct answers.
function correctQuiz() {
var correct = 0;
correctPage = '<HTML><HEAD><TITLE>Corrections</TITLE><LINK REL="StyleSheet" HREF="media.css" TYPE="text/css"></HEAD><BODY>';
    for (var i = 0; i < quiz.length; i++) {
    if (quiz[i].isCorrect()) correct++;
    }
var score = Math.round((correct / quiz.length) * 100);
correctPage += '<SPAN CLASS="hi">Score: ' + score + ' %</SPAN>';
    if (correct < quiz.length) { 
    correctPage += ifWrong;
        for (var i = 0; i < quiz.length; i++) {
            if (!quiz[i].isCorrect()) {
            correctPage += (i + 1) + '. ' +
            quiz[i].userChoices[quiz[i].correctAnswer] + '<BR>';
            }
        }
    }
    else correctPage += ifAced;
correctPage += '<P><A HREF="JAVASCRIPT:void(0);" onClick="window.close()">Close this window.</A></BODY></HTML>';
correctwin = window.open ('', '', 'height=375,width=300,scrollbars=yes,left=50,top=50');
    if (correctwin.opener == null) correctwin.opener = window;
correctwin.location = 'javascript:opener.correctPage';
}
// Message to display if quiz is aced.
var ifAced = "<P>What a star! All right.<P>"; 
// Message to display if any are wrong.
var ifWrong = "<P>Here are the correct answers to the questions you got wrong:<P>";

quiz = new makeArray(10);
quiz[0] = new makeQuestion("Which website was acquired by Google for $1.65 billion?", 1,                                                         "MySpace",                
                           "YouTube",               
                           "Flickr");              
quiz[1] = new makeQuestion("Which next-generation DVD format is being championed by Sony?", 0,
                           "Blu-ray",
                           "HD-DVD", 
                	   "DVD-RW");
quiz[2] = new makeQuestion("Which console is the odd one out in terms of user interface?", 2, 
                           "Sony PS3", 
                           "Microsoft Xbox 360",
                           "Nintendo Wii");
quiz[3] = new makeQuestion("Pressing the red button allows you to access...?", 2, 
                           "...the internet.",
                           "...DVD extras.", 
                           "...interactive content.");
quiz[4] = new makeQuestion("In the context of NMTs, if something is non-linear it is...?", 0, 
                           "flexible in terms of the order in which it is experienced.",
                           "editable by all users.", 
                           "restricted to a pre-set sequence.");
quiz[5] = new makeQuestion("What does ADSL stand for?", 1, 
                           "Automatic Dialing Speedy Link",
                           "Asymmetric Digital Subscriber Line", 
                           "A Damn Swift Line");
quiz[6] = new makeQuestion("If a site is labelled as being part of the Web 2.0 movement its most significant feature is likely to be...", 2, 
                           "...interactivity.",
                           "...a shiny logo and glossy buttons.", 
                           "...user-generated content.");
quiz[7] = new makeQuestion("Multi-channel TV makes <b>niche broadcasting</b> easier. Niche broadcasting is...", 2, 
                           "...the delivery of interactive games.",
                           "...sharing a channel number.", 
                           "...catering to specialised, narrowly-defined tastes.");
quiz[8] = new makeQuestion("What is <b>bandwidth</b>?", 0, 
                           "The amount of data that any given system can deliver in a specified time.",
                           "The number of channels on digital TV.", 
                           "The amount of storage space on a portable media player.");
quiz[9] = new makeQuestion("Which is the odd one out in terms of ownership?", 1, 
                           "YouTube",
                           "MySpace", 
                           "Blogger");

// -->

