<!doctype html>
<html>
<head>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<title>The BuzzIn First Name Guessing Game for Two - One on Mouse and One at Keyboard - RJM Programming - March, 2018</title>
<style>
td { text-align: center; }
table { border: 5px teal solid; }
h1.aa:after {
content: 'a';
}
h1.ab:after {
content: 'b';
}
h1.ac:after {
content: 'c';
}
h1.ad:after {
content: 'd';
}
h1.ae:after {
content: 'e';
}
h1.af:after {
content: 'f';
}
h1.ag:after {
content: 'g';
}
h1.ah:after {
content: 'h';
}
h1.ai:after {
content: 'i';
}
h1.aj:after {
content: 'j';
}
h1.ak:after {
content: 'k';
}
h1.al:after {
content: 'l';
}
h1.am:after {
content: 'm';
}
h1.an:after {
content: 'n';
}
h1.ao:after {
content: 'o';
}
h1.ap:after {
content: 'p';
}
h1.aq:after {
content: 'q';
}
h1.ar:after {
content: 'r';
}
h1.as:after {
content: 's';
}
h1.at:after {
content: 't';
}
h1.au:after {
content: 'u';
}
h1.av:after {
content: 'v';
}
h1.aw:after {
content: 'w';
}
h1.ax:after {
content: 'x';
}
h1.ay:after {
content: 'y';
}
h1.az:after {
content: 'z';
}

span.aa:after {
content: 'a';
}
span.ab:after {
content: 'b';
}
span.ac:after {
content: 'c';
}
span.ad:after {
content: 'd';
}
span.ae:after {
content: 'e';
}
span.af:after {
content: 'f';
}
span.ag:after {
content: 'g';
}
span.ah:after {
content: 'h';
}
span.ai:after {
content: 'i';
}
span.aj:after {
content: 'j';
}
span.ak:after {
content: 'k';
}
span.al:after {
content: 'l';
}
span.am:after {
content: 'm';
}
span.an:after {
content: 'n';
}
span.ao:after {
content: 'o';
}
span.ap:after {
content: 'p';
}
span.aq:after {
content: 'q';
}
span.ar:after {
content: 'r';
}
span.as:after {
content: 's';
}
span.at:after {
content: 't';
}
span.au:after {
content: 'u';
}
span.av:after {
content: 'v';
}
span.aw:after {
content: 'w';
}
span.ax:after {
content: 'x';
}
span.ay:after {
content: 'y';
}
span.az:after {
content: 'z';
}



.cell {
background-color: lightblue;
display: inline;
}
</style>
<script type='text/javascript'>

var goes=0;
var cscore="-1,0,0";
var score=[-1,0,0];
var cname=",Player 1,Player 2";
var name=cname.split(',');
var cstatus=", ... on mouse ... , ... at keyboard ... ";
var status=cstatus.split(',');
var aconto=null;
var bconto=null;
var letterlist="";
var pleasewait=false;
var versus="";
var activeplayer=-1;
var thewordtoguess="";
var startwith=3;
var totallength=0;
var donelist=";";
var startofgame=true;
var inalready=false;
var lwg="";

function continueon() {
if (pleasewait) {
setTimeout(continueon, 4000);
} else if (eval(startwith) < eval(totallength)) {
var ij, jk, guess;
startwith++;
for (jk=startwith; jk<=startwith; jk++) {
for (ij=jk; ij<=jk; ij++) {
guess=Math.floor(Math.random() * eval(0 + thewordtoguess.length)) + 0;
while (donelist.indexOf(";" + guess + ";") != -1) {
guess=Math.floor(Math.random() * eval(0 + thewordtoguess.length)) + 0;
}
donelist += guess + ";";
letters+=thewordtoguess.substring(guess, eval(1 + guess));
document.getElementById('letter' + map(startwith)).innerHTML+='<h1 class="a' + thewordtoguess.substring(guess, eval(1 + guess)) + ' cell"></h1>';
document.getElementById('letter' + map(startwith)).style.display='BLOCK';
}
}
if (eval(startwith) < eval(totallength)) {
setTimeout(continueon, 4000);
} else {
document.getElementById('letter' + map(startwith)).innerHTML+='<font color=red>.</font>';
setTimeout(istimeout, 7000);
}
}
}

