function makeArray(len) {
    for (var i = 0; i < len; i++) this[i] = null;
this.length = len;
}


function gwneudcwestiwn(cwestiwn, atebcywir) {
var args = gwneudcwestiwn.arguments;
this.cwestiwn = cwestiwn;
this.atebcywir = atebcywir;
this.atebion = null;
this.maengywir = maengywir;
this.dewision = new makeArray(args.length - 2);
   for (var i = 0; i < args.length -2; i++) { 
   this.dewision[i] = args[i + 2];
   }
}
function maengywir() {
if (this.atebcywir == this.atebion) return true;
else return false;
}



function cywiroprofiad() {
var rheicywir = 0;
dangosAtebionCywir = '<HTML><TITLE>Corrections</TITLE><BODY  bgcolor="#ffffcc">';
    for (var i = 0; i < profiad.length; i++) {
    if (profiad[
i].maengywir()) rheicywir++;
    }
var pwyntiau = Math.round((rheicywir / profiad.length) * 100);
dangosAtebionCywir += '<font size=+2 color=red>Score: <STRONG>' + pwyntiau + '</STRONG> %</font>';
 if (pwyntiau == 100) {dangosAtebionCywir += osperffaith; }
 else  if (pwyntiau < 60) { 
    dangosAtebionCywir += '<br><font size=+1>You had trouble with this quiz. Check the correct answers below and try again later.</font>';}
    else {
    dangosAtebionCywir += '<br><font size=+1>Good attempt. Check the correct answers below.';}	
    if (rheicywir < profiad.length) { 
    dangosAtebionCywir += osanghywir;
        for (var i = 0; i < profiad.length; i++) {
            if (!profiad[i].maengywir()) {
            dangosAtebionCywir += '<br>'+(i + 1) + '. ' +
            profiad[i].dewision[profiad[i].atebcywir] ;
            }
        }
    }
 
dangosAtebionCywir += '</BODY></HTML>';
ffenestcywir = window.open ('', '');
    if (ffenestcywir.opener == null) ffenestcywir.opener = window;
ffenestcywir.location = 'javascript:opener.dangosAtebionCywir';
}


var osperffaith = "<P>Well done, you made no mistakes at all.<br> <P><FORM><INPUT TYPE='BUTTON' VALUE='CLICK TO CLOSE' onClick='self.close()'</FORM>"; 

var osanghywir = "<br><center><FORM><INPUT TYPE='BUTTON' VALUE='CLICK TO CLOSE' onClick='self.close()'</FORM></center><br>Here is a list of all your incorrect answers. The number corresponds to their number in the quiz.</ul>";

