ÿþ<!doctype html>
<html>
<head>
<title>Job Search Grid Game - RJM Programming - January, 2017 ... Thanks to Science Puzzles for Young Scientists by Helene Hovanec ISBN 0-8069-3542-1</title>

<style>

input[type="button"]:hover { background-color: orange; }
input[type="submit"]:hover { background-color: green; }
td[title].yellow { background-color: yellow !important; }

</style>

<script type='text/javascript' src='../../../../cookie_get.js'></script>

<script type='text/javascript'>
var asterisk_rows=location.search.split('starred_rows=')[1] ? eval(ourdecodeURIComponent((location.search.split('starred_rows=')[1]).split('&')[0])) : eval("[2,5]");
var asterisk_cols=location.search.split('starred_cols=')[1] ? eval(ourdecodeURIComponent((location.search.split('starred_cols=')[1]).split('&')[0])) : eval("[]");
var advice=location.search.split('advice=')[1] ? ourdecodeURIComponent((location.search.split('advice=')[1]).split('&')[0]) : "Click or tap in order two 3-letter pieces from the box to make a 6-letter word that answers each currently latest <b>bold</b> and/or <i>itallicized</i> clue. We will write the word into the grid, reading <i>downward</i>. After you use each 3-letter piece, we'll cross it off. Then, when the grid is complete, we'll read <i>across</i> the starred rows to see if you have the word(s) for <i>a scientist's co-worker</i>.";
var partlength=location.search.split('part_length=')[1] ? eval(ourdecodeURIComponent((location.search.split('part_length=')[1]).split('&')[0])) : 3;
var partsper=location.search.split('part_per=')[1] ? eval(ourdecodeURIComponent((location.search.split('part_per=')[1]).split('&')[0])) : 2;
var numcols=location.search.split('numcols=')[1] ? eval(ourdecodeURIComponent((location.search.split('numcols=')[1]).split('&')[0])) : 5;
var numrows=location.search.split('numrows=')[1] ? eval(ourdecodeURIComponent((location.search.split('numrows=')[1]).split('&')[0])) : 4;
var parts=location.search.split('parts=')[1] ? eval(ourdecodeURIComponent((location.search.split('parts=')[1]).split('&')[0])) : [['ANS','BAS','CAT','COL','ECT'],['ING','LIE','MAN','MON','NIP'],['NTS','OBJ','ORG','PLA','RCH'],['SET','STA','THS','TRU','TYP']];
var clues=location.search.split('clues=')[1] ? eval(ourdecodeURIComponent((location.search.split('clues=')[1]).split('&')[0])) : ['Botanists study these living things','A kind of hound with drooping ears','A real thing','What May and June are','What hearts and livers are','Treat for a kitten','Potatoes and rice contain this food substance','A dog like Lassie','President Harry S. ____','Using a keyboard on a computer'];
var finalanswer=location.search.split('answer=')[1] ? (ourdecodeURIComponent((location.search.split('answer=')[1]).split('&')[0])) : "Laboratory technician";

var casterisk_rows=location.search.split('starred_rows=')[1] ? (ourdecodeURIComponent((location.search.split('starred_rows=')[1]).split('&')[0])) : "[2,5]";
var casterisk_cols=location.search.split('starred_cols=')[1] ? (ourdecodeURIComponent((location.search.split('starred_cols=')[1]).split('&')[0])) : "[]";

var cparts=location.search.split('parts=')[1] ? (ourdecodeURIComponent((location.search.split('parts=')[1]).split('&')[0])) : "[['ANS','BAS','CAT','COL','ECT'],['ING','LIE','MAN','MON','NIP'],['NTS','OBJ','ORG','PLA','RCH'],['SET','STA','THS','TRU','TYP']]";
var cclues=location.search.split('clues=')[1] ? (ourdecodeURIComponent((location.search.split('clues=')[1]).split('&')[0])) : "['Botanists study these living things','A kind of hound with drooping ears','A real thing','What May and June are','What hearts and livers are','Treat for a kitten','Potatoes and rice contain this food substance','A dog like Lassie','President Harry S. ____','Using a keyboard on a computer']";


