<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Canvas HTML Element Suffix Ology Board Game Tutorial ... RJM Programming ... March 2016 ... thanks to http://stackoverflow.com/questions/9880279/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element</title>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<link href='//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css' rel='stylesheet' type='text/css'>
<style>
.ui-dialog .ui-dialog-titlebar-close{
display: none;
}
</style>
<script src='translate_hear.js?translate_hear=yes' type='text/javascript'></script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://www.rjmprogramming.com.au/Javascript/jQuery/Dialog/Modal/jquery-ui-1.11.1.custom/jquery-ui.js"></script>
<script type='text/javascript' src='dotdotdot.js' defer></script>
<script language="JavaScript">
// Thanks to http://chemistry.about.com/od/mathsciencefundamentals/a/ologylist_3.htm

var nextexpected = "you'llneverfindthis";
var hint="Click on a button and then the next button that completes a true sentence, which adds a point to your score and waits for you to click again all the way through to just this Hint button remaining.";
var bcnt = 0, ccnt = 0;

var yourone = " ";
var yourtwo = " ";
var yourthree = " ";
var ourd = "";
var nourd = 5000;
var aclick = true;


var sentenceparts = new Array(
"Actinology","is","the study of the effect of light on chemicals.",
"Aerobiology","is","a branch of biology that studies organic particles that are transported by the air.",
"Aerology","is","the study of the atmosphere.",
"Aetiology","is","the medical study of the causation of disease.",
"Agrobiology","is","the study of plant nutrition and growth in relation to soil.",
"Agrology","is","the branch of soil science dealing with the production of crops.",
"Agrostology","is","the study of grasses.",
"Algology","is","the study of algae.",
"Allergology","is","the study of the causes and treatment of allergies.",
"Andrology","is","the study of male health.",
"Anesthesiology","is","the study of anesthesia and anesthetics.",
"Angiology","is","the study of the anatomy of blood and lymph vascular systems.",
"Anthropology","is","the study of humans.",
"Apiology","is","the study of bees.",
"Arachnology","is","the study of spiders.",
"Archaeology","is","the study of past cultures.",
"Archaeozoology","is","the study of relationships between humans and animals over time.",
"Areology","is","the study of Mars.",
"Astacology","is","the study of crawfish.",
"Astrobiology","is","the study of origin of life.",
"Astrogeology","is","the study of geology of celestial bodies.",
"Audiology","is","the study of hearing.",
"Autecology","is","the study of the ecology of any individual species.",
"Bacteriology","is","the study of bacteria.",
"Bioecology","is","the study of interaction of life in the environment.",
"Biology","is","the study of life.",
"Bromatology","is","the study of food.",
"Cardiology","is","the study of the heart.",
"Cariology","is","the study of cells.",
"Cetology","is","the study of cetaceans (e.g. whales and dolphins).",
"Climatology","is","the study of the climate.",
"Coleopterology","is","the study of beetles.",
"Conchology","is","the study of shells and of molluscs.",
"Coniology","is","the study of dust in the atmosphere and its effects on living organisms.",
"Craniology","is","the study of the characteristics of the skull.",
"Criminology","is","the scientific study of crime.",
"Cryology","is","the study of very low temperatures and related phenomena.",
"Cynology","is","the study of dogs.",
"Cytology","is","the study of cells.",
"Cytomorphology","is","the study of the structure of cells.",
"Cytopathology","is","the branch of pathology that studies diseases on the cellular level.",
"Dendrochronology","is","the study of the age of trees and the records in their rings.",
"Dendrology","is","the study of trees.",
"Dermatology","is","the study of the skin.",
"Dermatopathology","is","the field of dermatological anatomical pathology.",
"Desmology","is","the study of ligaments.",
"Diabetology","is","the study of diabetes mellitus.",
"Dipterology","is","the study of flies.",
"Ecohydrology","is","the study of interactions between organisms and the water cycle.",
"Ecology","is","the study of the relationships between living organisms and their environment.",
"Ecophysiology","is","the study of the interrelationship between an organism's physical functioning and its environment.",
"Edaphology","is","a branch of soil science that studies the influence of soil on life.",
"Electrophysiology","is","the study of the relationship between electric phenomena and bodily processes.",
"Embryology","is","the study of embryos.",
"Endocrinology","is","the study of internal secretory glands.",
"Entomology","is","the study of insects.",
"Enzymology","is","the study of enzymes.",
"Epidemiology","is","the study of the origin and spread of diseases.",
"Ethology","is","the study of animal behavior.",
"Exobiology","is","the study of life in outer space.",
"Exogeology","is","the study of geology of celestial bodies.",
"Felinology","is","the study of cats.",
"Fetology","is","the study of the fetus.",
"Foetology","is","the study of the foetus.",
"Formicology","is","the study of ants.",
"Gastrology or Gastroenterology","is","the study of the stomach and intestines.",
"Gemology","is","the study of gemstones.",
"Geobiology","is","the study of the biosphere and its relations to the lithosphere and atmosphere.",
"Geochronology","is","the study of the age of the Earth.",
"Geology","is","the study of the Earth.",
"Geomorphology","is","the study of present-day landforms.",
"Gerontology","is","the study of old age.",
"Glaciology","is","the study of glaciers.",
"Gynecology","is","the study of medicine relating to women.",
"Hematology","is","the study of blood.",
"Heliology","is","the study of the sun.",
"Helioseismology","is","the study of vibrations and oscillations in the sun.",
"Helminthology","is","the study of parasitic worms.",
"Hepatology","is","the study of the liver.",
"Herbology","is","the study of the therapeutic use of plants.",
"Herpetology","is","the study of reptiles and amphibians.",
"Heteroptology","is","the study of true bugs.",
"Hippology","is","study of horses.",
"Histology","is","the study of living tissues.",
"Histopathology","is","the study of the microscopic structure of diseased tissue.",
"Hydrogeology","is","the study of underground water.",
"Hydrology","is","the study of water.",
"Ichnology","is","the study of fossil footprints and tracks and burrows.",
"Ichthyology","is","the study of fish.",
"Immunology","is","the study of the immune system.",
"Karyology","is","the study of karyotypes (a branch of cytology).",
"Kinesiology","is","the study of movement in relation to human anatomy.",
"Kymatology","is","the study of waves or wave motions.",
"Laryngology","is","the study of the larynx.",
"Lepidopterology","is","the study of butterflies and moths.",
"Limnology","is","the study of fresh water environments.",
"Lithology","is","the study of rocks.",
"Lymphology","is","the study of the lymph system and glands.",
"Malacology","is","the study of mollusks.",
"Mammalogy","is","the study of mammals.",
"Meteorology","is","the study of weather.",
"Methodology","is","the study of methods.",
"Metrology","is","the study of measurement.",
"Microbiology","is","the study of micro-organisms.",
"Micrology","is","the science of preparing and handling microscopic objects.",
"Mineralogy","is","the study of minerals.",
"Mycology","is","the study of fungi.",
"Myology","is","the scientific study of muscles.",
"Myrmecology","is","the study of ants.",
"Nanotechnology","is","the study of machines at the molecular level.",
"Nanotribology","is","the study of friction on the molecular and atomic scale.",
"Nematology","is","the study of nematodes.",
"Neonatology","is","the study of newborn infants.",
"Nephology","is","the study of clouds.",
"Nephrology","is","the study of the kidneys.",
"Neurology","is","the study of nerves.",
"Neuropathology","is","the study of neural diseases.",
"Neurophysiology","is","the study of the functions of the nervous system.",
"Nosology","is","the study of disease classification.",
"Oceanology","is","the study of oceans.",
"Odonatology","is","the study of dragonflies and damselflies.",
"Odontology","is","the study of the teeth.",
"Oncology","is","the study of cancer.",
"Oology","is","the study of eggs.",
"Ophthalmology","is","the study of the eyes.",
"Ornithology","is","the study of birds.",
"Orology","is","the study of mountains and their mapping.",
"Orthopterology","is","the study of grasshoppers and crickets.",
"Osteology","is","the study of bones.",
"Otolaryngology","is","the study of the ear and throat.",
"Otology","is","the study of the ear.",
"Otorhinolaryngology","is","the study of the ear and nose and throat .",
"Paleoanthropology","is","the study of prehistoric people and human origins.",
"Paleobiology","is","the study of prehistoric life.",
"Paleobotany","is","the study of prehistoric metaphytes.",
"Paleoclimatology","is","the study of prehistoric climates.",
"Paleoecology","is","the study of prehistoric environments by analyzing fossils and rock strata.",
"Paleontology","is","the study of fossils of ancient life.",
"Paleophytology","is","the study of ancient multicellular plants.",
"Paleozoology","is","the study of prehistoric metazoans.",
"Palynology","is","the study of pollen.",
"Parapsychology","is","the study of paranormal or psychic phenomenon that defy conventional scientific explanations.",
"Parasitology","is","the study of parasites.",
"Pathology","is","the study of illness.",
"Petrology","is","the study of rocks and the conditions by which they form.",
"Pharmacology","is","the study of drugs.",
"Phenology","is","the study of periodic biological phenomena.",
"Phlebology","is","a branch of medicine that deals with the venous system.",
"Phonology","is","the study of vocal sounds.",
"Phycology","is","the study of algae.",
"Physiology","is","the study of the functions of living organisms.",
"Phytology","is","the study of plants and botany.",
"Phytopathology","is","the study of plant diseases.",
"Phytosociology","is","the study of the ecology of plant communities.",
"Planetology","is","the study of planets and solar systems.",
"Planktology","is","the study of plankton.",
"Pomology","is","the scientific study of fruits.",
"Posology","is","the study of drug dosage.",
"Primatology","is","the study of primates.",
"Proctology","is","the medical study of the rectum and anus and colon and pelvic floor.",
"Psychobiology","is","the study and psychology of organisms with regard to their functions and structures.",
"Psychology","is","the study of mental processes in living creatures.",
"Psychopathology","is","the study of mental illness or disorders.",
"Psychopharmacology","is","the study of psychotropic or psychiatric drugs.",
"Psychophysiology","is","the study of the physiological bases of psychological processes.",
"Pulmonology","is","the specialty in medicine that deals with diseases of the lungs and the respiratory tract.",
"Radiology","is","the study of rays usually ionising radiation.",
"Reflexology","is","originally the study of reflexes or of reflex responses.",
"Rheology","is","the study of flow.",
"Rheumatology","is","the study of rheumatic diseases.",
"Rhinology","is","the study of the nose.",
"Sarcology","is","a subsection of anatomy that studies the soft tissues.",
"Scatology","is","the study of feces.",
"Sedimentology","is","a branch of geology that studies sediments.",
"Seismology","is","the study of earthquakes.",
"Selenology","is","the study of the moon.",
"Serology","is","the study of blood serum.",
"Sexology","is","the study of sex.",
"Sitiology","is","the study of diet.",
"Sociobiology","is","the study of the effect of evolution on ethology.",
"Sociology","is","the study of society.",
"Somatology","is","study of human characteristics.",
"Somnology","is","the study of sleep.",
"Speleology","is","the study or exploration of caves.",
"Stomatology","is","the study of the mouth.",
"Symptomatology","is","the study of symptoms.",
"Synecology","is","the study of the ecological interrelationships.",
"Technology","is","the study of the practical arts.",
"Thermology","is","the study of heat.",
"Tocology","is","the study of childbirth.",
"Topology","is","the mathematical study of closeness and connectedness.",
"Toxicology","is","the study of poisons.",
"Traumatology","is","the study of wounds and injuries.",
"Tribology","is","the study of friction and lubrication.",
"Trichology","is","the study of hair and the scalp.",
"Typology","is","the study of classification.",
"Urology","is","the study of the urogenital tract.",
"Vaccinology","is","the study of vaccines.",
"Virology","is","the study of viruses.",
"Volcanology (or vulcanology)","is","the study of volcanoes.",
"Xenobiology","is","the study of non-terrestrial life.",
"Xylology","is","the study of wood.",
"Zooarchaeology","is","the study and analysis of animal remains at archaeological sites to reconstruct relationships between people and animals and their environment.",
"Zoology","is","the study of animals.",
"Zoopathology","is","the study of animal diseases.",
"Zoopsychology","is","the study of mental processes in animals.",
"Zymology","is","the study of fermentation."
);

