<!doctype html>
<html>
<head>
<title>Future Choices Game - Choice of Two via Timed Clicking of Correct One - RJM Programming - November, 2015 - Thanks to http://stackoverflow.com/questions/20217869/how-to-spin-an-image-horizontally-with-css</title>
<meta charset="UTF-8">
<style>
.but1 {
background-color: pink;
border: 2px solid green;
text-decoration: none;
color: blue;
}
.but2 {
background-color: orange;
border: 2px solid green;
margin-top: +15px;
text-decoration: none;
color: blue;
}

strike {
color: red;
}

table {
background-color: lightgreen;
}

.dirh {
-moz-animation: spinHorizontal 2.8s infinite linear;
-o-animation: spinHorizontal 2.8s infinite linear;
-webkit-animation: spinHorizontal 2.8s infinite linear;
animation: spinHorizontal 2.8s infinite linear;
}

@keyframes spinHorizontal {
0% { transform: rotateY(0deg); }
100% { transform: rotateY(360deg); }
}
</style>

<script type='text/javascript'>
var opts=2;
opts=location.search.split('opts=')[1] ? location.search.split('opts=')[1].split('&')[0] : opts;

var optslist=';';
var nextopts=-1;

var ct="centertd", duzero="";

var score=0, goes=0, putback='', timesecs=0, firstgo=true, zero=0, fullcycle=4800, bitcycle=eval(fullcycle / 4);

var sentences=[
"Look at the quote. It [will cost/is going to cost/1] $14000 to fix the roof.",
"We think it [will cost/is going to cost/0] around $200 for a new gate.",
"Jen [will have/is going to have/1] a baby.",
"In all likelihood, the baby [will have/is going to have/0] Jen's eyes.",
"[I will play/I'm playing/1] squash with Jules on Saturday.",
"[He'll win./He's winning./0] The result is always the same.",
"Don't let on about it to him. [He'll tell/He's going to tell/0] everyone he meets.",
"What's going on? The bus [won't stop/isn't going to stop/1]!",
"In an ideal world one day everybody [will have/is going to have/0] suitable housing.",
"[She'll get married/She's getting married/1] next Wednesday with just a few close friends invited.",
"[It will rain/It's going to rain/1] if the clouds are anything to go by.",
"That cold front has arrived, and there is a good chance [it will snow/it's going to snow/0]."
];

var aswas=new Array();
var answers=new Array();
var goodanswers=new Array();

var afts=new Array();

var strike='', mode='', aconto=null;
mode=location.search.split('mode=')[1] ? location.search.split('mode=')[1].split('&')[0] : '';
var passeds='';
var thistitle='Future Choices';

function changes() {
if (firstgo) {
firstgo=false;
for (var i=0; i<sentences.length; i++) {
twosome=aswas[i].split(';');
document.getElementById(ct + eval(1 + i)).innerHTML=twosome[0];
document.getElementById(ct + eval(1 + i)).title=twosome[0];
document.getElementById(ct + eval(1 + i)).style.fontSize='28px';
document.getElementById(ct + eval(1 + i)).style.backgroundColor='pink';
}
for (var ii=0; ii<sentences.length; ii++) {
fixfor(ii);
}
}
timesecs+=bitcycle;
//document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace('Future','F@ture').replace('Futuristic','Future').replace('F@ture','Futuristic');
if (eval(timesecs) >= fullcycle) {
zero=eval(1 - zero);
for (var ii=0; ii<sentences.length; ii++) {
twosome=aswas[ii].split(';');
//alert(document.getElementById(ct + eval(1 + ii)).style.backgroundColor); // rgb(255, 192, 203)
if (document.getElementById(ct + eval(1 + ii)).style.backgroundColor != 'lightgreen' && document.getElementById(ct + eval(1 + ii)).style.backgroundColor != 'rgb(144, 238, 144)') {
document.getElementById(ct + eval(1 + ii)).innerHTML=twosome[zero];
document.getElementById(ct + eval(1 + ii)).title=twosome[zero];
if (mode.toLowerCase().replace('flip','').replace('strike','') != '') {
document.getElementById(ct + eval(1 + ii)).setAttribute('class', 'none' + eval(1 + ii));
}
if (zero == 0) {
document.getElementById(ct + eval(1 + ii)).style.backgroundColor='pink';
} else {
document.getElementById(ct + eval(1 + ii)).style.backgroundColor='orange';
}
}
fixfor(ii);
}
timesecs=0;
}
setTimeout(changes, bitcycle);
}

function doputback() {
if (putback != '') {
eval(putback);
putback='';
}
}