var startat="d0_0";
var andthen=[1,0];
var clueat=1;
var goes=0;

function ourdecodeURIComponent(inf) {
return decodeURIComponent(inf).replace(/\+/g,' ');
}

function ourcontains(ourarr,ourwhat) {
var retval=false;
for (var i=0; i<ourarr.length; i++) {
if (ourarr[i] == ourwhat) return true;
}
return retval;
}

function wasto() {
var bits=startat.replace('d','').split('_');
if (eval(1 + eval(bits[0])) >= eval(partlength * partsper)) {
return 'd0_' + eval(1 + eval(bits[1]));
} else {
return 'd' + eval(1 + eval(bits[0])) + '_' + bits[1];
}
}

function seeifokay() {
//alert('here');
var ourcello, ourcol, youranswer='', iirow, iicol, ccols, wdelim='', iour=0;
var palette=document.getElementById('dgrid').innerHTML;
var trs=palette.split('</tr>');
var ths=palette.split('</th>');
if (trs[0].indexOf('*') != -1) {
for (iicol=1; iicol<eval(-1 + ths.length); iicol++) {
if (ths[iicol].indexOf('*') != -1) {
ourcol=(ths[iicol].split('>')[eval(-1 + ths[iicol].split('>').length)].replace('*',' ').replace('&',' ') + ' ').split(' ')[0];
iour=0;
ourcello=document.getElementById('d' + eval(-1 + eval(ourcol)) + '_0');
youranswer+=wdelim;
wdelim=' ';
while (ourcello != null) {
youranswer+=ourcello.innerHTML;
ourcello.style.backgroundColor='yellow';
iour++;
ourcello=document.getElementById('d' + eval(-1 + eval(ourcol)) + '_' + iour);
}
}
}
} else {
for (iirow=1; iirow<eval(-1 + trs.length); iirow++) {
if (trs[iirow].indexOf('*') != -1) {
youranswer+=wdelim;
wdelim=' ';
ccols=trs[iirow].split('</td>');
for (iicol=1; iicol<ccols.length; iicol++) {
youranswer+=ccols[iicol].slice(-1);
}
}
}
}
if (youranswer.toUpperCase() == finalanswer.toUpperCase()) {
alert('Congratulations! You got the answer ' + finalanswer + ' spot on!');
} else {
alert('Sorry! No cigar! But we will start the game again for you.');
location.href=document.URL.split('#')[0];
}
}

function analyze(wbut) {
//alert(wbut.id);
var oclue;
for (var ii=0; ii<wbut.value.length; ii++) {
document.getElementById(startat).innerHTML=wbut.value.substring(ii,eval(1 + ii));
document.getElementById(startat).style.backgroundColor='white';
document.getElementById(startat).title=wbut.value.substring(ii,eval(1 + ii));
startat=wasto();
}
if (document.getElementById(startat)) {
document.getElementById(startat).style.borderTop="2px solid white";
document.getElementById(startat).style.borderLeft="2px solid white";
document.getElementById(startat).style.borderRight="2px solid white";
}
document.getElementById(wbut.id.replace('i','c')).innerHTML=wbut.value;
document.getElementById(wbut.id.replace('i','c')).style.backgroundColor='yellow';
goes++;
if (goes == (numrows * numcols)) {
seeifokay();
} else if (eval(goes % partsper) == 0) {
document.getElementById('x' + clueat).innerHTML=clueat + '. ' + clues[eval(-1 + clueat)];
clueat++;
oclue=document.getElementById('x' + clueat);
oclue.innerHTML=(oclue.innerHTML + '</i></b>').replace('.', '. <b><i>');
}

}