var ppl = 0;
var oklist = ":";
var pseudo_sentence = "";
var real_sentence = "";
var twothings = ["", ""];
var cderived_sentences = "";
var derived_sentences = [];
var prefix = [];
var midbit= [""];
var midlist = ":";
var suffix = [];
var cprefix = "";
var cmidbit = "";
var csuffix = "";
var ij, jk, kl, bword="", unknownselect = "<select id='unknown'></select>";



var score = 0.0;
var goes = 0.0;
var realgoes = 0;
var maxx = 0.0;
var maxy = 0.0;

var sentencepick = 0;
var threepick = 0;


var offx = 0.0;
var offy = 0.0;


var okay = 1;

var gpx = 30;
var gpy = 30;
var gpttext = "";
var cf = "22px Verdana";



function updatescore() {
//var sis=document.getElementById('score');
//sis.innerHTML = "Score is " + score.toString() + " from " + goes.toString() + " goes<a target=_blank id='myadot' href='http://chemistry.about.com/od/mathsciencefundamentals/a/ologylist_3.htm' title="Suffix Ology ideas ... thanks">.</a>";
var sone=document.getElementById('sone');
var stwo=document.getElementById('stwo');
var omyadot=document.getElementById('myadot');
sone.innerHTML=score.toString();
stwo.innerHTML=goes.toString();
omyadot.href='http://chemistry.about.com/od/mathsciencefundamentals/a/ologylist_3.htm';
}