function istimeout() {
if (document.getElementById('letter' + map(startwith)).innerHTML.indexOf(".") != -1 && document.getElementById('whatyouhavesofar').innerHTML == "") {
document.getElementById('myh3').innerHTML+=' ... first name was <font color=red><a target=_blank onclick="nothing();" ontouchstart="nothing();" onkeyup="nothing();" title="Look up word in dictionary" href="//www.behindthename.com/name/' + thewordtoguess + '">' + thewordtoguess.substring(0,1).toUpperCase() + thewordtoguess.substring(1).toLowerCase() + '</a></font> ... onto the next ... ';
setTimeout(another, 5000);
}
}

function iframecheck(iois) {
if (iois != null) {
aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
thewordtoguess=aconto.body.innerHTML.toLowerCase();
if (thewordtoguess != "") {
document.getElementById('myh3').innerHTML='RJM Programming - March, 2018';
document.getElementById('whatyouhavesofar').innerHTML='';
totallength=thewordtoguess.length;
startwith=3;
letters="";
donelist=";";
//alert(thewordtoguess);
var ij, jk, guess;
for (jk=1; jk<=startwith; jk++) {
for (ij=jk; ij<=jk; ij++) {
guess=Math.floor(Math.random() * eval(0 + thewordtoguess.length)) + 0;
while (donelist.indexOf(";" + guess + ";") != -1) {
guess=Math.floor(Math.random() * eval(0 + thewordtoguess.length)) + 0;
}
donelist += guess + ";";
letters+=thewordtoguess.substring(guess, eval(1 + guess));
//alert(thewordtoguess + " ... " + guess);
document.getElementById('letter' + map(jk)).innerHTML+='<h1 class="a' + thewordtoguess.substring(guess, eval(1 + guess)) + ' cell"></h1>';
//alert(thewordtoguess + " +++ " + guess);
document.getElementById('letter' + map(jk)).style.display='BLOCK';
//alert(thewordtoguess + " --- " + guess);
}
}
setTimeout(continueon, 4000);
}
}
}
}
}

function map(ind) {
return 1;
}