function check(thiso, correctone, isfinal) {
var twosome, was='', numis=0, ihbits, pihbits;
//alert(document.getElementById('centertd3').innerHTML);
//alert(thiso.id);
if (thiso.id.indexOf('for') != -1) {
var pbits=thiso.id.split('for');
numis=eval(pbits[eval(-1 + pbits.length)]);
} else {
numis=eval(thiso.id.replace('opt0','').replace('opt','').replace('sel','').replace('centerdiv','').replace(ct,'').replace('cb1_','').replace('cb2_','').replace('cb','').replace('but1_','').replace('but2_','').replace('but','').replace('radio',''));
}
//alert(document.getElementById(ct + eval(0 + numis)).innerHTML);
if (mode.toLowerCase().indexOf('pie') == 0) {
//alert(numis + ' ... ' + correctone);
numis=eval(thiso.id.replace('opt0','').replace('opt','').replace('sel',''));
doputback();
goes++;
var tt='';
if (thiso.id.indexOf('selopt0') != -1) {
if (!document.getElementById('opt0sel' + numis).innerHTML) {
ihbits=document.body.innerHTML.split(' id="' + 'opt0sel' + numis + '"');
pihbits=ihbits[1].split('</text>');
ihbits=pihbits[0].split('>');
tt=ihbits[eval(-1 + ihbits.length)];
//alert('optsel' + numis);
} else {
tt=document.getElementById('opt0sel' + numis).innerHTML;
}
} else if (thiso.id.indexOf('selopt') != -1) {
if (!document.getElementById('optsel' + numis).innerHTML) {
// alert(98);
ihbits=document.body.innerHTML.split(' id="' + 'optsel' + numis + '"');
// alert(ihbits.length);
pihbits=ihbits[1].split('</text>');
ihbits=pihbits[0].split('>');
tt=ihbits[eval(-1 + ihbits.length)];
//alert('optsel' + numis);
} else {
// alert(97);
tt=document.getElementById('optsel' + numis).innerHTML;
// alert(tt);
}
//alert(tt);
} else if (thiso.id.indexOf('opt0sel') != -1) {
if (!document.getElementById('opt0sel' + numis).innerHTML) {
ihbits=document.body.innerHTML.split(' id="' + 'opt0sel' + numis + '"');
pihbits=ihbits[1].split('</text>');
ihbits=pihbits[0].split('>');
tt=ihbits[eval(-1 + ihbits.length)];
//alert('optsel' + numis);
} else {
tt=document.getElementById('opt0sel' + numis).innerHTML;
}
} else if (thiso.id.indexOf('optsel') != -1) {
if (!document.getElementById('optsel' + numis).innerHTML) {
// alert(98);
ihbits=document.body.innerHTML.split(' id="' + 'optsel' + numis + '"');
// alert(ihbits.length);
pihbits=ihbits[1].split('</text>');
ihbits=pihbits[0].split('>');
tt=ihbits[eval(-1 + ihbits.length)];
//alert('optsel' + numis);
} else {
// alert(97);
tt=document.getElementById('optsel' + numis).innerHTML;
// alert(tt);
}
} else {
tt=thiso.innerHTML;
}
//alert(thiso.id + '..' + thiso.innerHTML + ' .+. ' + tt + ' ... numis=' + numis + ' ' + goodanswers[eval(-1 + numis)]);
//if (thiso.innerHTML == goodanswers[eval(-1 + numis)] || tt == goodanswers[eval(-1 + numis)]) {
if (tt == goodanswers[eval(-1 + numis)]) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
document.getElementById(ct + numis).setAttribute('class', 'noclass');
document.getElementById(ct + numis).style.backgroundColor='lightgreen';
document.getElementById(ct + numis).innerHTML=goodanswers[eval(-1 + numis)];
document.getElementById(ct + numis).onclick="alert('Done that.');";
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
alert('Try again.');
}
} else if (document.getElementById(ct + eval(0 + numis)).innerHTML.indexOf('<select ') != -1) {
numis=eval(thiso.id.replace('opt0','').replace('opt','').replace('sel',''));
doputback();
goes++;
//alert(thiso.title + ' ... numis=' + numis + ' ' + goodanswers[eval(-1 + numis)]);
if (thiso.innerHTML == goodanswers[eval(-1 + numis)]) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
thiso.setAttribute('class', 'noclass');
document.getElementById(ct + numis).style.backgroundColor='lightgreen';
document.getElementById(ct + numis).innerHTML=goodanswers[eval(-1 + numis)];
document.getElementById(ct + numis).onclick="alert('Done that.');";
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
alert('Try again.');
}
} else if (document.getElementById(ct + eval(0 + numis)).innerHTML.indexOf('"checkbox"') != -1) {
numis=eval(thiso.id.replace('cb1_','').replace('cb2_','').replace('cb',''));
doputback();
goes++;
//alert(thiso.title + ' ... numis=' + numis + ' ' + goodanswers[eval(-1 + numis)]);
if (thiso.title == goodanswers[eval(-1 + numis)]) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
thiso.setAttribute('class', 'noclass');
document.getElementById(ct + numis).style.backgroundColor='lightgreen';
document.getElementById(ct + numis).innerHTML=goodanswers[eval(-1 + numis)];
document.getElementById(ct + numis).onclick="alert('Done that.');";
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
alert('Try again.');
}
} else if (document.getElementById(ct + eval(0 + numis)).innerHTML.indexOf('"button"') != -1) {
numis=eval(thiso.id.replace('but1_','').replace('but2_','').replace('but',''));
doputback();
goes++;
//alert(thiso.title + ' ... numis=' + numis + ' ' + goodanswers[eval(-1 + numis)]);
if (thiso.value == goodanswers[eval(-1 + numis)]) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
thiso.setAttribute('class', 'noclass');
document.getElementById(ct + numis).style.backgroundColor='lightgreen';
document.getElementById(ct + numis).innerHTML=goodanswers[eval(-1 + numis)];
document.getElementById(ct + numis).onclick="alert('Done that.');";
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
alert('Try again.');
}
} else if (document.getElementById(ct + eval(0 + numis)).innerHTML.indexOf('"radio"') != -1) {
//document.getElementById(ct + eval(0 + numis)).setAttribute('class', '');
numis=eval(thiso.id.replace('radio',''));
doputback();
goes++;
//alert(thiso.title + ' ... numis=' + numis + ' ' + goodanswers[eval(-1 + numis)]);
if (thiso.title == goodanswers[eval(-1 + numis)]) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
thiso.setAttribute('class', 'noclass');
document.getElementById(ct + numis).style.backgroundColor='lightgreen';
document.getElementById(ct + numis).innerHTML=goodanswers[eval(-1 + numis)];
document.getElementById(ct + numis).onclick="alert('Done that.');";
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
alert('Try again.');
}
} else if (document.getElementById(ct + eval(0 + numis)).innerHTML.indexOf('<a ') == -1) {
numis=eval(thiso.id.replace('centerdiv','').replace(ct,''));
doputback();
goes++;
//alert(thiso.title + ' ... numis=' + numis + ' ' + goodanswers[eval(-1 + numis)]);
if (thiso.title == goodanswers[eval(-1 + numis)]) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
thiso.setAttribute('class', 'noclass');
document.getElementById(ct + numis).style.backgroundColor='lightgreen';
document.getElementById(ct + numis).onclick="alert('Done that.');";
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
alert('Try again.');
}
} else {
var idis, otherid, versusone;
idis=thiso.id;
otherid=idis.replace('but1for', 'buttwofor').replace('but2for', 'butonefor').replace('butone', 'but1').replace('buttwo', 'but2');
versusone=document.getElementById(otherid).title;
if (strike.replace(' ','') != '') {
versusone='';
var ip=thiso.title.indexOf('NOT ');
if (ip != -1) {
if (ip == 0) {
versusone=thiso.title.replace('NOT ','');
} else {
var abits=thiso.title.split('NOT ');
versusone=abits[eval(-1 + abits.length)];
}
}
}
if (isfinal == 0) {
//alert(otherid);
doputback();
if (mode.toLowerCase().replace('strike','') == '') putback="document.getElementById('" + otherid + "').innerHTML=strike + document.getElementById('" + otherid + "').innerHTML.replace('<strike>','').replace('</strike>','') + strike.replace('<strike','</strike');"
document.title=otherid + ' ... ' + doputback;
//alert(putback);
setTimeout(doputback, 2000);
document.getElementById(otherid).innerHTML=document.getElementById(otherid).innerHTML.replace('<strike>','').replace('</strike>','');
} else if (strike.replace(' ','') != '') {
doputback();
goes++;
if (versusone != correctone) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
was=document.getElementById(otherid).innerHTML;
was=was.replace('<strike>','');
was=was.replace('</strike>','');
document.getElementById(otherid).innerHTML=was;
document.getElementById(idis).innerHTML='';
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
alert('Try again.');
}
} else {
doputback();
goes++;
if (versusone != correctone) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
was=document.getElementById(idis).innerHTML;
was=was.replace('<strike>','');
was=was.replace('</strike>','');
document.getElementById(idis).innerHTML=was;
document.getElementById(otherid).innerHTML='';
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes;
alert('Try again.');
}
}
}
}