function addsome() {
var two=" ", three=" ", one=" ";
if (yourone == "" && ourd != "") {
one=prompt("Enter first of your Suffix Ology parts (adjust accordingly)", ourd);
//ourd='';
//alert(12);
//ourone=one;
setTimeout(addsome,nourd);
return;
} else if (yourone != " ") {
one=yourone;
} else {
preinput=" ";
within=false;
if (ourd != "") {
one=prompt("Enter first of your Suffix Ology parts (adjust accordingly)", ourd);
} else if (aclick) {
aclick=false;
one=prompt("Enter first of your Suffix Ology parts (adjust accordingly)", "ology");
} else {
return;
}
//ourd='';
//alert('*' + ourone + ')');
ourone=one;
return;
}
if (one != " ") {
//alert('one=@' + one + '@ and ourd=@' + ourd + '@ and yourone=@' + yourone + '@ and ourone=@' + ourone + '@');
//alert(97);
if (yourtwo == "" && ourd != "") {
two=prompt("Enter second of your Suffix Ology parts (adjust accordingly) that started with " + one, ourd);
//ourd='';
//alert(120);
//ourtwo=two;
setTimeout(addsome,nourd);
return;
} else if (yourtwo != " ") {
two=yourtwo;
//alert('two=' + two + ' ourd=' + ourd);
} else {
preinput=" ";
within=false;
if (ourd != "") {
two=prompt("Enter second of your Suffix Ology parts (adjust accordingly) that started with " + one, ourd);
} else {
two=prompt("Enter second of your Suffix Ology parts (adjust accordingly) that started with " + one, "is");
}
//ourd='';
ourtwo=two;
//alert('Two=' + two + ' ourd=' + ourd);
return;
}
if (two != " ") {
//alert('two=@' + two + '@ and ourd=@' + ourd + '@ and yourtwo=@' + yourtwo + '@ and ourtwo=@' + ourtwo + '@');
if (yourthree == "" && ourd != "") {
three=prompt("Enter third of your Suffix Ology parts (adjust accordingly) that started with " + one + " " + two, ourd);
//ourd='';
//alert(1200);
//ourthree=three;
setTimeout(addsome,nourd);
return;
} else if (yourthree != " ") {
three=yourthree;
} else {
preinput=" ";
within=false;
if (ourd != "") {
three=prompt("Enter third of your Suffix Ology parts (adjust accordingly) that started with " + one + " " + two, ourd);
} else {
three=prompt("Enter third of your Suffix Ology parts (adjust accordingly) that started with " + one + " " + two, "the study of ");
}
//ourd='';
ourthree=three;
return;
}
if (three != " ") {
//alert('*' + ourthree + '*');
//alert(ourtwo);
//alert(ourone);
sentenceparts[sentenceparts.length] = yourone;
sentenceparts[sentenceparts.length] = yourtwo;
sentenceparts[sentenceparts.length] = yourthree;
if (document.getElementById('modesel').value != '') {
var was=document.getElementById('altview').innerHTML;
document.getElementById('altview').innerHTML="<input style='background-color:yellow;' type='button' onclick=' dohuh(this); ' id='b" + eval(1 + ccnt) + "' title='' alt='" + one + " " + two + " " + three + "' value='" + three + "'></input>" + was + "<input style='background-color:pink;' type='button' onclick=' dohuh(this); ' id='b" + eval(2 + ccnt) + "' title='' alt='" + yourone + " " + yourtwo + " " + yourthree + "' value='" + yourone + " " + yourtwo + " '></input>";
ccnt++;
ccnt++;
} else {
onloading();
}
ourone=" ";
ourtwo=" ";
ourthree=" ";
if (ourd == '') {
yourone=" ";
yourtwo=" ";
yourthree=" ";
} else {
ourd='';
//yourone=" ";
//yourtwo=" ";
//yourthree=" ";
//alert(12000);
return;
}
}
}
}
}

