<html>
<head>
<title>Internet Search Engine Quiz - RJM Programming - May, 2015</title>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>

<script type='text/javascript'>
var score=0;
var outof=10;
var qlist=',,';
var ans1='';
var ans2='';
var ans3='';
var ans4='';
var ans5='';
var ans6='';
var ans7='';
var ans8='';
var ans9='';
var ans10='';
var iid, ccnt, okcnt;
var cid, ocid, nid, j, cc;
var vid, ovid, aword;
var hid, hidval, cwords, bigans;
var numwordstomatch, wtm, found;
var delay=1;
var curmis=1;
var curmval=0.0;
var stopit=0;
var zeroofive=0.05;

function onion(inht) {
var retinht = inht;
if (inht.indexOf('<') != -1) {
var pwords = inht.split("id=");
if (pwords.length > 1) {
var delim = pwords[1].substring(0,1);
var iwords = pwords[1].substring(1).split(delim);
var osel = document.getElementById(iwords[0]);
var oselval = osel.value;
var hinp = document.getElementById(iwords[0].replace("s", "h"));
hinp.value = oselval;
var owords = inht.split("<");
if (owords.length > 1) {
retinht = owords[0];
retinht = retinht + osel.options[osel.selectedIndex].text;
if (owords.length >= 3) retinht = retinht + owords[owords.length - 1].replace("/select>", "");
}
}
}
return retinht;
}

function later() {
qlist = qlist.replace(",,", "," + nid.replace("h","") + ",,");
//alert("pre " + qlist);
ocid.checked = true;
document.getElementById(ocid.id.replace('c','m')).value=1.0;
currmis=eval(1 + ocid.id.replace('c',''));
curmval=0.0;
ovid.value = aword;
score = score + 1;
document.getElementById('score').innerHTML = 'Score: ' + score + '/' + outof;
document.getElementById('score').style.display = 'inline';
//alert(qlist);
}

function check(ois, cans) {
if (cans != null) {
iid = ois.id;
okcnt = 0;
aword='';
bigans = " " + cans.toUpperCase() + " ";
numwordstomatch = 1;
found = false;

if (iid == 'overall') {
//delay = 0;
for (j=1; j<=10; j++) {
if (qlist.indexOf("," + j + ",") == -1) {
onion(document.getElementById('td' + j).innerHTML);
cc = 'i' + j;
ovid = document.getElementById(cc);
hidval = document.getElementById(cc).value;
check(ovid, hidval);
}
}
//delay = 1;
} else {
found = false;
okcnt = 0;
nid = iid.replace("i", "h").replace('xd', "h");
if (qlist.indexOf("," + nid.replace("h","") + ",") == -1) {
cid = iid.replace("i", "c").replace('xd', "c");
vid = iid.replace('xd', "i");
ocid = document.getElementById(cid);
ovid = document.getElementById(vid);
hidval = document.getElementById(nid).value;
wtm = hidval.split(':');
if (wtm.length > 1) {
numwordstomatch = wtm[0];
hidval = wtm[1];
}
cwords = hidval.split(',');
for (ccnt=0; ccnt<cwords.length; ccnt++) {
if (bigans.indexOf(" " + cwords[ccnt].toUpperCase() + " ") != -1) {
//if (delay == 0) alert('ccnt=' + ccnt + ' and bigans=' + bigans + ' and cwords[ccnt]=' + cwords[ccnt]);
if (aword == '') {
aword = cwords[ccnt];
} else {
aword = aword + ',' + cwords[ccnt];
}
okcnt = okcnt + 1;
//alert(okcnt + " vs " + numwordstomatch);
}
}
if (okcnt >= numwordstomatch) found = true;
if (found) {
if (delay == 1) {
setTimeout(later, 1000);
} else {
later();
}
}
}
}




}
}

function onmeterchange(mym) {
//alert(mym.id);
}

function oncbchange(mycb) {
document.getElementById(mycb.id.replace('c','m')).value=1.0;
}

function pressure() {
if (zeroofive <= 0.0) stopit = 1;
if (stopit == 0) {
if (eval(curmis) <= 10) {
ocid = document.getElementById('c' + curmis);
if (ocid.checked == true) {
document.getElementById('m' + curmis).value=1.0;
curmis=eval(1 + curmis);
curmval=0.0;
if (eval(curmis) <= 10) document.getElementById('i' + curmis).focus();
} else {
curmval=eval(zeroofive + curmval);
}
if (curmval >= 1.0) {
document.getElementById("m" + curmis).value=1.0;
document.getElementById("xd" + curmis).style.display='none';
document.getElementById("i" + curmis).style.display='none';
curmis=eval(1 + curmis);
if (eval(curmis) <= 10) {
while (document.getElementById("i" + curmis).value != "" && eval(curmis) <= 10) {
document.getElementById("xd" + curmis).style.display='none';
document.getElementById("m" + curmis).value=1.0;
curmis=eval(1 + curmis);
}
if (eval(curmis) <= 10) document.getElementById('i' + curmis).focus();
}
curmval=0.0;
} else {
document.getElementById("m" + curmis).value=curmval;
}
}
}
}