function iframeverify(iois) {
if (iois != null) {
bconto = (iois.contentWindow || iois.contentDocument);
if (bconto != null) {
if (bconto.document) { bconto = bconto.document; }
if (bconto.body != null) {
var ourname=cname.split(",");
var ourscore=cscore.split(",");
var ourstatus=cstatus.split(",");
//alert(bconto.body.innerHTML);
if (bconto.body.innerHTML.toLowerCase() == versus.toLowerCase()) {
pleasewait=true;
var blb="Congratulations, " + ourname[activeplayer] + ", you score " + bconto.body.innerHTML.toLowerCase().length + " points for the first name " + versus.substring(0,1).toUpperCase() + versus.substring(1).toLowerCase();
versus="";
score[activeplayer]+=eval(bconto.body.innerHTML.toLowerCase().length);
ourscore[activeplayer]=score[activeplayer];
document.getElementById('summary' + activeplayer).innerHTML = ourname[activeplayer] + ourstatus[activeplayer] + "Score: " + score[activeplayer];
alert(blb);
lwg="";
pleasewait=false;
if (eval(startwith) >= eval(totallength)) {
document.getElementById('thewordtoguess').innerHTML="<table><tr><td id='letter1' style='display:none;'></td><td id='letter2' style='display:none;'></td><td id='letter3' style='display:none;'></td><td id='letter4' style='display:none;'></td><td id='letter5' style='display:none;'></td><td id='letter6' style='display:none;'></td><td id='letter7' style='display:none;'></td><td id='letter8' style='display:none;'></td></tr></table>";
document.getElementById('myiframe').src+='1';
}
} else if (startofgame) {
startofgame=false;
} else {
pleasewait=true;
var blurb="Your name is not a known first name ... sorry ... the first name we wanted was " + thewordtoguess.substring(0,1).toUpperCase() + thewordtoguess.substring(1).toLowerCase();
versus="";
if (eval(startwith) >= eval(totallength)) {
var afters=prompt(blurb + ". If you leave " + thewordtoguess + " as your answer we will take you to a meaning of that first name.", thewordtoguess.substring(0,1).toUpperCase() + thewordtoguess.substring(1).toLowerCase());
if (afters != null) {
if (afters == thewordtoguess) {
window.open("//www.behindthename.com/name/" + thewordtoguess, "_blank", "left=50,top=50,width=400,height=400");
}
}
} else {
alert("Your name is not a known first name ... sorry.");
}
lwg="";
pleasewait=false;
if (eval(startwith) >= eval(totallength)) {
document.getElementById('thewordtoguess').innerHTML="<table><tr><td id='letter1' style='display:none;'></td><td id='letter2' style='display:none;'></td><td id='letter3' style='display:none;'></td><td id='letter4' style='display:none;'></td><td id='letter5' style='display:none;'></td><td id='letter6' style='display:none;'></td><td id='letter7' style='display:none;'></td><td id='letter8' style='display:none;'></td></tr></table>";
document.getElementById('myiframe').src+='1';
}
}
}
}
}
pleasewait=false;
}

function verify() {
if (pleasewait) setTimeout(verify, 500);
}

function thegames1() {
if (document.getElementById('whatyouhavesofar').innerHTML == '') {
thegames(1);
}
}

function thegames2() {
thegames(2);
}