function dohuh(ob) {
if (eval(bcnt % 2) == 0) {
nextexpected = ob.alt.replace(ob.value, '');
//alert(' next expected is ' + nextexpected);
document.getElementById(ob.id).style.display='none';
hint=ob.alt;
bcnt++;
if (nextexpected.indexOf("ology ") != -1 && nextexpected.indexOf(" is ") != -1) {
document.title="? " + ob.value;
} else {
document.title=ob.value + " ?";
}
//alert(document.title);
} else if (ob.value == nextexpected) {
bcnt++;
document.getElementById(ob.id).style.display='none';
score++;
goes++;
updatescore();
document.getElementById('myadot').href='http://www.thefreedictionary.com/' + ob.alt.replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+');
} else {
goes++;
updatescore();
}
}

function buttxxonbit() {
var sofar=";-1,1;";
var divh="";
bcnt=0;

sentencepick = 0;
threepick = 0;

for (ij=0; ij<sentenceparts.length; ij+=3) {
threepick = 1;
sentencepick = -1;
while (sofar.indexOf(";" + sentencepick + "," + threepick + ";") != -1) {
threepick = 1;
while (threepick == 1) {
threepick = Math.floor((Math.random()*3)+0);
}
sentencepick = Math.floor((Math.random()*(sentenceparts.length / 3))+0);
}
sofar+=sentencepick + "," + threepick + ";";
bcnt++;
if (threepick == 0) {
divh+="<input style='background-color:pink;' type='button' onclick=' dohuh(this); ' id='b" + bcnt + "' title='' alt='" + sentenceparts[eval(sentencepick * 3) + threepick] + " is " + sentenceparts[eval(sentencepick * 3) + threepick + 2] + "' value='" + sentenceparts[eval(sentencepick * 3) + threepick] + " is '></input>";
} else {
divh+="<input style='background-color:yellow;' type='button' onclick=' dohuh(this); ' id='b" + bcnt + "' title='' alt='" + sentenceparts[eval(sentencepick * 3) + threepick - 2] + " is " + sentenceparts[eval(sentencepick * 3) + threepick] + "' value='" + sentenceparts[eval(sentencepick * 3) + threepick] + "'></input>";
}
threepick = 1;
sentencepick = -1;
while (sofar.indexOf(";" + sentencepick + "," + threepick + ";") != -1) {
threepick = 1;
while (threepick == 1) {
threepick = Math.floor((Math.random()*3)+0);
}
sentencepick = Math.floor((Math.random()*(sentenceparts.length / 3))+0);
}
sofar+=sentencepick + "," + threepick + ";";
bcnt++;
if (threepick == 0) {
divh+="<input style='background-color:pink;' type='button' onclick=' dohuh(this); ' id='b" + bcnt + "' title='' alt='" + sentenceparts[eval(sentencepick * 3) + threepick] + " is " + sentenceparts[eval(sentencepick * 3) + threepick + 2] + "' value='" + sentenceparts[eval(sentencepick * 3) + threepick] + " is '></input>";
} else {
divh+="<input style='background-color:yellow;' type='button' onclick=' dohuh(this); ' id='b" + bcnt + "' title='' alt='" + sentenceparts[eval(sentencepick * 3) + threepick - 2] + " is " + sentenceparts[eval(sentencepick * 3) + threepick] + "' value='" + sentenceparts[eval(sentencepick * 3) + threepick] + "'></input>";
}
}

ccnt=bcnt;
bcnt=0;
divh+="<input style='background-color:orange;' type='button' onclick=' alert(hint); ' value='Hint'></input>";
document.getElementById('altview').innerHTML=divh;
}