function loadgame() {
var irow,icol,tabletemplate="<table><tbody></tbody></table>",thistable="",jnum=1,prefix="<b></i>",suffix="</i></b>";
var firststyle=' style="border-top:2px solid white;border-left:2px solid white;border-right:2px solid white;" ', classbit='';

document.getElementById('myform').action=document.URL.split('?')[0].split('#')[0];

document.getElementById('advice').value=advice;
document.getElementById('advice').innerHTML=advice;
document.getElementById('dadvice').innerHTML=advice;

document.getElementById('numcols').value=numcols;
document.getElementById('numrows').value=numrows;
document.getElementById('part_per').value=partsper;
document.getElementById('part_length').value=partlength;
document.getElementById('starred_rows').value=casterisk_rows;
document.getElementById('starred_cols').value=casterisk_cols;
document.getElementById('parts').value=cparts;
document.getElementById('clues').value=cclues;
document.getElementById('parts').innerHTML=cparts;
document.getElementById('clues').innerHTML=cclues;
document.getElementById('answer').value=finalanswer;

thistable=tabletemplate.replace(">", " cellpadding=10 cellspacing=10 border=10 style='width:35%;height:200px;'>");
for (irow=0; irow<numrows; irow++) {
thistable=thistable.replace('</tbody>','<tr></tr></tbody>');
for (icol=0; icol<numcols; icol++) {
thistable=thistable.replace('</tr></tbody>', '<td id=c' + irow + '_' + icol + '><input onclick=analyze(this); type=button value=' + parts[irow][icol] + ' id=i' + irow + '_' + icol + '></input></td></tr></tbody>');
}
}
document.getElementById('dparts').innerHTML=thistable;

thistable=tabletemplate.replace(">", " cellpadding=2 cellspacing=2 border=5 style='width:100%;height:200px;'>");
for (irow=-1; irow<eval(partsper * partlength); irow++) {
classbit='';
if (irow < 0) {
thistable=thistable.replace('</tbody>','<tr></tr></tbody>');
} else {
thistable=thistable.replace('</tbody>','<tr></tr></tbody>');
}
for (icol=-1; icol<eval(numrows * numcols) / eval(partsper); icol++) {
if (icol < 0) {
if (irow < 0) {
thistable=thistable.replace('</tr></tbody>', '<th style="border:0px solid white;"></th></tr></tbody>');
} else if (ourcontains(asterisk_rows,eval(1 + irow))) {
thistable=thistable.replace('</tr></tbody>', '<td style="border-top:0px solid white;border-left:0px solid white;border-bottom:0px solid white;">*</td></tr></tbody>');
classbit=' class="yellow" ';
} else {
thistable=thistable.replace('</tr></tbody>', '<td style="border-top:0px solid white;border-left:0px solid white;border-bottom:0px solid white;"></td></tr></tbody>');
}
} else if (irow < 0) {
if (ourcontains(asterisk_cols,eval(1 + icol))) {
thistable=thistable.replace('</tr></tbody>', '<th style="border-top:0px solid white;border-left:0px solid white;border-right:0px solid white;">' + eval(1 + icol) + ' *</th></tr></tbody>');
} else {
thistable=thistable.replace('</tr></tbody>', '<th style="border-top:0px solid white;border-left:0px solid white;border-right:0px solid white;">' + eval(1 + icol) + '</th></tr></tbody>');
}
} else {
thistable=thistable.replace('</tr></tbody>', '<td ' + firststyle + classbit + ' id=d' + irow + '_' + icol + '></td></tr></tbody>');
firststyle='';
}
}
}
document.getElementById('dgrid').innerHTML=thistable;

thistable=tabletemplate.replace(">", " cellpadding=2 cellspacing=2 style='width:35%;height:200px;'>");
for (irow=0; irow<eval(eval(numrows * numcols) / eval(partsper) / 2); irow++) {
thistable=thistable.replace('</tbody>','<tr></tr></tbody>');
for (icol=0; icol<2; icol++) {
thistable=thistable.replace('</tr></tbody>', '<td id=x' + eval(eval(eval(numrows * numcols) / eval(partsper) / 2) * icol + irow + 1) + '><b>' + eval(eval(eval(numrows * numcols) / eval(partsper) / 2) * icol + irow + 1) + '.</b> ' + prefix + clues[eval(eval(eval(numrows * numcols) / eval(partsper) / 2) * icol + irow)] + suffix + '</td></tr></tbody>');
prefix="";
suffix="";
jnum++;
}
}
document.getElementById('dclues').innerHTML=thistable;

}