</script>
</head>
<body style="background-color:lightblue;" onload="document.getElementById('i1').focus(); setInterval(pressure,1000);">
<h1 align="center">Quiz <select id='mysel' onchange='curmval=0.0; zeroofive=eval(1.0 / this.value); if (zeroofive > 0 && stopit == 1) { stopit = 0; } '><option value=20>Twenty Seconds per question</option><option value=-1>No pressure thanks</option><option value=10>Ten Seconds per question</option><option value=60>Sixty Seconds per question</option><option value=120>Two Minutes per question</option><option value=300>Five Minutes per question</option><option value=3600>One Hour per question</option></select> <span id='score' style='display:none;'>Score: 0/10</span></h1>
<table align="center" style="background-color:yellow;">
<tr>
<td>1</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans1=prompt(onion(document.getElementById('td1').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans1); " id='xd1'></input></td><td id='td1'>What is the capital city of Nicaragua?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td1').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h1' value='Managua'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i1' ></input></td><td><meter onchange='onmeterchange(this);' id='m1' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c1'></input></td></td>
</tr><tr>
<td>2</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans2=prompt(onion(document.getElementById('td2').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans2); " id='xd2'></input></td><td id='td2'>What currency do they use in Latvia?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td2').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h2' value='euro,litas'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i2' ></input></td><td><meter onchange='onmeterchange(this);' id='m2' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c2'></input></td></td>
</tr><tr>
<td>3</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans3=prompt(onion(document.getElementById('td3').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans3); " id='xd3'></input></td><td id='td3'>Who invented the computer compiler?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td3').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h3' value='Hopper,Grace Hopper,Grace Murray Hopper'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i3' ></input></td><td><meter onchange='onmeterchange(this);' id='m3' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c3'></input></td></td>
</tr><tr>
<td>4</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans4=prompt(onion(document.getElementById('td4').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans4); " id='xd4'></input></td><td id='td4'>What do fruit flies and fighter jets have in common?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td4').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h4' value='roll,banked turn'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i4' ></input></td><td><meter onchange='onmeterchange(this);' id='m4' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c4'></input></td></td>
</tr><tr>
<td>5</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans5=prompt(onion(document.getElementById('td5').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans5); " id='xd5'></input></td><td id='td5'>In 1800 roughly how many billion people lived on Earth?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td5').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h5' value='1,one'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i5' ></input></td><td><meter onchange='onmeterchange(this);' id='m5' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c5'></input></td></td>
</tr><tr>
<td>6</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans6=prompt(onion(document.getElementById('td6').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans6); " id='xd6'></input></td><td id='td6'>How many strings does a Pipa have?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td6').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h6' value='4,four'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i6' ></input></td><td><meter onchange='onmeterchange(this);' id='m6' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c6'></input></td></td>
</tr><tr>
<td>7</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans7=prompt(onion(document.getElementById('td7').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans7); " id='xd7'></input></td><td id='td7'>What is the longest river in the world?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td7').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h7' value='Nile'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i7' ></input></td><td><meter onchange='onmeterchange(this);' id='m7' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c7'></input></td></td>
</tr><tr>
<td>8</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans8=prompt(onion(document.getElementById('td8').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans8); " id='xd8'></input></td><td id='td8'>What are the three leads of a bipolar transistor?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td8').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h8' value='3:emitter,base,collector'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i8' ></input></td><td><meter onchange='onmeterchange(this);' id='m8' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c8'></input></td></td>
</tr><tr>
<td>9</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans9=prompt(onion(document.getElementById('td9').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans9); " id='xd9'></input></td><td id='td9'>What 4 digit number multiplied by 4 equals the same number in reverse?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td9').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h9' value='2178'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i9' ></input></td><td><meter onchange='onmeterchange(this);' id='m9' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c9'></input></td></td>
</tr><tr>
<td>10</td><td><input type='button' value="Click to immediately answer" onclick=" stopit=1; ans10=prompt(onion(document.getElementById('td10').innerHTML),''); if (zeroofive > 0.0) { stopit=0; } check(this,ans10); " id='xd10'></input></td><td id='td10'>Which animal on Earth lives the longest?</td><td><a href='#' onclick=" var ga='https://www.google.com/search?q=' + onion(document.getElementById('td10').innerHTML).replace('?','%3F').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); window.open(ga,'_blank');" title='?'>Big hint</a></td><td><input type='hidden' id='h10' value='quahog,ocean quahog'></input></td><td><input type='text' value='' onchange=' check(this,this.value); ' style='background-color:pink;' id='i10' ></input></td><td><meter onchange='onmeterchange(this);' id='m10' value=0></meter></td><td>Correct: <input onchange='oncbchange(this);' type='checkbox' id='c10'></input></td></td>
</tr><tr>
<td colspan=5></td><td><input type='button' value="Click to check all your answers" id='overall' onclick=' delay = o; check(this, ""); delay = 1;'></input></td>
</tr>
</table>
</body>
</html>