function onloading() {
//document.getElementById('myeg').style.display='block';
//document.getElementById('abutton').click();
var oms=document.getElementById('modesel'), omsval='';
if (oms) omsval=document.getElementById('modesel').value;
if (omsval == '') {
oklist = ":";
pseudo_sentence = "";
real_sentence = "";
twothings = ["", ""];
cderived_sentences = "";
derived_sentences = [];
prefix = [];
midbit= [""];
midlist = ":";
suffix = [];
cprefix = "";
cmidbit = "";
csuffix = "";
bword="";
unknownselect = "<select id='unknown'></select>";

//buttonbit();

for (ij=0; ij<sentenceparts.length; ij+=3) {
//alert(sentenceparts[eval(ij + 0)]);
if (sentenceparts[eval(ij + 1)].indexOf("[") > -1) {
prefix[prefix.length] = sentenceparts[eval(ij + 0)];
jk = sentenceparts[eval(ij + 1)].indexOf("[");
kl = sentenceparts[eval(ij + 1)].indexOf("]");
bword = sentenceparts[eval(ij + 1)].substring((jk + 1), eval((jk + 1) + kl - jk - 1));
//alert(bword);
sentenceparts[eval(ij + 1)] = sentenceparts[eval(ij + 1)].replace(" [" + bword + "]", "");
if (sentenceparts[eval(ij + 1)].indexOf("/") > -1) {
two_things = sentenceparts[eval(ij + 1)].split("/");
if (midlist.indexOf(":" + two_things[0] + ":") == -1) {
midlist = midlist + two_things[0] + ":";
midbit.push(two_things[0]);
}
derived_sentences[derived_sentences.length] = sentenceparts[eval(ij + 0)] + (" " + two_things[0] + " ").replace(" "," ") + sentenceparts[eval(ij + 2)];
if (midlist.indexOf(":" + two_things[1] + ":") == -1) {
midlist = midlist + two_things[1] + ":";
midbit.push(two_things[1]);
}
csuffix = csuffix + sentenceparts[eval(ij + 2)] + "`";
csuffix = csuffix + sentenceparts[eval(ij + 2)].replace(bword + " ", "") + "`";
suffix = csuffix.split("`");
derived_sentences[derived_sentences.length] = sentenceparts[eval(ij + 0)] + " " + two_things[1] + " " + sentenceparts[eval(ij + 2)];
derived_sentences[derived_sentences.length] = sentenceparts[eval(ij + 0)] + " " + sentenceparts[eval(ij + 2)].replace(bword + " ", "");
} else {
csuffix = csuffix + sentenceparts[eval(ij + 2)] + "`";
csuffix = csuffix + sentenceparts[eval(ij + 2)].replace(bword + " ", "") + "`";
suffix = csuffix.split("`");
derived_sentences[derived_sentences.length] = sentenceparts[eval(ij + 0)] + " " + sentenceparts[eval(ij + 1)] + " " + sentenceparts[eval(ij + 2)];
derived_sentences[derived_sentences.length] = sentenceparts[eval(ij + 0)] + " " + sentenceparts[eval(ij + 2)].replace(bword + " ", "");
}
} else if (sentenceparts[eval(ij + 1)].indexOf("/") > -1) {
prefix[prefix.length] = sentenceparts[eval(ij + 0)];
two_things = sentenceparts[eval(ij + 1)].split("/");
if (midlist.indexOf(":" + two_things[0] + ":") == -1) {
midlist = midlist + two_things[0] + ":";
midbit.push(two_things[0]);
}
csuffix = csuffix + sentenceparts[eval(ij + 2)] + "`";
suffix = csuffix.split("`");
derived_sentences.push(sentenceparts[eval(ij + 0)] + " " + two_things[0] + " " + sentenceparts[eval(ij + 2)]);
if (midlist.indexOf(":" + two_things[1] + ":") == -1) {
midlist = midlist + two_things[1] + ":";
midbit.push(two_things[1]);
}
derived_sentences[derived_sentences.length] = sentenceparts[eval(ij + 0)] + " " + two_things[1] + " " + sentenceparts[eval(ij + 2)];
} else {
prefix[prefix.length] = sentenceparts[eval(ij + 0)];
csuffix = csuffix + sentenceparts[eval(ij + 2)] + "`";
suffix = csuffix.split("`");
if (midlist.indexOf(":" + sentenceparts[eval(ij + 1)] + ":") == -1) {
midlist = midlist + sentenceparts[eval(ij + 1)] + ":";
midbit.push(sentenceparts[eval(ij + 1)]);
}
derived_sentences[derived_sentences.length] = sentenceparts[eval(ij + 0)] + " " + sentenceparts[eval(ij + 1)] + " " + sentenceparts[eval(ij + 2)];
}
}

kl = 0;
for (ij=0; ij<prefix.length; ij++) {
if (prefix[ij] != "") {
prefix[kl] = prefix[ij];
kl = kl + 1;
}
}


kl = 0;
cprefix = "<select id='sfirst' style='display:none; text-align:right;'>";
for (ij=0; ij<prefix.length; ij++) {
if (prefix[ij] != "") {
cprefix = cprefix + "<option value=" + kl + ">" + prefix[ij] + "</option>";
kl = kl + 1;
}
}
prefix[prefix.length] = "";
ppl = kl;
cprefix = cprefix + "<option value=" + kl + "></option>";
cprefix = cprefix + "</select>";
kl = 0;
cmidbit = "<select id='smiddle' style='display:none; text-align:center;'>";
for (ij=0; ij<midbit.length; ij++) {
cmidbit = cmidbit + "<option value=" + kl + ">" + midbit[ij] + "</option>";
kl = kl + 1;
}
cmidbit = cmidbit + "</select>";
kl = 0;
csuffix = "<select id='slast' style='display:none;'>";
for (ij=0; ij<suffix.length; ij++) {
if (suffix[ij] != "") {
csuffix = csuffix + "<option value=" + kl + ">" + suffix[ij] + "</option>";
kl = kl + 1;
}
}
csuffix = csuffix + "</select>";
kl = 0;
cderived_sentences = "<select id='sentences' style='display:none;'>";
for (ij=0; ij<derived_sentences.length; ij++) {
cderived_sentences = cderived_sentences + "<option value=" + kl + ">" + derived_sentences[ij] + "</option>";
kl = kl + 1;
}
cderived_sentences = cderived_sentences + "</select>";
//alert(cprefix);
//alert(cmidbit);
//alert(csuffix);
//alert(cderived_sentences);
document.getElementById('dsentence').innerHTML = document.getElementById('dsentence').innerHTML + cprefix;
document.getElementById('dsentence').innerHTML = document.getElementById('dsentence').innerHTML + cmidbit;
document.getElementById('dsentence').innerHTML = document.getElementById('dsentence').innerHTML + csuffix;
document.getElementById('dsentence').innerHTML = document.getElementById('dsentence').innerHTML + cderived_sentences;
pick_a_sentence();
elem.click();
}
}

