<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Health Root or Prefix or Suffix Meaning Game - RJM Programming - July, 2017</title>
<script type='text/javascript'>

var firstoff=true, butwait=-1, butw=-1;
var isize=1, validtolook=false, hasbeenclicked=false, origfs="6px", smallfs="6px";
var answer="", question="";
var score=0;
var goes=0;
var mychoice=-1;
var thismeaning="";
// Thanks to HLTAAP001 Recognise healthy body systems - Reading 1: Apply knowledge of the basic structure of the healthy human body NSW DET 2007
var meaninginfo=["arthro-;joint",
"adip-;fat",
"-algia;pain",
"angio-;vessel",
"anterior;toward the front or ventral",
"cardi-;heart",
"cardio-;heart",
"cardia-;heart",
"cephal-;head",
"cerebr-;brain",
"cerebro-;brain",
"cut-;skin",
"dent-;teeth",
"derm-;skin",
"distal;away from point of attachment",
"-ectomy;excission",
"gastr-;stomach",
"genio-;chin",
"glosso-;tongue",
"-glossus;tongue",
"gyne-;woman",
"gyno-;woman",
"hepato-;liver",
"histo;tissue",
"homeo-;same",
"homo-;same",
"hyper-;above",
"hypo-;under",
"hyster-;uterus",
"inferior;lowermost or below",
"-itis;inflammation",
"lateral;toward the side of the body",
"lip-;fat",
"lipo-;fat",
"mast-;breast",
"masto-;breast",
"medial;nearest to the centre of the body",
"myo-;muscle",
"nas-;nose",
"nephr-;kidney",
"oculo-;eye",
"ophthalm-;eye",
"-opia;eye",
"-osis;state",
"osteon-;bone",
"osteo-;bone",
"oto-;ear",
"patho-;disease",
"-path;disease",
"-pathy;disease",
"-phasia;speech",
"phleb-;vein",
"podo-;foot",
"posterior;toward the back or dorsal",
"proximal;closest point of attachment",
"rhin-;nose",
"spino-;spine",
"superior;uppermost or above",
"-stomy;opening",
"thorac-;chest",
"-tomy;cut",
"uro-;urine",
"-uria;urine",
"vas-;vessel"];


function myrchange() {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) return;
var i, reset=false, wasscore=score, washbc=hasbeenclicked, maxgoes=eval(1 + goes);
var ois=document.getElementById('root_prefix_suffix');
if (validtolook && butwait <= 0) {
if (ois.options.length > 0) {
for (i=0; i<ois.options.length; i++) {
if (ois.options[i].selected) {
if (ois.options[i].value != '' || hasbeenclicked) {
reset=true;
test(null,ois.options[i].id,ois.options[i].value);
if (goes > maxgoes) {
document.getElementById('score').innerHTML=document.getElementById('score').innerHTML.replace("/" + goes, "/" + maxgoes);
goes=maxgoes;
}
}
}
}
if (reset) {
//document.title='reset=true ... ';
if (wasscore == score && hasbeenclicked) {
washbc=false;
validtolook=false;
hasbeenclicked=false;
//document.title+='1 ... ';
}
if (wasscore != score || washbc) {
document.getElementById('root_prefix_suffix').value="";
document.getElementById('meaning').value="";
//document.title+='2 ... ';
choose();
}
}
}
}
setTimeout(myrchange, 5000);
}

function test(mthis,mthisid,mthisvalue) {
var orvia='';
if (mthis == null || mthisid == "meaning" || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
goes++;
if (mthis == null && mthisid != '') {
orvia=document.getElementById(mthisid).getAttribute("data-member");
} else {
orvia=mthis.options[mthis.selectedIndex].getAttribute("data-member");
mthisvalue=mthis.value;
mthisid=mthis.id;
}
if (mthisvalue == '') {
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes + ' ... Bad luck. Try again.';
alert(maybemore('Answer is ' + answer));
if (mthis != null || hasbeenclicked) document.getElementById('meaning').value="";
if (mthis != null || hasbeenclicked) document.getElementById('root_prefix_suffix').value="";
if (mthis != null || hasbeenclicked) choose();
} else if (answer == mthisvalue || orvia.indexOf(";" + question) != -1) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes + ' ... Well done!';
if (mthis != null) document.getElementById('meaning').value="";
if (mthis != null) document.getElementById('root_prefix_suffix').value="";
if (mthis != null) choose();
} else {
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes + ' ... Bad luck. Try again.';
}
}
}

function maybemore(first_thought) {
var i, delim=",", prefixis="", suffixis="", ans=first_thought.split(' is ')[1];
for (i=0; i<meaninginfo.length; i++) {
if (meaninginfo[i].indexOf(ans + ";") != -1) {
suffixis=meaninginfo[i].split(ans + ";")[1];
}
}
if (suffixis == "") {
return first_thought;
} else {
var second_thought=first_thought;
for (i=0; i<meaninginfo.length; i++) {
if (meaninginfo[i].indexOf(";" + suffixis) != -1) {
if (prefixis == "") {
prefixis=meaninginfo[i].split(";" + suffixis)[0];
if (second_thought.replace(/\ /g,',').indexOf(',' + prefixis) == -1) {
second_thought+=delim + prefixis;
delim=',';
} else {
delim=',';
}
} else {
second_thought=second_thought.replace("Answer is ","Answers are ");
prefixis=meaninginfo[i].split(";" + suffixis)[0];
if (second_thought.replace(/\ /g,',').indexOf(',' + prefixis) == -1) {
second_thought+=delim + prefixis;
delim=',';
} else {
delim=',';
}
}
}
}
return second_thought;
}
}