function thegames(whobuzzedin) {
//if (!inalready) {
//inalready=true;
var ourname=cname.split(",");
var ourstatus=cstatus.split(",");
var ourscore=cscore.split(",");
var delim="", bigletters="", okay=false, letterscopy=letters.toLowerCase();
document.getElementById('thewordtoguess').innerHTML=document.getElementById('thewordtoguess').innerHTML.replace(".","");
activeplayer=eval(whobuzzedin);
pleasewait=true;
for (var i=0; i<letters.length; i++) {
bigletters+=delim + letters.toLowerCase().substring(i, eval(1 + i));
delim = ",";
}
var wordguess=lwg;
if (wordguess == "") wordguess=prompt("Okay " + ourname[eval(whobuzzedin)] + " you have the letters " + bigletters + " ... what is your first name?", lwg);
if (wordguess != null) {
wordguess=wordguess.replace(".","");
lwg=wordguess;
if (wordguess.length == letters.length) {
for (var j=0; j<wordguess.length; j++) {
letterscopy=letterscopy.replace(wordguess.toLowerCase().substring(j, eval(j + 1)), "");
}
if (letterscopy == "") {
versus=wordguess.toLowerCase();
if (wordguess.toLowerCase() == thewordtoguess) {
var blb="Congratulations, " + ourname[activeplayer] + ", you score " + bconto.body.innerHTML.toLowerCase().length + " points for the first name " + versus.substring(0,1).toUpperCase() + versus.substring(1).toLowerCase();
versus="";
score[activeplayer]+=eval(bconto.body.innerHTML.toLowerCase().length);
ourscore[activeplayer]=score[activeplayer];
document.getElementById('summary' + activeplayer).innerHTML = ourname[activeplayer] + ourstatus[activeplayer] + "Score: " + score[activeplayer];
alert(blb);
pleasewait=false;
document.getElementById('thewordtoguess').innerHTML="<table><tr><td id='letter1' style='display:none;'></td><td id='letter2' style='display:none;'></td><td id='letter3' style='display:none;'></td><td id='letter4' style='display:none;'></td><td id='letter5' style='display:none;'></td><td id='letter6' style='display:none;'></td><td id='letter7' style='display:none;'></td><td id='letter8' style='display:none;'></td></tr></table>";
document.getElementById('myiframe').src+='1';
} else {
pleasewait=true;
setTimeout(verify, 500);
//alert('../PHP/surprise.php?min=4&max=8&youllneverfindthis=y' + '&hastobe=' + wordguess.toLowerCase());
document.getElementById('myh3').innerHTML+=' ... please wait while we look up <font color=red><a target=_blank onclick="nothing();" ontouchstart="nothing();" onkeyup="nothing();" title="Look up word in dictionary" href="//www.behindthename.com/name/' + wordguess.toLowerCase() + '">' + wordguess.substring(0,1).toUpperCase() + wordguess.substring(1).toLowerCase() + '</a></font> ... ';
document.getElementById('myiframehastobe').src='../PHP/surprise.php?min=4&max=8&firstname=y&youllneverfindthis=y' + '&hastobe=' + wordguess.toLowerCase();
}
lwg="";
} else {
alert("Your word has the wrong letters ... sorry.");
lwg="";
if (eval(startwith) >= eval(totallength)) {
pleasewait=false;
document.getElementById('thewordtoguess').innerHTML="<table><tr><td id='letter1' style='display:none;'></td><td id='letter2' style='display:none;'></td><td id='letter3' style='display:none;'></td><td id='letter4' style='display:none;'></td><td id='letter5' style='display:none;'></td><td id='letter6' style='display:none;'></td><td id='letter7' style='display:none;'></td><td id='letter8' style='display:none;'></td></tr></table>";
document.getElementById('myiframe').src+='1';
}
}
} else {
alert("Your word is not the correct length ... sorry.");
lwg="";
if (eval(startwith) >= eval(totallength)) {
pleasewait=false;
document.getElementById('thewordtoguess').innerHTML="<table><tr><td id='letter1' style='display:none;'></td><td id='letter2' style='display:none;'></td><td id='letter3' style='display:none;'></td><td id='letter4' style='display:none;'></td><td id='letter5' style='display:none;'></td><td id='letter6' style='display:none;'></td><td id='letter7' style='display:none;'></td><td id='letter8' style='display:none;'></td></tr></table>";
document.getElementById('myiframe').src+='1';
}
}
} else {
alert("Keep trying.");
lwg="";
if (eval(startwith) >= eval(totallength)) {
pleasewait=false;
document.getElementById('thewordtoguess').innerHTML="<table><tr><td id='letter1' style='display:none;'></td><td id='letter2' style='display:none;'></td><td id='letter3' style='display:none;'></td><td id='letter4' style='display:none;'></td><td id='letter5' style='display:none;'></td><td id='letter6' style='display:none;'></td><td id='letter7' style='display:none;'></td><td id='letter8' style='display:none;'></td></tr></table>";
document.getElementById('myiframe').src+='1';
}
}
inalready=false;
window.scrollTo(0,0);
//} else {
//inalready=false;
//}
}

function another() {
document.getElementById('thewordtoguess').innerHTML="<table><tr><td id='letter1' style='display:none;'></td><td id='letter2' style='display:none;'></td><td id='letter3' style='display:none;'></td><td id='letter4' style='display:none;'></td><td id='letter5' style='display:none;'></td><td id='letter6' style='display:none;'></td><td id='letter7' style='display:none;'></td><td id='letter8' style='display:none;'></td></tr></table>";
document.getElementById('myiframe').src+='1';
}

function addto(inletter) {
document.getElementById('whatyouhavesofar').innerHTML+=inletter;
if (thewordtoguess.toLowerCase().indexOf(inletter) == -1) document.getElementById('whatyouhavesofar').innerHTML='';
if (document.getElementById('whatyouhavesofar').innerHTML.length == letters.length) {
lwg=document.getElementById('whatyouhavesofar').innerHTML.toLowerCase();
thegames(1);
}
}