function andthen() {
elem.click();
}

function check_answer(osel) {
if (osel.value != "") {
//alert(oklist);
goes = goes + 1;
if (oklist.indexOf(":" + osel.value + ":") == -1) {
var tds=document.getElementsByTagName('td');
var sels=document.getElementsByTagName('select');
var altans='', found=false;
for (var itd=0; itd<tds.length; itd++) {
if (tds[itd].innerHTML.indexOf('<select ') != -1) {
altans+=sels[0].value;
} else {
altans+=tds[itd].innerHTML;
}
}
for (var iitd=0; iitd<derived_sentences.length; iitd++) {
if (!found) {
if (altans.replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ','') == derived_sentences[iitd].replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ','')) {
found=true;
}
}
}
if (found) {
score = score + 1;
updatescore();
document.getElementById('myadot').href='http://www.thefreedictionary.com/' + real_sentence.replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+');
real_sentence = "Yay!!!";
placerealtext();
setTimeout(andthen, 2000);
} else {
updatescore();
document.getElementById('myadot').href='http://www.thefreedictionary.com/' + real_sentence.replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+');
placerealtext();
setTimeout(andthen, 9000);
}
} else {
score = score + 1;
updatescore();
document.getElementById('myadot').href='http://www.thefreedictionary.com/' + real_sentence.replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+');
real_sentence = "Yay!!!";
placerealtext();
setTimeout(andthen, 2000);
}
}
}


function pick_a_sentence() {
var p="", s="", mb="", ii, jj=eval(prefix.length - 1), kk=-1, ll=-1, mm, nn, arrml, iarrml, jarrml;
arrml = midlist.split(":");
pseudo_sentence = " ";
while (pseudo_sentence.replace("...", "").trim().indexOf(" ") == -1) {
oklist = ":";
p="";
s="";
mb="";
jj=eval(prefix.length - 1);
kk=-1;
ll=-1;
sentencepick = Math.floor((Math.random()*kl)+0);
for (ii=0; ii<prefix.length; ii++) {
if (derived_sentences[sentencepick].indexOf(prefix[ii]) != -1 && prefix[ii] != "") jj = ii;
}
for (ii=0; ii<suffix.length; ii++) {
if (ll == -1 && derived_sentences[sentencepick].indexOf(suffix[ii]) != -1 && suffix[ii] != "") {
ll = ii;
mb = derived_sentences[sentencepick].replace(prefix[jj] + " ", "").replace(suffix[ll], "").trim();
}
}
for (ii=0; ii<midbit.length; ii++) {
if (midbit[ii] == mb) kk = ii;
}
//alert(derived_sentences[sentencepick]);
real_sentence = derived_sentences[sentencepick];
threepick = 1;
while (threepick == 1) {
threepick = Math.floor((Math.random()*3)+0);
}
unknownselect = "<select id='unknown'></select>";
if (threepick == 0) {
pseudo_sentence = ("... " + midbit[kk] + " " + suffix[ll]).replace(" ", " ").replace(" ", " ").replace("undefined", "");
s = "<td>" + (" " + midbit[kk] + " " + suffix[ll]).replace(" ", " ") + "</td>";
//unknownselect = "<td>" + cprefix.replace("sfirst", "unknown").replace("none;", "block;").replace("</select>", "<option value='' selected>Please select a sentence prefix above (instead of ... below)</option></select></td>");
unknownselect = "<td>" + cprefix.replace("<select", "<select onchange='check_answer(this);'").replace("sfirst", "unknown").replace("none;", "block;").replace("</select>", "<option value='' selected>... </option></select></td>");
if (jj == eval(prefix.length - 1)) {
//alert(jj);
//alert(prefix);
oklist = oklist + ppl + ":";
} else {
for (mm=0; mm<derived_sentences.length; mm++) {
for (nn=0; nn<prefix.length; nn++) {
if (pseudo_sentence.replace("...", prefix[nn]).replace(" ", " ").replace(" ", " ").trim() == derived_sentences[mm].trim() && oklist.indexOf(":" + nn + ":") == -1) {
oklist = oklist + nn + ":";
//alert("Yes " + pseudo_sentence.replace("...", prefix[nn]).replace(" ", " ").replace(" ", " ").trim() + " Vs " + derived_sentences[mm].trim() + " oklist=" + oklist + " vs " + nn);
} //else {
//alert(midbit[1] + "? " + mb + "? " + kk + "? " + pseudo_sentence.replace("...", prefix[nn]).replace(" ", " ").replace(" ", " ").trim() + " Vs " + derived_sentences[mm].trim() + " oklist=" + oklist + " vs " + nn);
//}
}
}
}
} else if (threepick == 1) {
pseudo_sentence = (prefix[jj] + " ... " + suffix[ll]).replace(" ", " ").replace(" ", " ").replace("undefined", "");
p = "<td>" + prefix[jj] + " " + "</td>";
s = "<td>" + " " + suffix[ll] + "</td>";
//unknownselect = "<td>" + cmidbit.replace("smiddle", "unknown").replace("none;", "block;").replace("</select>", "<option value='' selected>Please select a sentence middle word (or not) above (instead of ... below)</option></select></td>");
unknownselect = "<td>" + cmidbit.replace("<select", "<select onchange='check_answer(this);'").replace("smiddle", "unknown").replace("none;", "block;").replace("</select>", "<option value='' selected> ... </option></select></td>");
for (mm=0; mm<derived_sentences.length; mm++) {
for (nn=0; nn<midbit.length; nn++) {
if (pseudo_sentence.replace("...", midbit[nn]).replace(" ", " ").replace(" ", " ").trim() == derived_sentences[mm].trim() && oklist.indexOf(":" + nn + ":") == -1) oklist = oklist + nn + ":";
}
}
} else {
pseudo_sentence = (prefix[jj] + " " + midbit[kk] + " ...").replace(" ", " ").replace(" ", " ").replace("undefined", "");
p = "<td>" + (prefix[jj] + " " + midbit[kk] + " ").replace(" ", " ") + "</td>";
//unknownselect = "<td>" + csuffix.replace("slast", "unknown").replace("none;", "block;").replace("</select>", "<option value='' selected>Please select a sentence ending above (instead of ... below)</option></select></td>");
unknownselect = "<td>" + csuffix.replace("<select", "<select onchange='check_answer(this);'").replace("slast", "unknown").replace("none;", "block;").replace("</select>", "<option value='' selected> ...</option></select></td>");
for (mm=0; mm<derived_sentences.length; mm++) {
for (nn=0; nn<suffix.length; nn++) {
if (pseudo_sentence.replace("...", suffix[nn]).replace(" ", " ").replace(" ", " ").trim() == derived_sentences[mm].trim() && oklist.indexOf(":" + nn + ":") == -1) oklist = oklist + nn + ":";
}
}
}


if (("*" + pseudo_sentence.trim() + "*").indexOf("...*") != -1 || ("*" + pseudo_sentence.trim() + "*").indexOf("*...") != -1) {
//alert(pseudo_sentence);
jarrml = -1;
for (iarrml=0; iarrml<arrml.length; iarrml++) {
if (jarrml == -1 && arrml[iarrml].trim() != "") {
jarrml = (" " + pseudo_sentence + " ").indexOf(" " + arrml[iarrml] + " ");
//if (jarrml != -1) alert(arrml[iarrml]);
}
}
if (jarrml == -1) pseudo_sentence = " ";
}

//if (pseudo_sentence.replace("...", "").trim().indexOf(" ") != -1) alert(pseudo_sentence);

}

pseudo_sentence = pseudo_sentence.replace("_", " ").replace("_", " ").replace("_", " ").replace("_", " ").replace("_", " ");

document.getElementById('dunknown').innerHTML = "<table><tr>" + p.replace("undefined", "") + unknownselect.replace("<td> undefined", "<td> ").replace("<td>undefined ", "<td> ") + s.replace("undefined", "") + "</tr></table>";
placetext();

}