function reordermaybe() {
var i, nopts=opts, copts=';', xopts=opts, bits, postbits,choices, xsentences=new Array();
while (eval(nopts) >= 0) {
for (i=0; i<sentences.length; i++) {
bits=sentences[i].split(']');
if (eval(bits.length) == 2) {
postbits=bits[0].split('[');
if (eval(postbits.length) == 2) {
choices=postbits[eval(-1 + postbits.length)].split('/');
if (eval(choices.length) == 3 && xopts == 2 && optslist.indexOf(';' + eval(0 + xopts) + ';') == -1) {
xsentences.push(sentences[i]);
} else if (eval(choices.length) > 3 && eval(choices.length) == eval(1 + opts) && copts.indexOf(';' + eval(0 + xopts) + ';') == -1) {
xsentences.push(sentences[i]);
} else if (eval(nopts) < 0 && copts.indexOf(';' + eval(-1 + choices.length) + ';') == -1) {
nopts=eval(-1 + choices.length);
}
}
}
}
copts += xopts + ';';
if (eval(nopts) >= 0) {
xopts=nopts;
nopts=-1;
}
}
}

function buildpage() {
strike=location.search.split('strike=')[1] ? '<strike>' : '';
if (mode.replace('strike','').replace('flip','') != '') strike=' ';
if (mode.toLowerCase() == 'strike') strike='<strike>';
if (mode.toLowerCase() == 'flip') strike='';
passeds=location.search.split('sentences=')[1] ? location.search.split('sentences=')[1].split('&')[0] : '';
if (passeds != '') eval('sentences=[' + decodeURIComponent(passeds) + ']');
reordermaybe();
thistitle=location.search.split('title=')[1] ? location.search.split('title=')[1].split('&')[0] : 'Future Choices';
if (thistitle != 'Future Choices') thistitle=decodeURIComponent(thistitle);
if (mode != '') afters();
var tbo=document.getElementById('mytbody');
var bits, postbits, choices;
if (thistitle != 'Future Choices') document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace('Future Choices', thistitle);
if (strike.replace(' ','') != '') {
document.getElementById('score').innerHTML=document.getElementById('score').innerHTML.replace('Correct One (as it appears)','Wrong One');
}
if (mode.toLowerCase().indexOf('pie') == 0) {
getpc();
} else {
for (var i=0; i<sentences.length; i++) {
bits=sentences[i].split(']');
if (eval(bits.length) == 2) {
postbits=bits[0].split('[');
if (eval(postbits.length) == 2) {
choices=postbits[eval(-1 + postbits.length)].split('/');
if (eval(choices.length) >= 3) {
if (eval(choices.length) == 3) {
aswas.push(choices[0] + ";" + choices[1]);
goodanswers.push(choices[eval(0 + eval(choices[2]))]);
} else {
aswas.push((postbits[eval(-1 + postbits.length)] + ']').replace('/' + choices[eval(-1 + choices.length)] + ']','').replace(/\//g, ';'));
goodanswers.push(choices[eval(0 + eval(choices[eval(-1 + choices.length)]))]);
}
if (strike != '') {
if (eval(choices.length) == 3) {
answers.push(choices[eval(choices[2])]);
} else {
answers.push(choices[eval(choices[eval(-1 + choices.length)])]);
}
tbo.innerHTML+=mtom(i,'<tr><td align="right" id="lefttd' + eval(1 + i) + '">' + postbits[0] + '</td><td align="center" id="centertd' + eval(1 + i) + '"><a onmouseover="check(this,answers[' + i + '],0);" onclick="check(this,answers[' + i + '],1);" class="but1" href="#" id="centerbut1for' + eval(1 + i) + '" title="' + choices[1] + ' NOT ' + choices[0] + '"><strike>' + choices[0] + '</strike></a><br><a onmouseover="check(this,answers[' + i + '],0);" onclick="check(this,answers[' + i + '],1);" class="but2" href="#" id="centerbut2for' + eval(1 + i) + '" title="' + choices[0] + ' NOT ' + choices[1] + '"><strike>' + choices[1] + '</strike></a></td><td id="righttd' + eval(1 + i) + '">' + bits[1] + '</td></tr>');
} else {
if (eval(choices.length) == 3) {
answers.push(choices[eval(1 - eval(choices[2]))]);
} else {
answers.push(choices[eval(choices[eval(-1 + choices.length)])]);
}
tbo.innerHTML+=mtom(i,'<tr><td align="right" id="lefttd' + eval(1 + i) + '">' + postbits[0] + '</td><td class="dirh" align="center" id="centertd' + eval(1 + i) + '" onclick="check(this,answers[' + i + '],1);"><a onmouseover="check(this,answers[' + i + '],0);" onclick="check(this,answers[' + i + '],1);" class="but1" href="#" id="centerbut1for' + eval(1 + i) + '" title="' + choices[1] + '">' + strike + choices[0] + strike.replace('<strike','</strike') + '</a><br><a onmouseover="check(this,answers[' + i + '],0);" onclick="check(this,answers[' + i + '],1);" class="but2" href="#" id="centerbut2for' + eval(1 + i) + '" title="' + choices[0] + '">' + strike + choices[1] + strike.replace('<strike','</strike') + '</a></td><td id="righttd' + eval(1 + i) + '">' + bits[1] + '</td></tr>');
}
}
}
}
}
}
if (strike.replace(' ','') == '' && mode.toLowerCase().indexOf('pie') != 0) setTimeout(changes, bitcycle);
}

function background() {
var stuff="Quoting How English Works by Michael Swan and Catherine Walter ... \nfuture: comparison of structures\n\nWe can often use more than one structure to talk about the same future event.\n\nPresent forms emphasise present ideas like intention, certainty and plans.\n\nIn predictions, we prefer present forms when there is outside evidence for what will happen - when we can see something coming.\n\nWe prefer will when we are talking about what is inside our heads: our beliefs, guesses, knowledge etcetera.";
alert(stuff);
}

function toggle() {
var du='';
var ours=prompt('Optionally specify [Letter] as per Horizontal [F]lip or [S]trike Reject or [P]ie or Pi[e]flip or [R]adio or [B]utton or [C]heckbox or [D]ropdown. Optionally suffix it by ~ to make that happen now.','');
if (ours != null) {
if (ours != '') {
if (du == "") du = document.URL.replace('#','');
du=du.replace('strike=','nowayjose=').replace('mode=','nowayjosy=');
var qis='?';
if (du.indexOf('?') != -1) qis='&';
if (ours.indexOf('~') != -1) {
ours=ours.toLowerCase().replace(/~/g, "");
if (ours == 's') {
du+=qis + 'mode=strike';
} else if (ours == 'f') {
du+=qis + 'mode=flip';
} else if (ours == 'c') {
du+=qis + 'mode=checkbox';
} else if (ours == 'p') {
du+=qis + 'mode=pie';
} else if (ours == 'e') {
du+=qis + 'mode=pieflip';
} else if (ours == 'r') {
du+=qis + 'mode=radio';
} else if (ours == 'b') {
du+=qis + 'mode=button';
} else if (ours == 'd') {
du+=qis + 'mode=dropdown';
} else if (mode.toLowerCase() != 'flip') {
du+=qis + 'mode=flip';
} else {
du+=qis + 'mode=strike';
}
location.href=du;
} else {
ours=ours.toLowerCase().replace(/~/g, "");
if (ours == 's') {
du+=qis + 'mode=strike';
} else if (ours == 'f') {
du+=qis + 'mode=flip';
} else if (ours == 'c') {
du+=qis + 'mode=checkbox';
} else if (ours == 'p') {
du+=qis + 'mode=pie';
} else if (ours == 'e') {
du+=qis + 'mode=pieflip';
} else if (ours == 'r') {
du+=qis + 'mode=radio';
} else if (ours == 'b') {
du+=qis + 'mode=button';
} else if (ours == 'd') {
du+=qis + 'mode=dropdown';
} else if (mode.toLowerCase() != 'flip') {
du+=qis + 'mode=flip';
} else {
du+=qis + 'mode=strike';
}
duzero=du;
}
}
}
// if (document.URL.indexOf('strike=') != -1) {
// location.href=document.URL.replace('strike=','nowayjose=');
// } else if (document.URL.indexOf('STRIKE=') != -1) {
// location.href=document.URL.replace('STRIKE=','nowayjose=');
// } else if (document.URL.indexOf('?') == -1) {
// location.href=document.URL + '?strike=y';
// } else {
// location.href=document.URL + '&strike=y';
// }
}

function owndata() {
var ours=prompt('Optionally specify your own sentences in format like below (where number at end of slash grouping is zero-start indicator of correct answer of two before it, and [] lead should be adhered to ... ' + "\n\n" + '"Look at the quote. It [will cost/is going to cost/1] $14000 to fix the roof.","We think it [will cost/is going to cost/0] around $200 for a new gate."','');
var spare, postspare, lh='';
if (ours != null) {
if (ours != '') {
if (document.URL.indexOf('sentences=') != -1) {
spare=document.URL.split('sentences=');
postspare=spare[1].split('&');
lh=document.URL.replace('sentences=' + postspare[0], 'sentences=' + encodeURIComponent(ours));
} else if (document.URL.indexOf('SENTENCES=') != -1) {
spare=document.URL.split('SENTENCES=');
postspare=spare[1].split('&');
lh=document.URL.replace('SENTENCES=' + postspare[0], 'sentences=' + encodeURIComponent(ours));
} else if (document.URL.indexOf('?') == -1) {
lh=document.URL + '?sentences=' + encodeURIComponent(ours);
} else {
lh=document.URL + '&sentences=' + encodeURIComponent(ours);
}
owntitle(lh.replace('#',''));
}
}
}

function owntitle(du) {
var ours;
if (du == '') {
ours=prompt('Optionally specify your own title (or single email address to email this scenario to somebody). Optionally suffix it by ~[Letter] to toggle mode of use among Horizontal [F]lip or [S]trike Reject or [P]ie or Pi[e]flip or [R]adio or [B]utton or [C]heckbox or [D]ropdown (from what it is now).',thistitle);
if (ours != null) {
if (ours.indexOf('@') != -1 && ours.indexOf(' ') == -1) {
document.getElementById('afterstyles').innerHTML+='<a id="aemail" href="mailto:' + ours + "?subject=" + encodeURIComponent(document.getElementById('mya').innerHTML) + '&body=' + encodeURIComponent(document.URL) + '" style="display:none;">Email</a>';
document.getElementById('aemail').click();
ours='';
}
}
} else {
ours=prompt('Optionally specify your own title. Optionally suffix it by ~[Letter] to toggle mode of use among Horizontal [F]lip or [S]trike Reject or [P]ie or Pi[e]flip or [R]adio or [B]utton or [C]heckbox or [D]ropdown (from what it is now).',thistitle);
}
var spare, postspare, ps;
if (duzero != "") du = duzero;
if (du == "") du = document.URL.replace('#','');
if (ours != null) {
if (ours.indexOf('~') != -1) {
du=du.replace('strike=','nowayjose=').replace('mode=','nowayjosy=');
ps=ours.toLowerCase().split('~');
var qis='?';
if (du.indexOf('?') != -1) qis='&';
if (ps[1] == 's') {
du+=qis + 'mode=strike';
} else if (ps[1] == 'f') {
du+=qis + 'mode=flip';
} else if (ps[1] == 'c') {
du+=qis + 'mode=checkbox';
} else if (ps[1] == 'p') {
du+=qis + 'mode=pie';
} else if (ps[1] == 'e') {
du+=qis + 'mode=pieflip';
} else if (ps[1] == 'r') {
du+=qis + 'mode=radio';
} else if (ps[1] == 'b') {
du+=qis + 'mode=button';
} else if (ps[1] == 'd') {
du+=qis + 'mode=dropdown';
} else if (mode.toLowerCase() != 'flip') {
du+=qis + 'mode=flip';
} else {
du+=qis + 'mode=strike';
}
ours=ps[0];
// if (du.indexOf('strike=') != -1) {
// du=du.replace('strike=','nowayjose=');
// } else if (du.indexOf('STRIKE=') != -1) {
// du=du.replace('STRIKE=','nowayjose=');
// } else if (du.indexOf('?') == -1) {
// du=du + '?strike=y';
// } else {
// du=du + '&strike=y';
// }
ours=ours.replace(/~/g, "");
if (ours == '') location.href=du;
}
if (ours != '') {
if (du.indexOf('title=') != -1) {
spare=du.split('title=');
postspare=spare[1].split('&');
du=du.replace('title=' + postspare[0], 'title=' + encodeURIComponent(ours));
} else if (document.URL.indexOf('TITLE=') != -1) {
spare=du.split('TITLE=');
postspare=spare[1].split('&');
du=du.replace('TITLE=' + postspare[0], 'title=' + encodeURIComponent(ours));
} else if (du.indexOf('?') == -1) {
du=du + '?title=' + encodeURIComponent(ours);
} else {
du=du + '&title=' + encodeURIComponent(ours);
}
location.href=du.replace('#','');
}
}
}

function afters() {
var stylestoadd='', itf;
if (mode == 'checkbox') {
for (itf=0;itf<sentences.length; itf++) {
stylestoadd+="<style> #centertd" + eval(1 + itf) + ":after { content: '\\002705'; } .none" + eval(1 + itf) + ":after { content: '' !important; } </style>";
}
} else if (mode == 'radio') {
for (itf=0;itf<sentences.length; itf++) {
stylestoadd+="<style> #centertd" + eval(1 + itf) + ":after { content: '\\01F4FB'; } .none" + eval(1 + itf) + ":after { content: '' !important; } </style>";
}
} else if (mode == 'dropdown' || mode == 'select') {
for (itf=0;itf<sentences.length; itf++) {
stylestoadd+="<style> #centertd" + eval(1 + itf) + ":after { content: '\\0023ec'; } .none" + eval(1 + itf) + ":after { content: '' !important; } </style>";
}
} else if (mode == 'button') {
for (itf=0;itf<sentences.length; itf++) {
stylestoadd+="<style> #centertd" + eval(1 + itf) + ":after { content: '\\01F532'; } .none" + eval(1 + itf) + ":after { content: '' !important; } </style>";
}
}
if (stylestoadd != '') document.getElementById('afterstyles').innerHTML=stylestoadd;
}

function mtom(aswasi, defs) {
var outdefs=defs;
if (eval(aswas[aswasi].length) > 2) {
var fub=aswas[aswasi].split(';');
var wlines=defs.split('<br>');
//alert(wlines[1]);
var tdline=wlines[1].split('</td>');
//alert(fub.length + ' ... ' + wlines.length + ' .+. ' + tdline[0]);
for (var iy=3; iy<=eval(fub.length); iy++) {
outdefs=outdefs.replace('</td>' + tdline[1],'<br>' + tdline[0].replace('2for', iy + 'for').replace('2', iy).replace('>' + fub[1] + '<', '>' + fub[eval(-1 + iy)] + '<') + '</td>' + tdline[1]);
//alert(defs + ' ... ' + tdline[0] + ' .+. ' + outdefs);
//alert(outdefs);
}
}
return outdefs;
}

function fixfor(ij) {
var bef='', aft='', thato=document.getElementById(ct + eval(1 + ij));
if (document.getElementById(ct + eval(1 + ij)).style.backgroundColor != 'lightgreen' && document.getElementById(ct + eval(1 + ij)).style.backgroundColor != 'rgb(144, 238, 144)') {
if (thato != null) {
//bef = window.getComputedStyle(document.querySelector('#' + ct + eval(1 + ij)), ':before').getPropertyValue('content');
var ih=thato.innerHTML;
var fullb=aswas[ij].split(';');
if (eval(afts.length) > eval(ij)) {
aft = afts[ij];
} else {
aft = window.getComputedStyle(document.querySelector('#' + ct + eval(1 + ij)), ':after').getPropertyValue('content');
afts.push(aft);
//if (aft != null) alert(aft.substring(0,1).charCodeAt(0));
}
//if (ih.indexOf('checkbox') != -1) alert('!' + ih);
if (aft != null) {
if (aft != 'none') { // && isNaN(aft) == false) {
//if (ih.indexOf('checkbox') != -1) alert(ih);
//if (aft.substring(0,1).charCodeAt(0) != 55357 && aft.substring(0,1).charCodeAt(0) != 9989 && aft.substring(0,1).charCodeAt(0) != 9196) alert(aft.substring(0,1).charCodeAt(0));
if (mode.toLowerCase() == 'button') {
thato.innerHTML=mtom(ij,'<input type="button" title="' + fullb[zero] + '" id="but1_' + eval(1 + ij) + '" onclick="check(this,goodanswers[' + ij + '],1);" value="' + fullb[zero] + '"></input><br><input type="button" title="' + fullb[eval(1 - zero)] + '" id="but2_' + eval(1 + ij) + '" onclick="check(this,goodanswers[' + ij + '],1);" value="' + fullb[eval(1 - zero)] + '"></input>');
} else if (aft.substring(0,1).charCodeAt(0) == 55357 || aft.substring(1,2).charCodeAt(0) == 55357 || ih.indexOf('"radio"') != -1) {
//alert(aft.substring(0,1).charCodeAt(0) + 'radio ' + fullb[0] + ' ' + fullb[1] + ' ' + ih);
thato.innerHTML=mtom(ij,'<input type="radio" title="' + fullb[zero] + '" name="radio' + eval(1 + ij) + '" id="radio' + eval(1 + ij) + '" onclick="check(this,goodanswers[' + ij + '],1);">' + fullb[zero] + '</input><br><input type="radio" title="' + fullb[eval(1 - zero)] + '" name="radio' + eval(1 + ij) + '" id="radio' + eval(1 + ij) + '" onclick="check(this,goodanswers[' + ij + '],1);">' + fullb[eval(1 - zero)] + '</input>');
} else if (aft.substring(0,1).charCodeAt(0) == 9989 || aft.substring(1,2).charCodeAt(0) == 9989 || ih.indexOf('"checkbox"') != -1) {
//alert('checkbox ' + fullb[0] + ' ' + fullb[1] + ' ' + ih);
thato.innerHTML=mtom(ij,'<input type="checkbox" title="' + fullb[zero] + '" id="cb1_' + eval(1 + ij) + '" onchange="check(this,goodanswers[' + ij + '],1);" >' + fullb[zero] + '</input><br><input type="checkbox" title="' + fullb[eval(1 - zero)] + '" id="cb2_' + eval(1 + ij) + '" onchange="check(this,goodanswers[' + ij + '],1);">' + fullb[eval(1 - zero)] + '</input>');
} else if (aft.substring(0,1).charCodeAt(0) == 9196 || aft.substring(1,2).charCodeAt(0) == 9196 || ih.indexOf('<select ') != -1) {
//alert('select ' + fullb[0] + ' ' + fullb[1] + ' ' + ih);
//thato.innerHTML='<select size=2 id="sel' + eval(1 + ij) + '"><option title="' + goodanswers[ij] + '" value="">Please click selection ...</option><option title="' + goodanswers[ij] + '" value="' + fullb[zero] + '">' + fullb[zero] + '</option><option title="' + goodanswers[ij] + '" value="' + fullb[eval(1 - zero)] + '">' + fullb[eval(1 - zero)] + '</option></select>';
thato.innerHTML=mtom(ij,'<select size=2 id="sel' + eval(1 + ij) + '"><option id="opt0' + eval(1 + ij) + '" onclick="check(this,goodanswers[' + ij + '],1);" title="' + goodanswers[ij] + '" value="' + fullb[zero] + '">' + fullb[zero] + '</option><br><option id="opt' + eval(1 + ij) + '" onclick="check(this,goodanswers[' + ij + '],1);" title="' + goodanswers[ij] + '" value="' + fullb[eval(1 - zero)] + '">' + fullb[eval(1 - zero)] + '</option></select>');
} else if (aft.substring(0,1).charCodeAt(0) == 34) {
thato.innerHTML=mtom(ij,'<input type="button" title="' + fullb[zero] + '" id="but1_' + eval(1 + ij) + '" onclick="check(this,goodanswers[' + ij + '],1);" value="' + fullb[zero] + '"></input><br><input type="button" title="' + fullb[eval(1 - zero)] + '" id="but2_' + eval(1 + ij) + '" onclick="check(this,goodanswers[' + ij + '],1);" value="' + fullb[eval(1 - zero)] + '"></input>');
}
}
}
//alert(ih);
}
}
}


function doaconto(iois) {
var pieplus='x', spare, ispare=0;
if (mode.toLowerCase() == 'pieflip') pieplus='';
if (iois != null) {
aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
var zro='', cnt=0, pretext, posttext, thisone='', altone='';
var svgis='<div style="overflow: hidden;width:220px;height:180px;"><svg width="900" height="500" viewBox="180 80 1800 1000" style="overflow: hidden;" aria-label="A chart."><g></g></svg></div>';
//alert(aconto.body.innerHTML);
var pregs=aconto.body.innerHTML.split('<g>');
var gs=aconto.getElementsByTagName('g');
zro='0';
if (eval(pregs.length) > eval(gs.length)) {
gs=pregs;
ispare=1;
}
//if (gs[0]) alert(pregs[1].length);
for (var ig=ispare; ig<gs.length; ig++) {
if (ispare == 1) {
spare=gs[ig].split('</g>');
} else {
spare=gs[ig].innerHTML.split('</g>');
}
pretext=spare[0].split('<text ');
posttext=pretext[0].substring(1).split('<path ');
if (spare[0].indexOf('<path ') == 0 && eval(pretext.length) == 2) {
cnt++;
//thisone='<path ' + posttext[1] + '<text ' + pretext[1];
thisone='<' + posttext[0].replace(/Arial/g, 'Verdana').replace('path ','path title="words' + cnt + '" id="selopt' + zro + '_999" onclick="check(this,goodanswers[991],1);" ') + '<text title="words' + cnt + '" id="opt' + zro + 'sel_999" onclick="check(this,goodanswers[991],1);" ' + pretext[1].replace(/Arial/g, 'Verdana');
//if (altone.indexOf(",0,0,0,0,") != -1 && thisone.indexOf(",0,0,0,0,") != -1) alert('oops ... ' + thisone + ' ... ' + altone);
//if (altone.indexOf(",0,0,0,0,") == -1) thisone=altone;
//alert(thisone); // + ' ... ' + altone);
pretext=thisone.split('</text>');
posttext=pretext[0].split('>');
svgis=svgis.replace('</g>', thisone.replace('>' + posttext[eval(-1 + posttext.length)] + '<', '>words' + cnt + '<') + '</g>');
zro='';
}
}
//alert(svgis);
document.getElementById('prepcdiv').innerHTML=svgis;
//document.getElementById('tr2td2').innerHTML=svgis;
var tbo=document.getElementById('mytbody');
var bits, postbits, choices;
for (var i=0; i<sentences.length; i++) {
bits=sentences[i].split(']');
if (eval(bits.length) == 2) {
postbits=bits[0].split('[');
if (eval(postbits.length) == 2) {
choices=postbits[eval(-1 + postbits.length)].split('/');
if (eval(choices.length) == 3 && opts == 2 && optslist.indexOf(';' + eval(0 + opts) + ';') == -1) {
aswas.push(choices[0] + ";" + choices[1]);
goodanswers.push(choices[eval(0 + eval(choices[2]))]);
answers.push(choices[eval(1 - eval(choices[2]))]);
//alert(svgis.replace(/991/g,i).replace(/_999/g,eval(1 + i)).replace('>words1<','>' + choices[0] + '<').replace('>words2<','>' + choices[1] + '<'));
tbo.innerHTML+='<tr><td align="right" id="lefttd' + eval(1 + i) + '">' + postbits[0] + '</td><td style="background-color:gray;overflow: hidden;" class="di' + pieplus + 'rh" align="center" id="centertd' + eval(1 + i) + '" onclick="check(this,goodanswers[' + i + '],1);">' + svgis.replace(/991/g,i).replace(/_999/g,eval(1 + i)).replace('>words1<','>' + choices[0] + '<').replace('>words2<','>' + choices[1] + '<').replace(/words1/g,choices[0]).replace(/words2/g,choices[1]) + '</td><td id="righttd' + eval(1 + i) + '">' + bits[1] + '</td></tr>';
} else if (eval(choices.length) > 3 && eval(choices.length) == eval(1 + opts) && optslist.indexOf(';' + eval(0 + opts) + ';') == -1) {
aswas.push((postbits[eval(-1 + postbits.length)] + ']').replace('/' + choices[eval(-1 + choices.length)] + ']','').replace(/\//g, ';'));
goodanswers.push(choices[eval(0 + eval(choices[eval(-1 + choices.length)]))]);
answers.push(choices[eval(1 - eval(choices[eval(-1 + choices.length)]))]);
var xsvgis=svgis.replace(/991/g,i).replace(/_999/g,eval(1 + i));
for (var iw=1; iw<=eval(-1 + choices.length); iw++) {
xsvgis=xsvgis.replace('>words' + iw + '<','>' + choices[eval(-1 + iw)] + '<').replace('words' + iw + '"','' + choices[eval(-1 + iw)] + '"').replace('words' + iw + '"','' + choices[eval(-1 + iw)] + '"').replace('words' + iw + '"','' + choices[eval(-1 + iw)] + '"');
}
tbo.innerHTML+='<tr><td align="right" id="lefttd' + eval(1 + i) + '">' + postbits[0] + '</td><td style="background-color:gray;overflow: hidden;" class="di' + pieplus + 'rh" align="center" id="centertd' + eval(1 + i) + '" onclick="check(this,goodanswers[' + i + '],1);">' + xsvgis + '</td><td id="righttd' + eval(1 + i) + '">' + bits[1] + '</td></tr>';
} else if (eval(nextopts) < 0 && optslist.indexOf(';' + eval(-1 + choices.length) + ';') == -1) {
nextopts=eval(-1 + choices.length);
//alert(nextopts);
}
}
}
}
optslist += opts + ';';
if (eval(nextopts) >= 0) {
opts=nextopts;
nextopts=-1;
getpc();
}

}
}
}
}

function getpc() {
if (mode.toLowerCase().indexOf('pie') == 0) {
var bitsafter='?title=2d;MyDailyActivities&task=Task&desc=Percentage&data=';
for (var i=0; i<opts; i++) bitsafter+=',%20[~%20~,' + eval(100 / opts) + ']%20';
document.getElementById('pcdiv').innerHTML+='<iframe style="display:block;width:500px;height:500px;" src="../PHP/PieChart/pie_chart.php' + bitsafter + '" onload="doaconto(this);"></iframe>';
}
}

</script>
</head>
<body style='background-color: yellow;' onload='setTimeout(buildpage,250);'>
<div class='dxirh' align='center'>
<h1 id='myh1' style='color:yellow; background-color: violet;' align='center'><br><a style="text-decoration:none;" href='#' onclick="owntitle('');" id="mya" title='Enter your own title, or email snapshot.'>Future Choices</a> <font size=1>Thanks to <a href="#" onclick="background();">"How English Works"</a> by Michael Swan and Catherine Walter</font><br><br></h1>
<h4 style='color:yellow; background-color: violet;' align='center'><br>RJM Programming <a style="text-decoration:none;" href='#' onclick='toggle();' title='Change Mode of Use among Horizontal [F]lip or [S]trike Reject or [P]ie or Pi[e]flip or [R]adio or [B]utton or [C]heckbox or [D]ropdown'>-</a> November<a style="text-decoration:none;" href='#' onclick='owndata();' title='Send Your Own Sentences'>,</a> 2015<br><br></h1>
<h4 id='score' style='color:yellow; background-color: violet;' align='center'>Please Click the Correct One (as it appears) - Score: 0 Goes: 0</h4>
</div>
<div align='center' id='mydiv'>
<table id='mytable' border=1>
<tbody id='mytbody'>
</tbody>
</table>
</div>
<div id='afterstyles'>
</div>
<div id='prepcdiv' style='position:absolute;top:0;left:0;z-index:-5;opacity:0;'></div>
<div id='pcdiv' style='position:absolute;top:0;left:0;z-index:-5;opacity:0;'></div>
</body>
</html>