function wordingcheck() {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace("Keyboard", "Long Touch");
document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace(" Mouse and One at Keyboard", " Touch on Blue and One on Touch Away from Blue");
document.getElementById('summary1').innerHTML=document.getElementById('summary1').innerHTML.replace("on mouse", "with touch on blue");
document.getElementById('summary2').innerHTML=document.getElementById('summary2').innerHTML.replace("at keyboard", "with touch away from blue");
cstatus=", ... with touch on blue ... , ... with touch away from blue ... ";
} else {
}
var player1=location.search.split('player1=')[1] ? location.search.split('player1=')[1].split('&')[0] : "Player 1";
var player2=location.search.split('player2=')[1] ? location.search.split('player2=')[1].split('&')[0] : "Player 2";
cname="," + player1 + "," + player2;
if (player1 != "Player 1") document.getElementById('summary1').innerHTML=document.getElementById('summary1').innerHTML.replace("Player 1", player1);
if (player2 != "Player 2") document.getElementById('summary2').innerHTML=document.getElementById('summary2').innerHTML.replace("Player 2", player2);
document.getElementById('player1').value=player1;
document.getElementById('player2').value=player2;
}

function nothing() {
if (1 == 2) alert(987);
}

</script>
</head>
<body onload='wordingcheck();' style='width:100%;background-color:#f0f0f0;' onclick=" document.title='Click'; if (!inalready) { inalready=true; setTimeout(thegames1,1000); } " ontouchstart=" document.title='Ontouchstart'; if (!inalready) { inalready=true; setTimeout(thegames2,1000); } " onkeydown=" document.title='Keyboard'; if (!inalready) { inalready=true; setTimeout(thegames2,1000); } ">

<h1 id='myh1' align='center'>The BuzzIn First Name Guessing Game for Two - One on Mouse and One at Keyboard</h1>

<h3 id='myh3' align='center'>RJM Programming - March, 2018</h3>