function gameshowmode(tval) {
if (tval == '') {
location.href=document.URL; //'./ology_chalkboard.html';
} else {
document.getElementById('mainview').style.display='none';
elem.style.display='none';
document.getElementById('altview').style.display='block';
}
}

function unfixpar30() {
//var qis=location.search.split('q=')[1] ? location.search.split('q=')[1].split('&')[0] : '';
//var dis=location.search.split('d=')[1] ? location.search.split('d=')[1].split('&')[0] : '';
//if (qis != '' || dis != '') {
//var ansis=prompt("huh " + decodeURIComponent(qis), decodeURIComponent(dis));
//if (ansis == null) ansis = '';
if (top.document.getElementById('promptinput')) {
//alert(ansis);
preinput="";
top.document.getElementById('promptinput').value="";
//alert(ansis);
if (yourone == " " || (yourone == "" && ourd != "")) {
yourone="";
} else if (yourtwo == " " || (yourtwo == "" && ourd != "")) {
yourtwo="";
//alert('yourtwo=' + yourtwo + ' ourd=' + ourd);
} else if (yourthree == " " || (yourthree == "" && ourd != "")) {
yourthree="";
}
ourd=top.document.getElementById('myin').value;
nourd=30000;
setTimeout(addsome,100);
}
//}
}

function unfixpar5() {
//var qis=location.search.split('q=')[1] ? location.search.split('q=')[1].split('&')[0] : '';
//var dis=location.search.split('d=')[1] ? location.search.split('d=')[1].split('&')[0] : '';
//if (qis != '' || dis != '') {
//var ansis=prompt("huh " + decodeURIComponent(qis), decodeURIComponent(dis));
//if (ansis == null) ansis = '';
if (top.document.getElementById('promptinput')) {
//alert(ansis);
preinput="";
top.document.getElementById('promptinput').value="";
//alert(ansis);
if (yourone == " " || (yourone == "" && ourd != "")) {
yourone="";
} else if (yourtwo == " " || (yourtwo == "" && ourd != "")) {
yourtwo="";
//alert('yourtwo=' + yourtwo + ' ourd=' + ourd);
} else if (yourthree == " " || (yourthree == "" && ourd != "")) {
yourthree="";
}
ourd=top.document.getElementById('myin').value;
nourd=5000;
setTimeout(addsome,100);
}
//}
}

function unfixpar() {
//var qis=location.search.split('q=')[1] ? location.search.split('q=')[1].split('&')[0] : '';
//var dis=location.search.split('d=')[1] ? location.search.split('d=')[1].split('&')[0] : '';
//if (qis != '' || dis != '') {
//var ansis=prompt("huh " + decodeURIComponent(qis), decodeURIComponent(dis));
//if (ansis == null) ansis = '';
if (top.document.getElementById('promptinput')) {
//alert(ansis);
preinput="";
top.document.getElementById('promptinput').value="";
//alert(ansis);
if (yourone == " " || (yourone == "" && ourd != "")) {
yourone="";
} else if (yourtwo == " " || (yourtwo == "" && ourd != "")) {
yourtwo="";
//alert('yourTwo=' + yourtwo + ' ourd=' + ourd);
} else if (yourthree == " " || (yourthree == "" && ourd != "")) {
yourthree="";
}
ourd='';
setTimeout(addsome,100);
}
//}
}