</script>

</head>
<body onload=" loadgame(); " style='background-color:yellow;'>
<div id=dcookies_okay><input type=hidden id=cookies_okay value=''></input></div>
<table style='width:100%;background-color:orange;' border=8><tbody><tr><td><h1>Job Search Grid Game</h1>
<h3>RJM Programming - January, 2017</h3>
<h3>Thanks to <a target=_blank title='Science Puzzles for Young Scientists by Helene Hovanec ISBN 0-8069-3542-1' href='https://books.google.com.au/books?isbn=0806958499'>Science Puzzles for Young Scientists</a> by Helene Hovanec ISBN 0-8069-3542-1</h3>
</td><td><div id='dgrid' style="background-color:magenta;"></div></td></tr></tbody></table>
<div id='dadvice' style="background-color:lightgreen;"></div><hr>
<table style='width:100%;background-color:cyan;' border=8><tbody><tr><td><div id='dparts'></div></td><td><div id='dclues' style="background-color:lightblue;"></div></td></tr></tbody></table><hr>
<!--br><hr><hr><br-->
<a href='#change' onclick=" document.getElementById('change').style.display='block'; " style=" cursor:pointer; text-decoration:underline; ">Manage Game Characteristics below?</a><br>
<div id='change' style='display:none;background-color:pink;'>
<form id='myform' action='./job_search_grid_game.html' method='GET'>
Number of Columns: <input type=number min=1 step=1 name=numcols id=numcols value="5"></input><br>
Number of Rows: <input type=number min=1 step=1 name=numrows id=numrows value="4"></input><br>
Parts: <textarea cols=80 rows=2 style='width:90%;' name=parts id=parts value="[['ANS','BAS','CAT','COL','ECT'],['ING','LIE','MAN','MON','NIP'],['NTS','OBJ','ORG','PLA','RCH'],['SET','STA','THS','TRU','TYP']]">[['ANS','BAS','CAT','COL','ECT'],['ING','LIE','MAN','MON','NIP'],['NTS','OBJ','ORG','PLA','RCH'],['SET','STA','THS','TRU','TYP']]</textarea><br>
Clues: <textarea cols=80 rows=3 style='width:90%;' name=clues id=clues value="['Botanists study these living things','A kind of hound with drooping ears','A real thing','What May and June are','What hearts and livers are','Treat for a kitten','Potatoes and rice contain this food substance','A dog like Lassie','President Harry S. ____','Using a keyboard on a computer']">['Botanists study these living things','A kind of hound with drooping ears','A real thing','What May and June are','What hearts and livers are','Treat for a kitten','Potatoes and rice contain this food substance','A dog like Lassie','President Harry S. ____','Using a keyboard on a computer']</textarea><br>
Starred Rows: <input type=text name=starred_rows id=starred_rows value="[2,5]"></input><br>
Starred Columns: <input type=text name=starred_cols id=starred_cols value="[]"></input><br>
Parts Length: <input type=number min=1 step=1 name=part_length id=part_length value="3"></input><br>
Number of Parts per Column: <input type=number min=1 step=1 name=part_per id=part_per value="2"></input><br>
Answer: <input type=password name=answer id=answer value="Laboratory technician"></input><br><br>
Advice: <textarea cols=80 rows=7 type=text name=advice id=advice value="Join together two 3-letter pieces from the box to make a 6-letter word that answers each clue. Write the word into the grid, reading <i>downward</i>. After you use each 3-letter piece, cross it off. Then, when the grid is complete, read <i>across</i> the starred rows to find a scientist's co-worker.">Join together two 3-letter pieces from the box to make a 6-letter word that answers each clue. Write the word into the grid, reading <i>downward</i>. After you use each 3-letter piece, cross it off. Then, when the grid is complete, read <i>across</i> the starred rows to find a scientist's co-worker.</textarea><br>
<input type=submit id=manage value='Play with Game Characteristics Above'></input><br><br><br>
</form>
</div>
</body>
</html>