<table style='width:100%; border: 3px solid purple;' onclick=" document.title='Click'; if (!inalready) { inalready=true; setTimeout(thegames1,1000); } " ontouchstart=" document.title='Ontouchstart'; if (!inalready) { inalready=true; setTimeout(thegames2,1000); } " onkeydown=" document.title='Keyboard'; if (!inalready) { inalready=true; setTimeout(thegames2,1000); } ">
<tr><th style='background-color:lightblue;' onclick=" document.title='Click'; if (!inalready) { inalready=true; setTimeout(thegames1,1000); } " ontouchstart=" document.title='Click'; if (!inalready) { inalready=true; setTimeout(thegames1,1000); } " onkeydown=" document.title='Keyboard'; if (!inalready) { inalready=true; setTimeout(thegames2,1000); } "><span id='summary1'>Player 1 ... on mouse ... Score: 0</span><br><br>Letters below are clickable<br><br>
<table align='center' style='background-color:yellow;'><tr><td>
<h1 onclick="addto('q');" ontouchstart="nothing();" class='aq cell'></h1>
<h1 onclick="addto('w');" ontouchstart="nothing();" class='aw cell'></h1>
<h1 onclick="addto('e');" ontouchstart="nothing();" class='ae cell'></h1>
<h1 onclick="addto('r');" ontouchstart="nothing();" class='ar cell'></h1>
<h1 onclick="addto('t');" ontouchstart="nothing();" class='at cell'></h1>
<h1 onclick="addto('y');" ontouchstart="nothing();" class='ay cell'></h1>
<h1 onclick="addto('u');" ontouchstart="nothing();" class='au cell'></h1>
<h1 onclick="addto('i');" ontouchstart="nothing();" class='ai cell'></h1>
<h1 onclick="addto('o');" ontouchstart="nothing();" class='ao cell'></h1>
<h1 onclick="addto('p');" ontouchstart="nothing();" class='ap cell'></h1></td><tr><td>
<h1 onclick="addto('a');" ontouchstart="nothing();" class='aa cell'></h1>
<h1 onclick="addto('s');" ontouchstart="nothing();" class='as cell'></h1>
<h1 onclick="addto('d');" ontouchstart="nothing();" class='ad cell'></h1>
<h1 onclick="addto('f');" ontouchstart="nothing();" class='af cell'></h1>
<h1 onclick="addto('g');" ontouchstart="nothing();" class='ag cell'></h1>
<h1 onclick="addto('h');" ontouchstart="nothing();" class='ah cell'></h1>
<h1 onclick="addto('j');" ontouchstart="nothing();" class='aj cell'></h1>
<h1 onclick="addto('k');" ontouchstart="nothing();" class='ak cell'></h1>
<h1 onclick="addto('l');" ontouchstart="nothing();" class='al cell'></h1></td><tr><td>
<h1 onclick="addto('z');" ontouchstart="nothing();" class='az cell'></h1>
<h1 onclick="addto('x');" ontouchstart="nothing();" class='ax cell'></h1>
<h1 onclick="addto('c');" ontouchstart="nothing();" class='ac cell'></h1>
<h1 onclick="addto('v');" ontouchstart="nothing();" class='av cell'></h1>
<h1 onclick="addto('b');" ontouchstart="nothing();" class='ab cell'></h1>
<h1 onclick="addto('n');" ontouchstart="nothing();" class='an cell'></h1>
<h1 onclick="addto('m');" ontouchstart="nothing();" class='am cell'></h1>
</td></tr></table><br><br>
<h4 id='whatyouhavesofar'></h4>
</th><th style='background-color:lightgray;'>
<form method='GET' action='./nameguessgame.html'>
Player 1 Name <input onclick='inalready=true; nothing();' onkeydown='inalready=true; nothing();' ontouchstart='inalready=true; nothing();' type='text' id='player1' name='player1' value=''></input><br><br>
Player 2 Name <input onclick='inalready=true; nothing();' onkeydown='inalready=true; nothing();' ontouchstart='inalready=true; nothing();' type='text' id='player2' name='player2' value=''></input><br><br>
<input onclick='inalready=true; nothing();' onkeydown='inalready=true; nothing();' ontouchstart='inalready=true; nothing();' type='submit' value='Rename Players as Required'></input>
</form>
</th><th id='summary2' style='background-color:lightgreen;'>Player 2 ... at keyboard ... Score: 0</th></tr>
</table>
<div onclick=" document.title='Click'; if (!inalready) { inalready=true; setTimeout(thegames1,1000); } " ontouchstart=" document.title='Ontouchstart'; if (!inalready) { inalready=true; setTimeout(thegames2,1000); } " onkeydown=" document.title='Keyboard'; if (!inalready) { inalready=true; setTimeout(thegames2,1000); } " align='center' id='thewordtoguess' style='width:100%; background-color: pink; padding-top: 40px; padding-bottom: 40px;'><table style='width:100%;height:20px;'><tr style='width:100%;'><td id='letter1' style='display:none;'></td><td id='letter2' style='display:none;'></td><td id='letter3' style='display:none;'></td><td id='letter4' style='display:none;'></td><td id='letter5' style='display:none;'></td><td id='letter6' style='display:none;'></td><td id='letter7' style='display:none;'></td><td id='letter8' style='display:none;'></td></tr></table></div>
<iframe id='myiframe' style='display:none;' src='../PHP/surprise.php?min=4&max=8&firstname=y&youllneverfindthis=y&whatever=1' onload=' iframecheck(this); '></iframe>
<iframe id='myiframehastobe' style='display:none;' src='../PHP/surprise.php?min=4&max=8&firstname=y&youllneverfindthis=y' onload=' iframeverify(this); '></iframe>
<div style='width:100%; height: 600px; overflow: hidden;'></div>
</body>
</html>