function fixpar() {
//var qis=location.search.split('q=')[1] ? location.search.split('q=')[1].split('&')[0] : '';
//var dis=location.search.split('d=')[1] ? location.search.split('d=')[1].split('&')[0] : '';
//if (qis != '' || dis != '') {
//var ansis=prompt("huh " + decodeURIComponent(qis), decodeURIComponent(dis));
//if (ansis == null) ansis = '';
if (top.document.getElementById('promptinput')) {
//alert(ansis);
preinput=top.document.getElementById('myin').value;
top.document.getElementById('promptinput').value=top.document.getElementById('myin').value;
//alert(ansis);
if (yourone == " " || (yourone == "" && ourd != "")) {
yourone=top.document.getElementById('myin').value;
} else if (yourtwo == " " || (yourtwo == "" && ourd != "")) {
yourtwo=top.document.getElementById('myin').value;
//alert('YourTwo=' + yourtwo + ' ourd=' + ourd);
} else if (yourthree == " " || (yourthree == "" && ourd != "")) {
yourthree=top.document.getElementById('myin').value;
}
ourd='';
setTimeout(addsome,100);
}
//}
}

function fixparent(ansis) {
//var qis=location.search.split('q=')[1] ? location.search.split('q=')[1].split('&')[0] : '';
//var dis=location.search.split('d=')[1] ? location.search.split('d=')[1].split('&')[0] : '';
//if (qis != '' || dis != '') {
//var ansis=prompt("huh " + decodeURIComponent(qis), decodeURIComponent(dis));
//if (ansis == null) ansis = '';
if (top.document.getElementById('promptinput')) {
//alert(ansis);
ourd='';
preinput=ansis;
top.document.getElementById('promptinput').value=ansis;
//setTimeout(addsome,100);
}
//}
}

</script>
</head>
<body align="center">
<div style="top:0;left:0;" id='myeg' title='My modal dialog'><input type='text' id='myin' value='' onblur=' fixparent(this.value); '></input></div>
<a href="#" class="button" id='abutton'></a><input type="hidden" id="promptinput" value=" "></input>
<h1 align="center">Suffix Ology Dot<a id='adot' title="Add your own Suffix Ology" onclick="aclick=true; addsome();" href="#">Dot</a>Dot <!--select onchange=' gameshowmode(this.value); ' id='modesel'><option value=''>Dropdown</option><option value='Button'>Button</option></select--> Game</h1>
<h2 align="center" id="score">Score is <span id=sone>0</span> from <span id=stwo>0</span> goes<a target=_blank id='myadot' href='http://chemistry.about.com/od/mathsciencefundamentals/a/ologylist_3.htm' title="Suffix Ology ideas ... thanks">.</a><div id='langdiv'></div></h2>
<!--div id='mainview' style='display:block;'--><div align="center" id='dsentence'></div><div align="center" id='dunknown'></div><!--/div>

<div id='altview' style='display:none;'></div-->

<canvas style='border: 5px solid green; background-color: black; opacity: 0.3;' title="Click for your next Suffix Ology to solve" id="canvaselement" width="1350" height="510"></canvas>
<script language="JavaScript">

var toggle = 0;
var goodx = 200;
var goody = 200;
var inidone = 0;
var curcard = 0;
var suffix = "";


var scoretoget = 20;

var elem = document.getElementById('canvaselement');
var elemLeft = elem.offsetLeft;
var elemTop = elem.offsetTop;
var context = elem.getContext('2d');
var arr=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];


// Add event listener for `click` events.
elem.addEventListener('click', function(event) {
elem.width = elem.width;
elem.style.backgroundImage = "none";
elem.style.opacity = 1.0;
var x = event.pageX - elemLeft;
var y = event.pageY - elemTop;

x = goodx;
y = goody;

var r = Math.floor((Math.random()*256)+0);
var g = Math.floor((Math.random()*256)+0);
var b = Math.floor((Math.random()*256)+0);
var thiscol ='#' + arr[(r-(r % 16)) / 16] + arr[r % 16] + arr[(g-(g % 16)) / 16] + arr[g % 16] + arr[(b-(b % 16)) / 16] + arr[b % 16];

elem.style.backgroundColor = thiscol;

pick_a_sentence();

}, false);




function placetext() {
context.font = cf;
context.strokeText(pseudo_sentence.replace("ø", "ø"),gpx,gpy);
//gpy = gpy + 50;
}


function placerealtext() {
context.font = cf;
context.strokeText(real_sentence.replace("ø", "ø"),gpx,(gpy + 70));
//gpy = gpy + 50;
}

function fixthings() {
}

$(document).ready(function() {
$("#myeg").dialog({
autoOpen: false,
modal: true,
position: [0,0],
draggable: true,
show: "blind",
hide: "explode",
height: "auto",
width: "auto",
resizable: true,
overlay: {
opacity: 0.9,
background: "black"
},
buttons: {
"Will Append More in 30": function(event, ui) {
unfixpar30();
$(this).dialog('close');
},
"Will Append More in 5": function(event, ui) {
unfixpar5();
$(this).dialog('close');
},
"Cancel": function(event, ui) {
unfixpar();
$(this).dialog('close');
},
"OK": function(event, ui) {
fixpar();
$(this).dialog('close');
}
}
});

$('#abutton').click(function(event) {
fixthings();
event.preventDefault();
$('#myeg').dialog('open');
return false;
});

});


updatescore();

setTimeout(onloading, 1000);
</script>
</body>
</html>