function butwreducer() {
if (butwait > 0) {
document.getElementById('score').innerHTML=document.getElementById('score').innerHTML.replace(' 0/0',' 0/0 ...').replace('...','....');
butwait--;
}
setTimeout(butwreducer, 1000);
}

function choose() {
if (firstoff) {
var mngs=[], i, j, found=false;
origfs=window.getComputedStyle(document.getElementById('root_prefix_suffix'), null).getPropertyValue("font-size");
firstoff=false;
for (i=0; i<meaninginfo.length; i++) {
document.getElementById('root_prefix_suffix').innerHTML+='<option id="' + meaninginfo[i].split(";")[0] + '" data-member="' + meaninginfo[i] + '" value="' + meaninginfo[i].split(";")[0] + '">' + meaninginfo[i].split(";")[0] + '</option>';
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
firstoff=firstoff;
} else {
isize=eval(2 + i);
document.getElementById('root_prefix_suffix').size=isize;
}
found=false;
for (j=0; j<mngs.length; j++) {
if (mngs[j] == '<option id="' + meaninginfo[i].split(";")[1].replace(/\ /g,'_') + '" data-member=";" value="' + meaninginfo[i].split(";")[1] + '" title="' + meaninginfo[i].split(";")[1] + '">' + meaninginfo[i].split(";")[1] + '</option>') found=true;
}
if (!found) mngs.push('<option id="' + meaninginfo[i].split(";")[1].replace(/\ /g,'_') + '" data-member=";" value="' + meaninginfo[i].split(";")[1] + '" title="' + meaninginfo[i].split(";")[1] + '">' + meaninginfo[i].split(";")[1] + '</option>');
}
mngs.sort();
for (i=0; i<mngs.length; i++) {
document.getElementById('meaning').innerHTML+=mngs[i];
}
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
firstoff=firstoff;
} else {
butw=3;
butwreducer();
document.getElementById('root_prefix_suffix').multiple=true;
myrchange();
}
}
mychoice=Math.floor(Math.random() * meaninginfo.length);
var myc=Math.floor(Math.random() * meaninginfo.length);
if (eval(myc % 2) == 0) {
document.getElementById('rnone').innerHTML='Please choose correct root or prefix or suffix (or to give up) ...';
document.getElementById('meaning').value=meaninginfo[mychoice].split(";")[1];
document.getElementById('root_prefix_suffix').style.fontSize=smallfs;
question=meaninginfo[mychoice].split(";")[1];
answer=meaninginfo[mychoice].split(";")[0];
document.getElementById('root_prefix_suffix').value='';
if (isize > 1) {
document.getElementById('myh4').innerHTML='Please correctly select from undefined dropdown with correct matching value(s).';
} else {
document.getElementById('myh4').innerHTML='Please correctly select from undefined dropdown with a correct matching value.';
}
document.getElementById('root_prefix_suffix').size=isize;
validtolook=true;
hasbeenclicked=false;
} else {
document.getElementById('myh4').innerHTML='Please correctly select from undefined dropdown with a correct matching value.';
document.getElementById('rnone').innerHTML=meaninginfo[mychoice].split(";")[0];
document.getElementById('root_prefix_suffix').value=meaninginfo[mychoice].split(";")[0];
document.getElementById('root_prefix_suffix').style.fontSize=origfs;
question=meaninginfo[mychoice].split(";")[0];
answer=meaninginfo[mychoice].split(";")[1];
document.getElementById('meaning').value='';
document.getElementById('root_prefix_suffix').size=1;
validtolook=false;
hasbeenclicked=false;
}
}
</script>
<style>
#lhtd {
background-color: lightgreen;
}

#rhtd {
background-color: lightblue;
}
</style>
</head>
<body onload='choose();'>
<table border=40 cellpadding=20 cellspacing=20><tbody><tr><td id='lhtd'>
<select onclick='hasbeenclicked=true; validtolook=true; butwait=butw; ' onchange='test(this,"root_prefix_suffix","");' id='root_prefix_suffix'><option id='rnone' data-member=';' value=''>Please choose correct root or prefix or suffix (or to give up) ...</option></select>
</td><td id='rhtd'>
<h1>Health Root or Prefix or Suffix Meaning Game</h1>
<h3>RJM Programming - July, 2017</h3>
<h3 id='score'>Score: 0/0</h3>
<h4 id='myh4'>Please correctly select from undefined dropdown with a correct matching value.</h4>
<select onchange='test(this,"meaning","");' id='meaning'><option id='mnone' data-member=';' value=''>Please choose correct meaning (or to give up) ...</option></select>
</td></tr></tbody></table>
</body>
</html>