<!doctype html>
<html>
<head>
<title>Timed Count - RJM Programming - December, 2016</title>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<style>
a {
background-color: lightgreen;
text-decoration: none;
cursor: pointer; border:
solid 1px black;
/* Safari 3-4, iOS 1-3.2, Android 1.6- */px
-webkit-border-radius: 20%;
/* Firefox 1-3.6 */
-moz-border-radius: 20%;
/* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
border-radius: 20%;
padding: 2px 2px 2px 2px; }

#isubmit {
/* Safari 3-4, iOS 1-3.2, Android 1.6- */px
-webkit-border-radius: 50%;
/* Firefox 1-3.6 */
-moz-border-radius: 50%;
/* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
border-radius: 50%;
padding: 7px 7px 7px 7px; }

#toptable {
background-color: yellow;
}

#its {
background-color: #f7f7f7;
}

#statistics {
background-color: #f7f7f7;
margin: 7px 7px 7px 7px;
}

iframe {
border: 7px solid silver;
}

td:nth-child(1) {
background-color: #f0f0f0;
border: 3px solid #f0f0f0;
}

td:nth-child(2) {
background-color: white;
text-align: right;
border: 3px solid #f0f0f0;
}

td:nth-child(3) {
background-color: magenta;
border: 3px solid #f0f0f0;
}

#cookiesel {
background-color: pink !important;
opacity: 0.95 !important;
}

#cookiesel:active {
background-color: pink !important;
opacity: 0.2 !important;
}

}
</style>
<script type='text/javascript'>

var ccount_items='"Semi-Trailer","Truck","Bus","Van","Car","Motor Bike","Motor Scooter","Bicycle"';
var count_items=["Semi-Trailer", "Truck", "Bus", "Van", "Car", "Motor Bike", "Motor Scooter", "Bicycle"];
count_items=location.search.split('items=')[1] ? eval('[' + decodeURIComponent(location.search.split('items=')[1].split('&')[0]).replace(/\+/g,' ') + ']') : count_items;
ccount_items=location.search.split('items=')[1] ? decodeURIComponent(location.search.split('items=')[1].split('&')[0]).replace(/\+/g,' ') : ccount_items;

var howoften='60000';
var imax=20;
var goes=0;
var score=0;
var curgo=[];
var pastgo=[];
var count=00;
var startcount=0;
var endcount=0;
var allokay=true;
var inf=false;
var subject='Vehicles';
var savedih='';
var prevcount=0;
var prevtime='';
var firsttime='';
var previval=900;
var fivehundred=500;
var called=eval(1 + document.URL.indexOf('?'));
var firstcookielist=true;
var cookiesaved=false;
var startcookielist=null;
var pie_chart_diff=[];
var blanks="";

function docgetclass(inc, intag) {
if (document.getElementsByClassName) {
return document.getElementsByClassName(inc);
} else {
var ijl;
var anarris=[];
var huhs=document.getElementsByTagName(intag);
for (ijl=0; ijl<huhs.length; ijl++) {
if (huh[ijl].className.indexOf(inc) != -1) {
anarris.push(huhs[ijl]);
}
}
return anarris;
}
}

function checkforclass() {
var buildup="";
//alert(56);
var cfcs=docgetclass('emojioverlay','*');
for (var ij=0; ij<cfcs.length; ij++) {
//alert(cfcs[ij].innerHTML);
if (cfcs[ij].innerHTML.replace(/&/g,'&').indexOf(';&') != -1) {
//alert(76);
var emjs=cfcs[ij].innerHTML.replace(/&/g,'&').split("&");
buildup=''; //&#' + emjs[1].split(';')[0] + ';';
cfcs[ij].style.opacity=eval(cfcs[ij].style.opacity / eval(-1 + emjs.length));
for (var iemjs=1; iemjs<emjs.length; iemjs++) {
buildup+='<span style="position:absolute;top:' + cfcs[ij].style.top + ';left:' + cfcs[ij].style.left + ';font-size:' + cfcs[ij].style.fontSize + ';opacity:' + cfcs[ij].style.opacity + ';z-index:' + cfcs[ij].style.zIndex + ';">&#' + emjs[iemjs].split(';')[0] + ';</span>';
}
//alert(buildup);
cfcs[ij].innerHTML=buildup;
cfcs[ij].style.visibility='visible';
//alert(buildup);
}
}
}

function isitallokay() {
var curplus=0, curminus=0, curdiv=0.0, curmult=0.0, j=0, jj, prevone=-1, donebefore=',';
if ((eval(pastgo.length) + eval(curgo.length)) >= 3) {
for (jj=0; jj<eval(pastgo.length); jj++) {
j++;
if (donebefore.indexOf(',' + pastgo[jj] + ',') != -1) {
have_to_stop_you_there('repeated number');
return 0;
}
donebefore+=pastgo[jj] + ',';
if (j >= 3) {
if (eval(pastgo[jj] - prevone) == curplus) {
have_to_stop_you_there('three in a row with +(' + curplus + ')');
return 0;
} else if (eval(prevone - pastgo[jj]) == curminus) {
have_to_stop_you_there('three in a row with -(' + curminus + ')');
return 0;
} else if (eval(pastgo[jj] / prevone) == curmult) {
have_to_stop_you_there('three in a row with *(' + curmult + ')');
return 0;
} else if (eval(prevone / pastgo[jj]) == curdiv) {
have_to_stop_you_there('three in a row with /(' + curdiv + ')');
return 0;
}
curplus=eval(pastgo[jj] - prevone);
curminus=eval(prevone - pastgo[jj]);
curmult=eval(pastgo[jj] / prevone);
curdiv=eval(prevone / pastgo[jj]);
} else if (j > 1) {
curplus=eval(pastgo[jj] - prevone);
curminus=eval(prevone - pastgo[jj]);
curmult=eval(pastgo[jj] / prevone);
curdiv=eval(prevone / pastgo[jj]);
}
prevone=pastgo[jj];
}

for (jj=0; jj<eval(curgo.length); jj++) {
j++;
if (donebefore.indexOf(',' + curgo[jj] + ',') != -1) {
have_to_stop_you_there('repeated number');
return 0;
}
donebefore+=curgo[jj] + ',';
if (j >= 3) {
if (eval(curgo[jj] - prevone) == curplus) {
have_to_stop_you_there('three in a row with +(' + curplus + ')');
return;
} else if (eval(prevone - curgo[jj]) == curminus) {
have_to_stop_you_there('three in a row with -(' + curminus + ')');
return;
} else if (eval(curgo[jj] / prevone) == curmult) {
have_to_stop_you_there('three in a row with *(' + curmult + ')');
return;
} else if (eval(prevone / curgo[jj]) == curdiv) {
have_to_stop_you_there('three in a row with /(' + curdiv + ')');
return;
}
curplus=eval(curgo[jj] - prevone);
curminus=eval(prevone - curgo[jj]);
curmult=eval(curgo[jj] / prevone);
curdiv=eval(prevone / curgo[jj]);
} else if (j > 1) {
curplus=eval(curgo[jj] - prevone);
curminus=eval(prevone - curgo[jj]);
curmult=eval(curgo[jj] / prevone);
curdiv=eval(prevone / curgo[jj]);
}
prevone=curgo[jj];
}


}
return eval(curgo.length) * 20 - eval(count - startcount);
}

function have_to_stop_you_there(reason) {
var ans=prompt('Sorry ... have to stop you there at score of ' + score + ' from ' + goes + ' goes ... ' + reason + '. Another game?', 'Y');
if (ans == null) {
location.href=document.URL.split('?')[0].split('#')[0] + '?score=' + score + '&goes=' + goes + '&max=' + imax;
} else if (ans.toUpperCase().substring(0,1) != 'Y') {
location.href=document.URL.split('?')[0].split('#')[0] + '?score=' + score + '&goes=' + goes + '&max=' + imax;
} else {
location.href=document.URL.split('?')[0].split('#')[0];
}
return;
}

function myoclick(ois) {
var bw=1;
//alert(ois.id);
if (document.getElementById('mysel').options[0].text.indexOf('Please ') != 0) {
pastgo=document.getElementById('mysel').options[0].text.trim().split(',');
if ((',' + document.getElementById('mysel').options[0].text.trim() + ',').indexOf(',' + ois.id.replace('o','') + '*') != -1) {
bw=eval((',' + document.getElementById('mysel').options[0].text.trim() + ',').split(',' + ois.id.replace('o','') + '*')[1].split(',')[0]);
document.getElementById('mysel').options[0].text=document.getElementById('mysel').options[0].text.replace(ois.id.replace('o','') + '*' + bw, ois.id.replace('o','') + '*' + eval(1 + bw));
} else {
document.getElementById('mysel').options[0].text=document.getElementById('mysel').options[0].text.trim() + ',' + ois.id.replace('o','') + '*1' + blanks;
}
} else {
document.getElementById('mysel').options[0].text=ois.id.replace('o','') + '*1' + blanks;
}
document.getElementById('mysel').options[0].title=document.getElementById('mysel').options[0].text
var thisone=eval(ois.id.replace('o',''));
//if (pastgo.indexOf('' + thisone) != -1) {
// have_to_stop_you_there('repeated number');
//}
curgo.push(eval(ois.id.replace('o','')));
// var scoredelta=isitallokay();
}


function mytclick(ois) {
//alert(95);
myclick(ois);
}

function myclick(ois) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('imysel').style.display='none'; //'block';
document.getElementById('imysel').style.width='100px';
document.getElementById('imysel').style.height='60px';
} else {
document.getElementById('imysel').style.display='none'; //'block';
document.getElementById('mysel').multiple=true;
document.getElementById('mysel').style.height='310px';
}
startcount=count;
}

function mymchange(iois) {
var i,ii,found=false,ois=document.getElementById(iois.id.replace('i','')), cois=ois.options[0].text.trim(), thiscois='',thiscoisa;
if (curgo.length == 0 && ois.options.length > 0) {
for (i=0; i<ois.options.length; i++) {
if (ois.options[i].selected) {
if (ois.options[i].value != '') {
//alert(ois.options[i].value);
curgo.push(ois.options[i].value);
}
}
}
}
for (ii=0; ii<curgo.length; ii++) {
found=false;
for (i=0; i<ois.options.length; i++) {
if (ois.options[i].selected) {
if (ois.options[i].value != '') {
if (thiscois == '' && ('' + ois.options[i].value) == ('' + curgo[ii])) {
thiscois=ois.options[i].value;
} else if (('' + ois.options[i].value) == ('' + curgo[ii])) {
thiscois+=',' + ois.options[i].value;
}
if (cois.indexOf('Please ') == 0 && ('' + ois.options[i].value) == ('' + curgo[ii])) {
cois=ois.options[i].value;
found=true;
} else if (('' + ois.options[i].value) == ('' + curgo[ii])) {
cois+=',' + ois.options[i].value;
found=true;
}
}
}
}
if (!found) {
thiscois+=',' + curgo[i];
cois+=',' + curgo[i];
}
}
thiscoisa=thiscois.split(',');
if (thiscoisa.length != curgo.length) {
curgo=thiscois.split(',');
}
var scoredelta=isitallokay();
if (cois.indexOf('Please ') != 0) {
ois.options[0].text=cois + blanks;
}
ois.multiple=false;
ois.style.height='20px';
ois.value=' ';
document.getElementById('imysel').style.display='none';
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('imysel').style.width='1px';
document.getElementById('imysel').style.height='1px';
}
score+=scoredelta;
pastgo=ois.options[0].text.trim().split(',');
goes++;
document.getElementById('score').innerHTML='Score: ' + score + ' from ' + goes + ' dropdown reveal goes';
curgo=[];
//document.getElementById('tops').focus();
}

function dohuha(ii) {
var huha=['','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
if (ii >= huha.length) return '' + ii;
return huha[ii];
}

function amendvia(cmax) {

var reason=location.search.split('reason=')[1] ? decodeURIComponent(location.search.split('reason=')[1].split('&')[0]) : '';
var place=location.search.split('place=')[1] ? decodeURIComponent(location.search.split('place=')[1].split('&')[0]) : '';
var person=location.search.split('person=')[1] ? decodeURIComponent(location.search.split('person=')[1].split('&')[0]) : '';

var huhsc=location.search.split('cscore=')[1] ? decodeURIComponent(location.search.split('cscore=')[1].split('&')[0]) : 'Score: 0 from 0 dropdown reveal goes';
var howm=location.search.split('howoften=')[1] ? location.search.split('howoften=')[1].split('&')[0] : howoften;

if (reason != '') document.getElementById('reason').value=reason.replace(/\+/g,' ');
if (place != '') document.getElementById('place').value=place.replace(/\+/g,' ');
if (person != '') document.getElementById('person').value=person.replace(/\+/g,' ');

document.getElementById('score').innerHTML=huhsc;
document.getElementById('howoften').value=howm;
subject=location.search.split('subject=')[1] ? decodeURIComponent(location.search.split('subject=')[1].split('&')[0]) : 'Vehicles';
if (subject == '+') subject='Vehicles';
if (subject.replace('Vehicles','').replace('+','') != '') {
document.getElementById('its').options[0].value=subject.replace(/\+/g,' ').replace('of ','');
document.getElementById('its').options[0].text='of ' + subject.replace(/\+/g,' ').replace('of ','');
document.getElementById('its').value=subject.replace(/\+/g,' ').replace('of ','');
}
score=location.search.split('score=')[1] ? eval(location.search.split('score=')[1].split('&')[0]) : score;
goes=location.search.split('goes=')[1] ? eval(location.search.split('goes=')[1].split('&')[0]) : goes;
document.getElementById('score').innerHTML='Score: ' + score + ' from ' + goes + ' dropdown reveal goes';
if (subject.replace('Vehicles','').replace('+','') != '') document.getElementById('its').options[0].text = 'of ' + subject.replace(/\+/g,' ').replace('of ','');
//for (var ii=3; ii<=Math.max(100,(50 +imax)); ii++) {
// document.getElementById('tops').innerHTML+="<option id='oo" + ii + "' ontouchdown='myoclick(this);' onclick='myoclick(this);' value=" + ii + ">" + ii + "</option>";
//}
for (var i=1; i<=count_items.length; i++) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('mydsel').innerHTML+="<input type=button id='o" + i + "' ontouchdown='myoclick(this);' onclick='myoclick(this);' value=" + i + ">" + dohuha(i) + " = " + count_items[eval(-1 + i)] + "</input><br>";
} else {
document.getElementById('mysel').innerHTML+="<option id='o" + i + "' ontouchdown='myoclick(this);' onclick='myoclick(this);' value=" + i + ">" + dohuha(i) + " = " + count_items[eval(-1 + i)] + "</option>";
}
}
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('imysel').style.display='none'; //'block';
document.getElementById('imysel').style.width='100px';
document.getElementById('imysel').style.height='60px';
} else {
document.getElementById('mysel').multiple=true;
document.getElementById('mysel').style.height='310px';
document.getElementById('imysel').style.display='none'; //'block';
}
document.getElementById('mykb').focus();
document.getElementById('isubmit').style.display='block';
startcount=count;
}

function butmaybe(outc) {
if (outc.indexOf('Please ') == 0) return '1*0';
return outc;
}

function predocount() {
//if (fivehundred != 500) fivehundred=eval(1000 - fivehundred);
var dd=new Date();
var ival=dd.getTime();
//document.title=eval(document.getElementById('howoften').value) + ' ' + ival + ' ' + eval(ival % eval(document.getElementById('howoften').value));
var thisival=eval(ival % eval(document.getElementById('howoften').value));
if (thisival <= previval) {
fivehundred=950;
//alert(prevcount + ":" + document.getElementById('mytbody').innerHTML);
var was=document.getElementById('next' + eval(0 * prevcount)).innerHTML.replace('<br>','').replace('<br>','').replace('<br>','');
document.getElementById('next' + eval(0 * prevcount)).innerHTML='<br><br><br><br>' + pifilter("<input type=hidden name='data" + prevtime + "' value='" + prevtime + "<br>" + butmaybe(document.getElementById('mysel').options[0].text.trim()) + "'></input><p id='data" + prevtime + "'>" + prevtime + "<br>" + butmaybe(document.getElementById('mysel').options[0].text.trim()) + "</p>") + was;
//<div id='next" + count + "'></div><div id='td" + count + "' style='display:table-cell;'>" + savedih.replace(firsttime,thetime()) + "</div>";
document.getElementById('td' + eval(0 * prevcount)).innerHTML=savedih.replace(firsttime,thetime());
prevcount=count;
for (var i=1; i<=count_items.length; i++) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('mydsel').innerHTML+="<input type=button id='o" + i + "' ontouchdown='myoclick(this);' onclick='myoclick(this);' value=" + i + ">" + dohuha(i) + " = " + count_items[eval(-1 + i)] + "</input><br>";
} else {
document.getElementById('mysel').innerHTML+="<option id='o" + i + "' ontouchdown='myoclick(this);' onclick='myoclick(this);' value=" + i + ">" + dohuha(i) + " = " + count_items[eval(-1 + i)] + "</option>";
}
}
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('imysel').style.display='none'; //'block';
document.getElementById('imysel').style.width='100px';
document.getElementById('imysel').style.height='60px';
} else {
document.getElementById('mysel').multiple=true;
document.getElementById('mysel').style.height='310px';
document.getElementById('imysel').style.display='none'; //'block';
}
document.getElementById('mykb').focus();
document.getElementById('isubmit').style.display='block';
} else if (fivehundred != 500) {
if (fivehundred == 50) {
fivehundred=500;
} else {
fivehundred=eval(1000 - fivehundred);
}
}
setTimeout(docount,fivehundred);
}

function timeval(innum) {
if (('' + innum) == '30000') return 'Thirty Seconds';
if (('' + innum) == '60000') return 'Minute';
if (('' + innum) == '300000') return 'Five Minutes';
if (('' + innum) == '600000') return 'Ten Minutes';
if (('' + innum) == '900000') return 'Fifteen Minutes';
if (('' + innum) == '1200000') return 'Twenty Minutes';
if (('' + innum) == '1800000') return 'Thirty Minutes';
if (('' + innum) == '2400000') return 'Forty Minutes';
if (('' + innum) == '3000000') return 'Fifty Minutes';
if (('' + innum) == '3600000') return 'One Hour';
if (('' + innum) == '7200000') return 'Two Hours';
if (('' + innum) == '10800000') return 'Three Hours';
if (('' + innum) == '14400000') return 'Four Hours';
if (('' + innum) == '18000000') return 'Five Hours';
if (('' + innum) == '21600000') return 'Six Hours';
if (('' + innum) == '25200000') return 'Seven Hours';
if (('' + innum) == '28800000') return 'Eight Hours';
if (('' + innum) == '32400000') return 'Nine Hours';
if (('' + innum) == '36000000') return 'Ten Hours';
if (('' + innum) == '39600000') return 'Eleven Hours';
if (('' + innum) == '43200000') return 'Twelve Hours';
if (('' + innum) == '86400000') return 'One Day';
if (('' + innum) == '604800000') return 'One Week';
return '';
}

function dochkpie(ochk_checked) {
if (ochk_checked) {
document.getElementById('cookiesel').multiple=true;
document.getElementById('cookiesel').style.backgroundColor='pink';
document.getElementById('cookiesel').style.opacity='0.2';
document.getElementById('cookiesel').style.height='340px';
document.getElementById('dchkpie').innerHTML="<input style=display:inline;background-color:lightblue; title='End of Google Chart reporting for now' type=button id=chkpie onclick=' draw_howevermany(document.getElementById(\"cookiesel\")); ' value='Histogram 1x2+ Pie+Column'></input>";
} else {
document.getElementById('cookiesel').multiple=false;
document.getElementById('cookiesel').style.height='20px';
document.getElementById('statistics').innerHTML='';
pie_chart_diff=[];
document.getElementById('dchkpie').innerHTML=" <input title='Histogram and Pie Chart Difference Google Charts' style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=' dochkpie(true); '></input> ";
}
}

function howManyCookies() {
var proposedsel="", sorted="", sorteda=[], lastone='';
var cookies = document.cookie.split("; ");

for (var i = eval(-1 + cookies.length); i >= 0; i--) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
if (name.indexOf("dat") == 0) {
if (proposedsel == "") proposedsel='<span style="width:300px;position:absolute;top:76px;left:90px;"><select id="cookiesel" style="width:190px;background-color:transparent;" onchange=" if (this.value.length != 1) { recallThisCookie(this.value,this); } "><option value=" ">Previous session values below ...</option><option value="--">Clear all below</option><option value="">Recall all below</option></select><div style=display:inline; id=dchkpie> <input title="Histogram and Pie Chart Difference Google Charts" style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=" dochkpie(true); "></input> </div></span><span style=opacity:1.0;position:absolute;top:35px;left:150px;font-size:24px;visibility:hidden;z-index:6; onclick="document.getElementById(' + "'chkpie'" + ').click();" class=emojioverlay>&x1F370;&x1F4C8;</span>';
sorteda.push('<option title="' + cookiedate(name).replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + " : " + decodeURIComponent(cookievalue(name)) + '" value="' + name + '">' + cookiedate(name).replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + " : " + decodeURIComponent(cookievalue(name)) + '</option>');
//proposedsel=proposedsel.replace('</select>','<option title="' + cookiedate(name).replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + " : " + decodeURIComponent(cookievalue(name)) + '" value="' + name + '">' + cookiedate(name).replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + " : " + decodeURIComponent(cookievalue(name)) + '</option></select>');
} else if (name == "subject") {
if (proposedsel == "") proposedsel='<span style="width:300px;position:absolute;top:76px;left:90px;"><select id="cookiesel" style="width:190px;background-color:transparent;" onchange=" if (this.value.length != 1) { recallThisCookie(this.value,this); } "><option value=" ">Previous session values below ...</option><option value="--">Clear all below</option><option value="">Recall all below</option></select><div style=display:inline; id=dchkpie> <input title="Histogram and Pie Chart Difference Google Charts" style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=" dochkpie(true); "></input> </div></span><span style=opacity:1.0;position:absolute;top:35px;left:150px;font-size:24px;visibility:hidden;z-index:6; onclick="document.getElementById(' + "'chkpie'" + ').click();" class=emojioverlay>&x1F370;&x1F4C8;</span>';
proposedsel=proposedsel.replace('<option value="">Recall all below</option>','<option value="">Recall all below</option><option value="' + name + '">Timed Count of: ' + decodeURIComponent(cookievalue(name)) + '</option>');
} else if (name == "items") {
if (proposedsel == "") proposedsel='<span style="width:300px;position:absolute;top:76px;left:90px;"><select id="cookiesel" style="width:190px;background-color:transparent;" onchange=" if (this.value.length != 1) { recallThisCookie(this.value,this); } "><option value=" ">Previous session values below ...</option><option value="--">Clear all below</option><option value="">Recall all below</option></select><div style=display:inline; id=dchkpie> <input title="Histogram and Pie Chart Difference Google Charts" style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=" dochkpie(true); "></input> </div></span><span style=opacity:1.0;position:absolute;top:35px;left:150px;font-size:24px;visibility:hidden;z-index:6; onclick="document.getElementById(' + "'chkpie'" + ').click();" class=emojioverlay>&x1F370;&x1F4C8;</span>';
proposedsel=proposedsel.replace('<option value="">Recall all below</option>','<option value="">Recall all below</option><option value="' + name + '">Made Up Of: ' + '[' + decodeURIComponent(cookievalue(name)).replace(/\+/g,' ') + ']' + '</option>');
} else if (name == "howoften") {
if (proposedsel == "") proposedsel='<span style="width:300px;position:absolute;top:76px;left:90px;"><select id="cookiesel" style="width:190px;background-color:transparent;" onchange=" if (this.value.length != 1) { recallThisCookie(this.value,this); } "><option value=" ">Previous session values below ...</option><option value="--">Clear all below</option><option value="">Recall all below</option></select><div style=display:inline; id=dchkpie> <input title="Histogram and Pie Chart Difference Google Charts" style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=" dochkpie(true); "></input> <span style=opacity:1.0;position:absolute;top:35px;left:150px;font-size:24px;visibility:hidden;z-index:6; onclick="document.getElementById(' + "'chkpie'" + ').click();" class=emojioverlay>&x1F370;&x1F4C8;</span> <input title="Histogram and Pie Chart Difference Google Charts" style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=" dochkpie(true); "></input> <input title="Histogram and Pie Chart Difference Google Charts" style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=" dochkpie(true); "></input></div></span>';
proposedsel=proposedsel.replace('<option value="">Recall all below</option>','<option value="">Recall all below</option><option value="' + name + '">Every Starting: ' + timeval(decodeURIComponent(cookievalue(name))) + '</option>');
} else if (name == "reason" || name == "person" || name == "place") {
if (proposedsel == "") proposedsel='<span style="width:300px;position:absolute;top:76px;left:90px;"><select id="cookiesel" style="width:190px;background-color:transparent;" onchange=" if (this.value.length != 1) { recallThisCookie(this.value,this); } "><option value=" ">Previous session values below ...</option><option value="--">Clear all below</option><option value="">Recall all below</option></select><div style=display:inline; id=dchkpie> <input title="Histogram and Pie Chart Difference Google Charts" style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=" dochkpie(true); "></input> </div></span><span style=opacity:1.0;position:absolute;top:35px;left:150px;font-size:24px;visibility:hidden;z-index:6; onclick="document.getElementById(' + "'chkpie'" + ').click();" class=emojioverlay>&x1F370;&x1F4C8;</span>';
proposedsel=proposedsel.replace('<option value="">Recall all below</option>','<option value="">Recall all below</option><option value="' + name + '">' + name.replace('reason','For').replace('place','At').replace('person','By') + ': ' + decodeURIComponent(cookievalue(name)) + '</option>');
} else if (proposedsel == "") {
proposedsel='<span style="width:300px;position:absolute;top:76px;left:90px;"><select id="cookiesel" style="width:190px;background-color:transparent;" onchange=" if (this.value.length != 1) { recallThisCookie(this.value,this); } "><option value=" ">Previous session values below ...</option><option value="--">Clear all below</option><option value="">Recall all below</option></select><div style=display:inline; id=dchkpie> <input title="Histogram and Pie Chart Difference Google Charts" style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=" dochkpie(true); "></input> </div></span><span style=opacity:1.0;position:absolute;top:35px;left:150px;font-size:24px;visibility:hidden;z-index:6; onclick="document.getElementById(' + "'chkpie'" + ').click();" class=emojioverlay>&x1F370;&x1F4C8;</span>';
}
}
if (proposedsel != "" && sorted == "" && sorteda.length > 0) {
sorteda.sort();
for (var isort=eval(-1 + sorteda.length); isort>=0; isort--) {
if (lastone == "") {
sorted+=sorteda[isort];
lastone=sorteda[isort];
} else if (sorteda[isort] != lastone) {
sorted+=sorteda[isort];
lastone=sorteda[isort];
}
}
}
if (proposedsel != "" && sorted != "") proposedsel=proposedsel.replace('</select>',sorted + '</select>');
if (proposedsel != "") setTimeout(checkforclass,500);
return proposedsel;
}

function deleteAllCookies() { // thanks to http://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
var cookies = document.cookie.split("; ");

for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
if (name.indexOf("dat") == 0) {
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
} else if (name == "howoften") {
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
} else if (name == "subject") {
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
} else if (name == "items") {
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
} else if (name == "reason" || name == "person" || name == "place") {
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
}
}

function draw_howevermany(ois) {
document.getElementById('statistics').innerHTML='';
pie_chart_diff=[];
for (i=0; i<ois.options.length; i++) {
if (ois.options[i].selected) {
if (ois.options[i].value.length > 13 && ois.options[i].text.indexOf('*') != -1) {
//alert('i=' + i + ' ... ' + ois.options[i].text);
if (pie_chart_diff.indexOf(ois.options[i].text.replace(' : ','<br>').replace(/\//g,"_").replace(/:/g,"_").replace("-","_")) == -1) {
pie_chart_diff.push(ois.options[i].text.replace(' : ','<br>').replace(/\//g,"_").replace(/:/g,"_").replace("-","_"));
}
}
}
}
if (pie_chart_diff.length > 0) draw_pie_chart_diff();
ois.multiple=false;
ois.style.height='20px';
ois.value=' ';
//document.getElementById('statistics').innerHTML='';
pie_chart_diff=[];
document.getElementById('dchkpie').innerHTML=" <input title='Histogram and Pie Chart Difference Google Charts' style=display:inline;color:lightblue; type=checkbox id=chkpie onchange=' dochkpie(true); '></input> ";
}

function draw_one_histogram(ofthis) {
document.getElementById('statistics').innerHTML='';
pie_chart_diff=[];
pie_chart_diff.push(ofthis);
draw_pie_chart_diff();
}

function pcbit(inp) {
var oinp='';
//alert(inp);
// ,%20[~Car~,22]%20,%20[~Truck~,56]
var cbits=inp.split(',');
if (cbits.length == 1 && cbits.indexOf(',') != -1) {
oinp=', [~' + count_items[eval(-1 + eval(cbits[0].split('*')[0]))] + "~," + cbits[0].split('*')[1] + "]";
} else if (cbits.length > 1) {
for (var ii=0; ii<cbits.length; ii++) {
oinp+=', [~' + count_items[eval(-1 + eval(cbits[ii].split('*')[0]))] + "~," + cbits[ii].split('*')[1] + "]";
}
}
return encodeURIComponent(oinp);
}

function draw_pie_chart_diff() {
var urlp="http://www.rjmprogramming.com.au/PHP/PieChart/pie_chart_diff.php?title=My%20Daily%20Activities&task=Task&onclick=y&desc=Count&data0=,%20[~Car~,22]%20,%20[~Truck~,56]&data=,%20[~Car~,23]%20,%20[~Truck~,45]";
var urlh="http://www.rjmprogramming.com.au/PHP/HistogramChart/histogram_chart.php?title=Timed%20Survey%20of%20Vehicles%20For%20Minute%20Starting%20at%202016_12_28_10_08_00&onclick=y&task=Timed%20Count%20of%20Vehicles&desc=Count&data=,%20[~Cars~,23]%20,%20[~Trams~,12]%20,%20[~Bicycles~,17]";
var urlc="http://www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php?title=Company Performance&label=Year&value=Sales,Expenses&data=, [~2208~,13,15] , [~2009~,16,17]"; // &data0=, [~2008~,3,5] , [~2009~,6,7]
var datac='', iii, iiii, hzero='', hone='';
if (pie_chart_diff.length == 2) {
pie_chart_diff.sort();
document.getElementById('cookiesel').title=pie_chart_diff[1];
//document.getElementById('pie_histogram_google_chart').innerHTML=pie_chart_diff[0] + "<br><br>" + pie_chart_diff[1];
if (document.getElementById('myif')) {
document.getElementById('myif').src=urlp.split('?')[0] + '?title=' + encodeURIComponent('Timed Count' + (' of ' + subject + ' ').replace(' of ','') + (' at ' + document.getElementById('place').value + ' ').replace(' at ','') + (' by ' + document.getElementById('person').value + ' ').replace(' by ','') + (' for ' + document.getElementById('reason').value + ' ').replace(' for ','') + ' ' + pie_chart_diff[0].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + ' - ' + pie_chart_diff[1].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":")) + '&onclick=y&task=' + encodeURIComponent(subject) + '&desc=Count&data0=' + pcbit(pie_chart_diff[0].split('>')[eval(-1 + pie_chart_diff[0].split('>').length)]) + '&data=' + pcbit(pie_chart_diff[1].split('>')[eval(-1 + pie_chart_diff[1].split('>').length)]);
} else {
document.getElementById('pie_histogram_google_chart').innerHTML='<iframe style=width:600px;height:700px; id=myif src="' + urlp.split('?')[0] + '?title=' + encodeURIComponent('Timed Count' + (' of ' + subject + ' ').replace(' of ','') + (' at ' + document.getElementById('place').value + ' ').replace(' at ','') + (' by ' + document.getElementById('person').value + ' ').replace(' by ','') + (' for ' + document.getElementById('reason').value + ' ').replace(' for ','') + ' ' + pie_chart_diff[0].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + ' - ' + pie_chart_diff[1].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":")) + '&onclick=y&task=' + encodeURIComponent(subject) + '&desc=Count&data0=' + pcbit(pie_chart_diff[0].split('>')[eval(-1 + pie_chart_diff[0].split('>').length)]) + '&data=' + pcbit(pie_chart_diff[1].split('>')[eval(-1 + pie_chart_diff[1].split('>').length)]) + '" title="Pie Google Chart Difference"></iframe>';
}
//pie_chart_diff=[];
//document.getElementById('dchkpie').click();
} else if (pie_chart_diff.length == 1) {
document.getElementById('cookiesel').title=pie_chart_diff[0];
//document.getElementById('pie_histogram_google_chart').innerHTML=pie_chart_diff[0];
if (document.getElementById('myif')) {
document.getElementById('myif').src=urlh.split('?')[0] + '?title=' + encodeURIComponent('Timed Count' + (' of ' + subject + ' ').replace(' of ','') + (' at ' + document.getElementById('place').value + ' ').replace(' at ','') + (' by ' + document.getElementById('person').value + ' ').replace(' by ','') + (' for ' + document.getElementById('reason').value + ' ').replace(' for ','') + ' ' + pie_chart_diff[0].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":")) + '&onclick=y&task=' + encodeURIComponent(subject) + '&desc=Count&data=' + pcbit(pie_chart_diff[0].split('>')[eval(-1 + pie_chart_diff[0].split('>').length)]);
} else {
document.getElementById('pie_histogram_google_chart').innerHTML='<iframe style=width:600px;height:700px; id=myif src="' + urlh.split('?')[0] + '?title=' + encodeURIComponent('Timed Count' + (' of ' + subject + ' ').replace(' of ','') + (' at ' + document.getElementById('place').value + ' ').replace(' at ','') + (' by ' + document.getElementById('person').value + ' ').replace(' by ','') + (' for ' + document.getElementById('reason').value + ' ').replace(' for ','') + ' ' + pie_chart_diff[0].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":")) + '&onclick=y&task=' + encodeURIComponent(subject) + '&desc=Count&data=' + pcbit(pie_chart_diff[0].split('>')[eval(-1 + pie_chart_diff[0].split('>').length)]) + '" title="Histogram Google Chart"></iframe>';
}
//pie_chart_diff=[];
//document.getElementById('dchkpie').click();
} else if (pie_chart_diff.length > 2) {
pie_chart_diff.sort();
var arr=[], avgblurb=' Counts, Averages of ' + pie_chart_diff.length + ' readings ... ';
document.getElementById('statistics').innerHTML='<br> Timed Count' + (' of ' + subject + ' ').replace(' of ','') + (' at ' + document.getElementById('place').value + ' ').replace(' at ','') + (' by ' + document.getElementById('person').value + ' ').replace(' by ','') + (' for ' + document.getElementById('reason').value + ' ').replace(' for ','') + ' ' + pie_chart_diff[0].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + ' - ' + pie_chart_diff[eval(-1 + pie_chart_diff.length)].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + "<br>";
document.getElementById('cookiesel').title=pie_chart_diff[eval(-1 + pie_chart_diff.length)];
//alert(document.getElementById('cookiesel').title);
//document.getElementById('pie_histogram_google_chart').innerHTML=pie_chart_diff[0] + "<br><br>" + pie_chart_diff[1];
for (iii=0; iii<pie_chart_diff.length; iii++) {
// , [~2008~,3,5] , []
hzero += ' , [~' + pie_chart_diff[iii].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + '~'; //.replace(/_/g,"") + '~';
//alert(hzero + ' ' + iii);
datac=',' + pie_chart_diff[iii].split('>')[eval(-1 + pie_chart_diff[iii].split('>').length)] + ',';
//alert(datac);
for (iiii=1; iiii<=count_items.length; iiii++) {
if (datac.indexOf(',' + iiii + '*') != -1) {
if (iii == 0) {
avgblurb+='<br> ' + count_items[eval(-1 + iiii)] + ": ?,? ";
arr.push(eval(datac.split(',' + iiii + '*')[1].split(',')[0]));
} else { // moving average
arr[eval(-1 + iiii)]=(eval('' + arr[eval(-1 + iiii)] * (iii + 0)) + eval(datac.split(',' + iiii + '*')[1].split(',')[0])) / (iii + 1);
if (eval(1 + iii) == pie_chart_diff.length) avgblurb=avgblurb.replace(count_items[eval(-1 + iiii)] + ': ?,?',count_items[eval(-1 + iiii)] + ': ' + eval(pie_chart_diff.length * eval(arr[eval(-1 + iiii)])) + ', ' + arr[eval(-1 + iiii)]);
}
hzero+=',' + datac.split(',' + iiii + '*')[1].split(',')[0];
} else {
if (iii == 0) {
avgblurb+='<br> ' + count_items[eval(-1 + iiii)] + ": ?,? ";
arr.push(0);
} else { // moving average
arr[eval(-1 + iiii)]=(eval('' + arr[eval(-1 + iiii)]) * (iii + 0) + 0) / (iii + 1);
if (eval(1 + iii) == pie_chart_diff.length) avgblurb=avgblurb.replace(count_items[eval(-1 + iiii)] + ': ?,?',count_items[eval(-1 + iiii)] + ': ' + eval(pie_chart_diff.length * eval(arr[eval(-1 + iiii)])) + ', ' + arr[eval(-1 + iiii)]);
}
hzero+=',0';
}
//alert(hzero + ' ' + iiii);
}
hzero+=']';
}
//alert(hzero);
document.getElementById('statistics').innerHTML+=avgblurb;
var purl=urlc.split('?')[0] + '?title=' + encodeURIComponent('Timed Count' + (' of ' + subject + ' ').replace(' of ','') + (' at ' + document.getElementById('place').value + ' ').replace(' at ','') + (' by ' + document.getElementById('person').value + ' ').replace(' by ','') + (' for ' + document.getElementById('reason').value + ' ').replace(' for ','') + ' ' + pie_chart_diff[0].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + ' - ' + pie_chart_diff[eval(-1 + pie_chart_diff.length)].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":")) + '&onclick=y&label=Time&value=' + ccount_items.replace(/\", \"/g,',').replace(/\",\"/g,',').replace(/\"/g,'') + '&data=' + hzero;
if (purl.length > 900) { //00) {
document.getElementById('ftitle').value=('Timed Count' + (' of ' + subject + ' ').replace(' of ','') + (' at ' + document.getElementById('place').value + ' ').replace(' at ','') + (' by ' + document.getElementById('person').value + ' ').replace(' by ','') + (' for ' + document.getElementById('reason').value + ' ').replace(' for ','') + ' ' + pie_chart_diff[0].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + ' - ' + pie_chart_diff[eval(-1 + pie_chart_diff.length)].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":"));
document.getElementById('fvalue').value=ccount_items.replace(/\", \"/g,',').replace(/\",\"/g,',').replace(/\"/g,'');
document.getElementById('flabel').value="Time";
document.getElementById('fdata').value=hzero;
document.getElementById('fonclick').value="y";
document.getElementById('fmode').value="Both";
if (document.getElementById('myif')) {
document.getElementById('fcsubmit').click();
} else {
document.getElementById('pie_histogram_google_chart').innerHTML='<iframe style=width:600px;height:700px; id=myif src="' + urlc.split('?')[0] + '" title="Column Google Chart"></iframe>';
document.getElementById('fcsubmit').click();
}
} else {
if (document.getElementById('myif')) {
document.getElementById('myif').src=purl;
} else {
document.getElementById('pie_histogram_google_chart').innerHTML='<iframe style=width:600px;height:700px; id=myif src="' + urlc.split('?')[0] + '?title=' + encodeURIComponent('Timed Count' + (' of ' + subject + ' ').replace(' of ','') + (' at ' + document.getElementById('place').value + ' ').replace(' at ','') + (' by ' + document.getElementById('person').value + ' ').replace(' by ','') + (' for ' + document.getElementById('reason').value + ' ').replace(' for ','') + ' ' + pie_chart_diff[0].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":") + ' - ' + pie_chart_diff[1].split('<')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":")) + '&onclick=y&label=Time&value=' + ccount_items.replace(/\", \"/g,',').replace(/\",\"/g,',').replace(/\"/g,'') + '&data=' + hzero + '" title="Column Google Chart"></iframe>';
}
}
//pie_chart_diff=[];
//document.getElementById('dchkpie').click();
}
}

function recallDateCookie(name,oname) {
if (name.indexOf("dat") == 0) {
var ouredate=name.substring(4);
if (oname.multiple) {
if (pie_chart_diff.indexOf(ouredate + "<br>" + decodeURIComponent(cookievalue(name))) == -1) {
pie_chart_diff.push(ouredate + "<br>" + decodeURIComponent(cookievalue(name)));
//alert(pie_chart_diff.length);
//if (pie_chart_diff.length <= 2) {
draw_pie_chart_diff();
//}
}
} else {
var was=document.getElementById('next0').innerHTML.replace('<br>','').replace('<br>','').replace('<br>','');
if (document.getElementById('next0').innerHTML.indexOf(ouredate) == -1) {
var thisidea = '<br><br><br><br>' + pifilter("<input type=hidden name='data" + ouredate + "' value='" + ouredate + "<br>" + decodeURIComponent(cookievalue(name)) + "'></input><p id='data" + ouredate + "'>" + ouredate + "<br>" + decodeURIComponent(cookievalue(name)) + "</p><br>");
document.getElementById('next0').innerHTML = thisidea + was;
}
}
}
}

function recallThisCookie(name,oname) {
if (name != " ") {
if (name.indexOf("-") == 0) {
if (!oname.multiple) {
deleteAllCookies();
document.getElementById('cookieextras').innerHTML='';
}
} else if (name == "") {
if (!oname.multiple) recallAllCookies();
} else {
if (name.indexOf("dat") == 0) {
recallDateCookie(name,oname);
} else if (name == "subject" && !oname.multiple) {
subject=decodeURIComponent(cookievalue(name));
if (subject == '+') subject='Vehicles';
if (subject.replace('Vehicles','').replace('+','') != '') {
document.getElementById('its').options[0].value=subject.replace(/\+/g,' ').replace('of ','');
document.getElementById('its').options[0].text='of ' + subject.replace(/\+/g,' ').replace('of ','');
document.getElementById('its').value=subject.replace(/\+/g,' ').replace('of ','');
}
} else if (name == "items" && !oname.multiple) {
count_items=eval('[' + decodeURIComponent(cookievalue(name)).replace(/\+/g,' ') + ']');
} else if (name != "a" && !oname.multiple) {
document.getElementById(name).value=decodeURIComponent(cookievalue(name));
}
}
}
}

function recallAllCookies() { // thanks to http://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
var cookies = document.cookie.split("; ");

for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
if (name.indexOf("dat") == 0) {
recallDateCookie(name,document.getElementById('cookiesel'));
} else if (name == "subject") {
subject=decodeURIComponent(cookievalue(name));
if (subject == '+') subject='Vehicles';
if (subject.replace('Vehicles','').replace('+','') != '') {
document.getElementById('its').options[0].value=subject.replace(/\+/g,' ').replace('of ','');
document.getElementById('its').options[0].text='of ' + subject.replace(/\+/g,' ').replace('of ','');
document.getElementById('its').value=subject.replace(/\+/g,' ').replace('of ','');
}
} else if (name == "items") {
count_items=eval('[' + decodeURIComponent(cookievalue(name)).replace(/\+/g,' ') + ']');
} else if (name == "reason" || name == "person" || name == "place" || name == "howoften") {
document.getElementById(name).value=decodeURIComponent(cookievalue(name));
}
}
}

function savecookie(mode) {
var cookiecnt=0, thename="", thevalue="", dataignore="youllneverfindthis";
var expiredate = new Date();
//var expiredate = new Date(Date.UTC(96, 11, 1, 0, 0, 0));
expiredate.setYear(expiredate.getFullYear()+1);
if (!cookiesaved) {
deleteAllCookies();
if (document.URL.indexOf('?') != -1 && mode == '') {
var allbits=document.URL.split('?')[1].split('#')[0];
var ebits=allbits.split('=');
var datebits;
document.cookie = "a=" + encodeURIComponent("a") + ";expires=" + expiredate.toGMTString() + ';path=/';
for (var ij=1; ij<ebits.length; ij++) {
thename=ebits[eval(-1 + ij)].split('&')[eval(-1 + ebits[eval(-1 + ij)].split('&').length)];
thevalue=decodeURIComponent(ebits[ij].split('&')[0]);
datebits=thevalue.split('<')[0].split('_');
if (thename.indexOf('data') == 0) {
if (thevalue.replace(dataignore, "") != "" && datebits.length >= 6) {
expiredate.setYear(eval(datebits[0].replace('date','').replace('data','')) + 1000);
expiredate.setMonth(eval(-1 + eval(datebits[1])));
expiredate.setDate(eval(0 + eval(datebits[2])));
expiredate.setHours(eval(0 + eval(datebits[3])));
expiredate.setMinutes(eval(0 + eval(datebits[4])));
expiredate.setSeconds(eval(0 + eval(datebits[5])));
//thename=thevalue.split('>')[eval(-1 + thevalue.split('>').length)];
document.cookie = "data" + thename.replace("data","") + "=" + encodeURIComponent(thevalue.split('>')[eval(-1 + thevalue.split('>').length)]) + ";expires=" + expiredate.toGMTString() + ';path=/';
cookiecnt++;
}
dataignore="1*0";
} else if (thename != "a") {
document.cookie = thename + "=" + encodeURIComponent(thevalue) + ";expires=" + expiredate.toGMTString() + ';path=/';
}
if (eval(1 + ij) == ebits.length) dataignore="youllneverfindthis";
}
} else {
document.cookie = "a=" + encodeURIComponent("a") + ";expires=" + expiredate.toGMTString() + ';path=/';
if (document.getElementById('its').value.replace('Vehicles','') != '') {
document.cookie = "subject=" + encodeURIComponent(document.getElementById('its').value) + ";expires=" + expiredate.toGMTString() + ';path=/';
} else {
document.cookie = "subject=" + encodeURIComponent("Vehicles") + ";expires=" + expiredate.toGMTString() + ';path=/';
}
var cis=document.head.innerHTML.split(" count_" + "items='");
if (cis.length > 1) {
document.cookie = "items=" + encodeURIComponent(cis[1].split("'")[0]) + ";expires=" + expiredate.toUTCString() + ';path=/';
}
document.cookie = "reason=" + encodeURIComponent(document.getElementById('reason').value) + ";expires=" + expiredate.toGMTString() + ';path=/';
document.cookie = "howoften=" + encodeURIComponent(document.getElementById('howoften').value) + ";expires=" + expiredate.toGMTString() + ';path=/';
document.cookie = "person=" + encodeURIComponent(document.getElementById('person').value) + ";expires=" + expiredate.toGMTString() + ';path=/';
document.cookie = "place=" + encodeURIComponent(document.getElementById('place').value) + ";expires=" + expiredate.toGMTString() + ';path=/';
var ps=document.getElementsByTagName('p');
//alert(ps.length);
for (var ips=0; ips<ps.length; ips++) {
if (ps[ips].outerHTML.indexOf(' name="') != -1) {
thename=ps[ips].outerHTML.split(' name="')[1].split('"')[0];
thevalue=encodeURIComponent(ps[ips].innerHTML);
} else if (ps[ips].outerHTML.indexOf(' id="') != -1) {
thename=ps[ips].outerHTML.split(' id="')[1].split('"')[0];
thevalue=encodeURIComponent(ps[ips].innerHTML);
}
datebits=decodeURIComponent(thevalue).split('<')[0].split('_');
if (thename.indexOf('data') == 0) {
if (decodeURIComponent(thevalue).replace(dataignore, "") != "" && datebits.length >= 6) {
expiredate.setYear(eval(datebits[0].replace('date','').replace('data','')) + 1000);
expiredate.setMonth(eval(-1 + eval(datebits[1])));
expiredate.setDate(eval(0 + eval(datebits[2])));
expiredate.setHours(eval(0 + eval(datebits[3])));
expiredate.setMinutes(eval(0 + eval(datebits[4])));
expiredate.setSeconds(eval(0 + eval(datebits[5])));
//thename=thevalue.split('>')[eval(-1 + thevalue.split('>').length)];
//thename=decodeURIComponent(thevalue).split('>')[eval(-1 + decodeURIComponent(thevalue).split('>').length)];
document.cookie = "data" + thename.replace("data","") + "=" + encodeURIComponent(decodeURIComponent(thevalue).split('>')[eval(-1 + decodeURIComponent(thevalue).split('>').length)]) + ";expires=" + expiredate.toUTCString() + ';path=/';
cookiecnt++;
}
dataignore="1*0";
}
if (eval(1 + ips) == ps.length) dataignore="youllneverfindthis";
//alert(ips);
}
}
startcookielist = cookievalue("a");
}
cookiesaved=true;
}

function cookievalue(cname) {
var startcookie = document.cookie.split("; ");
for (var i=0; i<startcookie.length; i++) {
if (cname == startcookie[i].split("=")[0]) {
return startcookie[i].split("=")[1];
}
}
return "";
}

function cookiedate(cname) {
return cname.substring(4);
}

function pifilter(inpi) {
var ainpi=inpi.split(" value='"), crest='';
if (ainpi.length == 1) {
ainpi=inpi.split(' value="');
if (ainpi.length == 1) {
ainpi=inpi.split(' value=');
if (ainpi.length > 1) {
crest=ainpi[1].split('>')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":");
}
} else {
crest=ainpi[1].split('"')[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":");
}
} else {
crest=ainpi[1].split("'")[0].replace("_","/").replace("_","/").replace("_","-").replace("_",":").replace("_",":");
}
if (crest != "") {
return inpi.replace("<p ", "<p style=display:none; ") + "<a style=text-decoration:none;cursor:pointer; title='Histogram Google Chart' onmouseover=' draw_one_histogram(this.innerHTML); ' onclick=' draw_one_histogram(this.innerHTML); '>" + crest + "</a><br><br>";
}
return inpi;
}

function docount() {
if (count == 0) {
var huhcc=document.head.innerHTML.split(" count_" + "items=[");
if (huhcc.length > 2) {
ccount_items=huhcc[eval(-1 + huhcc.length)].split(']')[0];
}
document.getElementById('cookieextras').innerHTML=howManyCookies();
if (document.getElementById('cookieextras').innerHTML != '') document.getElementById('cookiesel').multiple=false;
var tds=document.getElementsByTagName('td');
if (savedih == '') savedih=tds[3].innerHTML;
var ubits=document.URL.split('&data'), vbits;
if (ubits.length > 1) {
var thingos=[];
for (var iubits=eval(-1 + ubits.length); iubits>=1; iubits--) {
vbits=ubits[iubits].split('=');
//thingos.push("<input type=hidden name='data" + vbits[0] + "' value='" + vbits[0] + decodeURIComponent(vbits[1].split('&')[0]).replace(vbits[0],'') + "<br>" + butmaybe(document.getElementById('mysel').options[0].text.trim()) + "'></input><p id='data" + vbits[0] + "'>" + vbits[0] + decodeURIComponent(vbits[1].split('&')[0]).replace(vbits[0],'') + "</p><br>");
thingos.push(pifilter("<input type=hidden name='data" + vbits[0] + "' value='" + vbits[0] + decodeURIComponent(vbits[1].split('&')[0]).replace(vbits[0],'') + "'></input><p id='data" + vbits[0] + "'>" + vbits[0] + decodeURIComponent(vbits[1].split('&')[0]).replace(vbits[0],'') + "</p><br>"));
}
if (thingos.length > 0) {
thingos.sort();
for (var iuubits=eval(-1 + thingos.length); iuubits>=0; iuubits--) {
document.getElementById('next0').innerHTML+=thingos[iuubits];
}
}
}
}
count++;
var dd=new Date();
var ival=dd.getTime();
//document.title=eval(document.getElementById('howoften').value) + ' ' + ival + ' ' + eval(ival % eval(document.getElementById('howoften').value));
var thisival=eval(ival % eval(document.getElementById('howoften').value));
if (thisival <= previval) {
fivehundred=950;
//alert(prevcount + ":" + document.getElementById('mytbody').innerHTML);
var was=document.getElementById('next' + eval(0 * prevcount)).innerHTML.replace('<br>','').replace('<br>','').replace('<br>','');
document.getElementById('next' + eval(0 * prevcount)).innerHTML='<br><br><br><br>' + pifilter("<input type=hidden name='data" + prevtime + "' value='" + prevtime + "<br>" + butmaybe(document.getElementById('mysel').options[0].text.trim()) + "'></input><p id='data" + prevtime + "'>" + prevtime + "<br>" + butmaybe(document.getElementById('mysel').options[0].text.trim()) + "</p>") + was;
//<div id='next" + count + "'></div><div id='td" + count + "' style='display:table-cell;'>" + savedih.replace(firsttime,thetime()) + "</div>";
document.getElementById('td' + eval(0 * prevcount)).innerHTML=savedih.replace(firsttime,thetime());
prevcount=count;
for (var i=1; i<=count_items.length; i++) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('mydsel').innerHTML+="<input type=button id='o" + i + "' ontouchdown='myoclick(this);' onclick='myoclick(this);' value=" + i + ">" + dohuha(i) + " = " + count_items[eval(-1 + i)] + "</input><br>";
} else {
document.getElementById('mysel').innerHTML+="<option id='o" + i + "' ontouchdown='myoclick(this);' onclick='myoclick(this);' value=" + i + ">" + dohuha(i) + " = " + count_items[eval(-1 + i)] + "</option>";
}
}
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('imysel').style.display='none'; //'block';
document.getElementById('imysel').style.width='100px';
document.getElementById('imysel').style.height='60px';
} else {
document.getElementById('mysel').multiple=true;
document.getElementById('mysel').style.height='310px';
document.getElementById('imysel').style.display='none'; //'block';
}
document.getElementById('mykb').focus();
startcount=count;
//} else {
//previval=thisival;
} else if (fivehundred != 500) {
if (fivehundred == 50) {
fivehundred=500;
} else {
fivehundred=eval(1000 - fivehundred);
}
}
setTimeout(predocount,fivehundred);
}

function doit() {
document.getElementByIds('imysel').click();
}

function putinquotes(inh) {
var retval='', delim='';
if (inh.indexOf('"') == 0) {
return inh;
} else if (inh.indexOf("'") == 0) {
return inh;
} else {
var rets=inh.split(',');
for (var iretval=0; iretval<rets.length; iretval++) {
retval+=delim + '"' + rets[iretval] + '"';
delim=',';
}
}
return retval;
}

function ask(what) {
var rhuh=prompt("Enter name of Items to Collect Information for, then :, then comma separated list of what to expect as items you will categorize in the count", 'Vehicles:"Semi-Trailer","Truck","Bus","Van","Car","Motor Bike","Motor Scooter","Bicycle"');
if (rhuh != null) {
if (rhuh.indexOf(':') != -1) {
if (1 == 1) {
document.getElementById('extras').innerHTML='<input type=hidden name=items value=' + "'" + putinquotes(rhuh.split(':')[1]) + "'" + '></input>';
document.getElementById('its').options[0].value=rhuh.split(':')[0];
document.getElementById('its').options[0].text='of ' + rhuh.split(':')[0].replace('of ','');
document.getElementById('its').value=rhuh.split(':')[0];
document.getElementById('isubmit').click();
} else {
location.href=document.URL.split('?')[0].split('#')[0] + '?howoften=' + document.getElementById('howoften').value + '&score=' + score + '&goes=' + goes + '&subject=' + encodeURIComponent(rhuh.split(':')[0]) + '&items=' + encodeURIComponent(putinquotes(rhuh.split(':')[1]));
}
}
}
}

function thetime() {
var dd=new Date();
prevtime=(dd.getFullYear() + "_" + ("0" + eval(1 + dd.getMonth())).slice(-2) + "_" + ("0" + dd.getDate()).slice(-2) + "_" + ("0" + dd.getHours()).slice(-2) + ":" + ("0" + dd.getMinutes()).slice(-2) + ":" + ("0" + dd.getSeconds()).slice(-2)).replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(/:/g,'_').replace(/\//g,'_').replace(/-/g,'_');
if (firsttime == '') firsttime=prevtime;
//document.title=prevtime;
return prevtime;
}

function cval(eiois) {
var okn='';
var huha=['','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
//document.title=eiois.which + " " + eiois.keyCode;
if ((eiois.which || eiois.keyCode) == 8) {
eiois.which=eiois.which;
} else {
okn=String.fromCharCode(eiois.which || eiois.keyCode);
var iokn=huha.indexOf(okn.toLowerCase());
if (iokn > 0) {
document.getElementById('o' + iokn).click();
eiois.value='';
}
}
}

function doyourownget() {
var location_href=document.URL.split('?')[0].split('#')[0] + '?howoften=' + document.getElementById('howoften').value;
var ps=document.getElementsByTagName('p');
for (var ips=0; ips<ps.length; ips++) {
if (ps[ips].outerHTML.indexOf(' name="') != -1) {
location_href+='&' + ps[ips].outerHTML.split(' name="')[1].split('"')[0] + '=' + encodeURIComponent(ps[ips].innerHTML);
} else if (ps[ips].outerHTML.indexOf(' id="') != -1) {
location_href+='&' + ps[ips].outerHTML.split(' id="')[1].split('"')[0] + '=' + encodeURIComponent(ps[ips].innerHTML);
}
}
location.href=location_href;
}

function validateform() {
var bulkofurl='';
var ps=document.getElementsByTagName('p');
for (var ips=0; ips<ps.length; ips++) {
if (ps[ips].outerHTML.indexOf(' name="') != -1) {
bulkofurl+='&' + ps[ips].outerHTML.split(' name="')[1].split('"')[0] + '=' + encodeURIComponent(ps[ips].innerHTML);
} else if (ps[ips].outerHTML.indexOf(' id="') != -1) {
bulkofurl+='&' + ps[ips].outerHTML.split(' id="')[1].split('"')[0] + '=' + encodeURIComponent(ps[ips].innerHTML);
}
}
cookiesaved=false;
savecookie('theseones');
if (bulkofurl.length > 800) {
document.getElementById('myform').action=document.getElementById('myform').action.replace('.html','.php').replace('.htm','.php');
document.getElementById('myform').method='POST';
//alert('doing php');
}
return true;
}
</script>
</head>
<body onload="docount(); amendvia((location.search.split('max=')[1] ? location.search.split('max=')[1].split('&')[0] : ''));" style='background-color:cyan;'>
<form onsubmit="return validateform()" id='myform' method='GET' action='./timed_count.html'><input type=hidden name=a value=a></input>
<table id=toptable border=7 cellpadding=20 cellspacing=20><tbody><tr><td style='vertical-align:top;'>
<h4 name='cscore' id='score' style='display:none;'>Score: 0 from 0 dropdown reveal goes</h4>

<table><tbody id='mytbody'><tr id='mytr'><td id='td0'>
<script type='text/javascript'>
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
savedih="<div style='width:100%;text-align:center;'><input style='display:none;width:1px;height:1px;' value='Score Now' type=button onclick=' mymchange(this);' id='imysel'></input><br><div ontouchdown='mytclick(this);' onfocus=' inf=true; ' onclick=\" if (inf) { inf=false; setTimeout(doit,500); }\"><p id='pdatebit'></p><br><select style=width:100%; id='mysel' onfocus='myclick(this);' onchange='mytclick(this);' onclick='myclick(this);'><option id='o0' name='data" + thetime() + "' ontouchdown='myoclick(this);' onclick='myoclick(this);' value=>Please select item(s) below as you see them ...</option></select><br><br><br><div id='mydsel'></div><br><br> ... or via Keyboard: <input type=text id=mykb onkeyup='cval(event);' value=''></input></div></div>";
//alert(savedih);
document.write(savedih);
} else {
savedih="<div style='width:100%;text-align:center;'><input style='display:none;' value='Ready?' type=button onclick='mymchange(this);' id='imysel'></input><br><div onclick='myclick(this);'><p id='pdatebit'></p><br><select style=width:100%; id='mysel' onfocus='myclick(this);' onclick='myclick(this);'><option id='o0' name='data" + thetime() + "' onclick='myoclick(this);' value=>Please select item(s) below as you see them ...</option></select><br><br> ... or via Keyboard: <input type=text id=mykb onkeyup='cval(event);' value=''></input></div></div>";
//alert(savedih);
document.write(savedih);
}
</script>
</td>
</tr></tbody></table>
</td><td id='next0' style='vertical-align:top;'><br><br><br><br></td><td style='vertical-align:top;'>
<h1>Timed Count <select onchange='ask(this.value);' id='its' name='subject'><option id='osubject' value=''>of Vehicles</option><option value=' '>of Some Other Items</option></select><br> ... at <input style="width:65%;" title="Where?" name=place id=place type=text value=></input><br> ... by <input style="width:65%;" title="Who?" name=person id=person type=text value=></input><br> ... for <input style="width:65%;" title="Why?" name=reason id=reason type=text value=></input></h1>
<h2>Every Starting <select id='howoften' name='howoften'><option value='30000'>Thirty Seconds</option><option value='60000' selected>Minute</option><option value='300000'>Five Minutes</option><option value='600000'>Ten Minutes</option><option value='900000'>Fifteen Minutes</option><option value='1200000'>Twenty Minutes</option><option value='1800000'>Thirty Minutes</option><option value='2400000'>Forty Minutes</option><option value='3000000'>Fifty Minutes</option><option value='3600000'>One Hour</option><option value='7200000'>Two Hours</option><option value='10800000'>Three Hours</option><option value='14400000'>Four Hours</option><option value='18000000'>Five Hours</option><option value='21600000'>Six Hours</option><option value='25200000'>Seven Hours</option><option value='28800000'>Eight Hours</option><option value='32400000'>Nine Hours</option><option value='36000000'>Ten Hours</option><option value='39600000'>Eleven Hours</option><option value='43200000'>Twelve Hours</option><option value='86400000'>One Day</option><option value='604800000'>One Week</option></select></h2>
<h2>RJM Programming</h2>
<h2>December, 2016</h2>
<div id=statistics></div>
<div id=pie_histogram_google_chart></div>
</td></tr></tbody></table>
<div id=cookieextras></div>
<div id=extras></div>
<!--input onclick="doyourownget();" type=button id='isubmit' style='display:none;' value='Save and Recall'></input-->
<input type=submit id='isubmit' style='display:none;position:absolute;top:40px;left:60px;background-color:orange;' value='Save and Recall'></input>
</form>
<form target='myif' action='http://www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' style='display:none;' id='fcc' method='POST'>
<input type=hidden name='title' id='ftitle' value=''></input>
<input type=hidden name='value' id='fvalue' value=''></input>
<input type=hidden name='onclick' id='fonclick' value='y'></input>
<input type=hidden name='mode' id='fmode' value=''></input>
<input type=hidden name='label' id='flabel' value='Time'></input>
<input type=hidden name='data' id='fdata' value=''></input>
<input type=submit id=fcsubmit value='Submit'></input>
</form>
</body>
</html>