<html>
<head>
<title>Using Javascript Map Object - RJM Programming - August, 2024 ... thanks to https://www.w3schools.com/js/tryit.asp?filename=tryjs_map_groupby and https://medium.com/@sotoer/your-foreach-example-has-the-wrong-order-of-params-which-you-are-also-demonstrating-in-your-sample-42f5491b604e</title>
<style>
td {
vertical-align: top;
}

#demo, #droppable {
background-color: yellow;
}
</style>
<script type=text/javascript>

var m = new Map();
//m.set('b', 2);
//m.set('a', 1);
//m.forEach((k, v, m) => console.log(`key:${k} value:${v} map:${m}`));

var tippingpoint=200;
var tabletds='';
var rspan=1;
var doadd=false;
var text="";
var ddone=false;
var okaytext="These fruits are Ok:<br>";
var lowtext="<br>These fruits are low:<br>";
var lowword="low";
var okayword="ok";
var altered=false;
var thiscont='';
var geovalis='';

// Fish~`~taylor,300;barramundi,400;perch,100;mullet,234
// https://www.rjmprogramming.com.au/PHP/PieChart/pie_chart.php?title=Country%20Populations&onclick=y&task=Country&desc=Populations&data=,%20[~https;China,1347000000,India,1241000000,United%20States,312000000,Indonesia,238000000,Brazil,197000000,Pakistan,177000000,Nigeria,162000000,Bangladesh,151000000,Russia,143000000,Japan,128000000,Mexico,115000000,Philippines,96000000,Vietnam,88000000,Ethiopia,87000000,Germany,81800000,Egypt,82600000,Iran,78000000,Turkey,74000000,Thailand,69500000,Congo,67800000,France,63300000,United%20Kingdom,62700000,Italy,60800000~,100]" href="https://www.rjmprogramming.com.au/PHP/PieChart/pie_chart.php?title=Country%20Populations&onclick=y&task=Country&desc=Population&data=,%20[~https;China,1347000000,India,1241000000,United%20States,312000000,Indonesia,238000000,Brazil,197000000,Pakistan,177000000,Nigeria,162000000,Bangladesh,151000000,Russia,143000000,Japan,128000000,Mexico,115000000,Philippines,96000000,Vietnam,88000000,Ethiopia,87000000,Germany,81800000,Egypt,82600000,Iran,78000000,Turkey,74000000,Thailand,69500000,Congo,67800000,France,63300000,United%20Kingdom,62700000,Italy,60800000~,100]" target="_blank">https://www.rjmprogramming.com.au/PHP/PieChart/pie_chart.php?title=Country%20Populations&onclick=y&task=Country&desc=Populations&data=,%20[~https;China,1347000000,India,1241000000,United%20States,312000000,Indonesia,238000000,Brazil,197000000,Pakistan,177000000,Nigeria,162000000,Bangladesh,151000000,Russia,143000000,Japan,128000000,Mexico,115000000,Philippines,96000000,Vietnam,88000000,Ethiopia,87000000,Germany,81800000,Egypt,82600000,Iran,78000000,Turkey,74000000,Thailand,69500000,Congo,67800000,France,63300000,United%20Kingdom,62700000,Italy,60800000~,100]
// http://www.rjmprogramming.com.au/PHP/HistogramChart/histogram_chart.php?title=huh&onclick=y&task=Number&desc=Count&data=,[~11~,184],[~21~,182],[~27~,142],[~36~,147],[~62~,79],[~24~,187],[~14~,184],[~18~,183],[~49~,109],[~67~,72],[~31~,124],[~43~,103],[~47~,127],[~20~,181],[~06~,167],[~30~,132],[~53~,118],[~56~,116],[~19~,178],[~05~,168],[~23~,186],[~40~,121],[~50~,114],[~37~,126],[~52~,123],[~58~,115],[~10~,181],[~44~,120],[~01~,171],[~03~,176],[~13~,164],[~26~,158],[~45~,126],[~65~,64],[~28~,149],[~02~,169],[~42~,109],[~55~,120],[~32~,155],[~33~,145],[~16~,166],[~48~,113],[~15~,157],[~17~,172],[~63~,90],[~07~,170],[~04~,169],[~51~,111],[~54~,127],[~57~,115],[~60~,62],[~69~,82],[~08~,170],[~12~,176],[~41~,125],[~46~,108],[~61~,93],[~34~,116],[~38~,122],[~39~,147],[~35~,118],[~22~,171],[~66~,70],[~25~,167],[~68~,75],[~09~,161],[~64~,82],[~59~,131],[~29~,131]
// https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=World%20Map&width=834&height=520&country=Country&popularity=Popularity&data=%20[~IT~,2]

// Create an Array
var fruits = [
{name:"apples", quantity:300},
{name:"bananas", quantity:500},
{name:"oranges", quantity:200},
{name:"kiwi", quantity:150}
];

// Callback function to select low volumes
function myCallback({ quantity }) {
return (('' + quantity).trim() == '' ? 0 : quantity) > tippingpoint ? okayword : lowword;
}

function mysimpleCallback(qty) {
//alert(qty);
return (('' + qty).trim() == '' ? 0 : qty) > tippingpoint ? okayword : lowword;
}

function process(what) {
document.getElementById('demo').innerHTML=thiscont;
fruits=[];
m = new Map();
alteredstate(document.getElementById('demo'), true);
return thiscont;
}

function andthendo(inthing) {
document.getElementById('thname').innerHTML=location.search.split('thname=')[1] ? decodeURIComponent(location.search.split('thname=')[1].split('&')[0].split('#')[0]) : document.getElementById('thname').innerHTML;
document.getElementById('thquantity').innerHTML=location.search.split('thquantity=')[1] ? decodeURIComponent(location.search.split('thquantity=')[1].split('&')[0].split('#')[0]) : document.getElementById('thquantity').innerHTML;
document.getElementById('topic').innerHTML=location.search.split('topic=')[1] ? decodeURIComponent(location.search.split('topic=')[1].split('&')[0].split('#')[0]) : document.getElementById('topic').innerHTML;
document.getElementById('threport').innerHTML=location.search.split('threport=')[1] ? decodeURIComponent(location.search.split('threport=')[1].split('&')[0].split('#')[0]) : document.getElementById('threport').innerHTML;
return inthing;
}

function moreencodeURIComponent(intodo) {
var indemo=null;
outstuff=encodeURIComponent(intodo);
indemo=document.getElementById('thname');
if (outstuff == '') {
outstuff+='?thname=' + encodeURIComponent(('' + (indemo.innerHTML)))
} else {
outstuff+='&thname=' + encodeURIComponent(('' + (indemo.innerHTML)))
}
indemo=document.getElementById('thquantity');
if (outstuff == '') {
outstuff+='?thquantity=' + encodeURIComponent(('' + (indemo.innerHTML)))
} else {
outstuff+='&thquantity=' + encodeURIComponent(('' + (indemo.innerHTML)))
}
indemo=document.getElementById('topic');
if (outstuff == '') {
outstuff+='?topic=' + encodeURIComponent(('' + (indemo.innerHTML)))
} else {
outstuff+='&topic=' + encodeURIComponent(('' + (indemo.innerHTML)))
}
indemo=document.getElementById('threport');
if (outstuff == '') {
outstuff+='?threport=' + encodeURIComponent(('' + (indemo.innerHTML)))
} else {
outstuff+='&threport=' + encodeURIComponent(('' + (indemo.innerHTML)))
}
return outstuff;
}

function alteredstate(indemo, readd) {
var reprecs=[], ireprecs=0, recwords=[];
//alert(('' + (indemo.innerText | indemo.contentWindow | indemo.contentDocument)) + ' vs ' + indemo.innerHTML);
var theses=('' + (indemo.innerHTML)).split('These ');
if (eval('' + theses.length) == 3) {
if (theses[1].indexOf(':') != -1 && theses[2].indexOf(':') != -1) {
altered=true;
okaytext='These ' + theses[1].split(':')[0] + ':<br>';
lowtext='<br>These ' + theses[2].split(':')[0] + ':<br>';
if (theses[1].indexOf(' are ') != -1) {
//alert('Yes ' + okaytext);
document.getElementById('topic').innerHTML=theses[1].split(' are ')[0].substring(0,1).toUpperCase() + theses[1].split(' are ')[0].substring(1).toLowerCase().replace(/s$/g,'');
okayword=theses[1].split(' are ')[1].split(':')[0].toLowerCase();
document.getElementById('spanok').innerHTML=theses[1].split(' are ')[1].split(':')[0];
document.getElementById('itip').step=0.001;
if (('' + readd).replace(/^undefined$/g, '') != '') {
// alert('yes ' + okaytext.replace('These ','') + ' RE ' + theses[1]);
//alert(theses[1].split(okaytext.replace('These ',''))[1].split('<br>These ')[0]);
reprecs=theses[1].split(okaytext.replace('These ',''))[1].split('<br>These ')[0].split('<br>');
for (ireprecs=0; ireprecs<reprecs.length; ireprecs++) {
recwords=reprecs[ireprecs].split(' ');
if (eval('' + recwords.length) > 1) {
if (reprecs[ireprecs].replace(' ' + recwords[eval(-1 + recwords.length)], '').replace('' + recwords[eval(-1 + recwords.length)], '').trim() != '') {
//alert('ok: ' + reprecs[ireprecs].replace(' ' + recwords[eval(-1 + recwords.length)], '').replace('' + recwords[eval(-1 + recwords.length)], '').trim());
addone(reprecs[ireprecs].replace(' ' + recwords[eval(-1 + recwords.length)], '').replace('' + recwords[eval(-1 + recwords.length)], '').trim(), recwords[eval(-1 + recwords.length)]);
}
}
}
}
}
if (theses[2].indexOf(' are ') != -1) {
document.getElementById('topic').innerHTML=theses[2].split(' are ')[0].substring(0,1).toUpperCase() + theses[2].split(' are ')[0].substring(1).toLowerCase().replace(/s$/g,'');
lowword=theses[2].split(' are ')[1].split(':')[0].toLowerCase();
document.getElementById('spanlow').innerHTML=theses[2].split(' are ')[1].split(':')[0];
document.getElementById('itip').step=0.001;
if (('' + readd).replace(/^undefined$/g, '') != '') {
reprecs=theses[2].split(lowtext.replace('<br>These ',''))[1].split('<br>');
for (ireprecs=0; ireprecs<reprecs.length; ireprecs++) {
recwords=reprecs[ireprecs].split(' ');
if (eval('' + recwords.length) > 1) {
if (reprecs[ireprecs].replace(' ' + recwords[eval(-1 + recwords.length)], '').replace('' + recwords[eval(-1 + recwords.length)], '').trim() != '') {
//alert('low: ' + reprecs[ireprecs].replace(' ' + recwords[eval(-1 + recwords.length)], '').replace('' + recwords[eval(-1 + recwords.length)], '').trim());
addone(reprecs[ireprecs].replace(' ' + recwords[eval(-1 + recwords.length)], '').replace('' + recwords[eval(-1 + recwords.length)], '').trim(), recwords[eval(-1 + recwords.length)]);
}
}
}
}
}
}
}
if (('' + readd).replace(/^undefined$/g, '') != '') {
document.getElementById('itip').value=location.search.split('tippingvalue=')[1] ? andthendo(decodeURIComponent(location.search.split('tippingvalue=')[1].split('&')[0].split('#')[0])) : document.getElementById('itip').value;
tippingpoint=eval('' + document.getElementById('itip').value);
beadjustable();
}
}

function addone(knownname, knownquantity) {
doadd=true;
//alert(knownname);
//alert(knownquantity);
if (('' + knownname) != 'undefined' && ('' + knownquantity) != 'undefined') {
fruits.push({name:knownname, quantity:knownquantity});
m.set(knownname, knownquantity);
} else if (('' + knownname) != 'undefined') {
fruits.push({name:knownname, quantity:0});
m.set(knownname, 0);
} else {
fruits.push({name:"", quantity:0});
m.set('', 0);
}
doadd=false;
beadjustable();
}

function fix(tdo) {
var idx=0, needto=true;
if (tdo.id.indexOf('tdname') == 0) {
if (tdo.id != 'tdname') { idx=eval(('' + tdo.id).substring(6)); }
fruits[idx].name=('' + (tdo.innerHTML));
if (m.has("")) {
m.delete("");
m.set(fruits[idx].name, fruits[idx].quantity);
tdo.setAttribute('contenteditable', false);
}
if (needto) { beadjustable(); }
} else {
if (tdo.id != 'tdquantity') { idx=eval(('' + tdo.id).substring(10)); }
//alert(tdo.outerHTML);
//alert('idx=' + idx + ' and ' + ('' + (tdo.innerText | tdo.contentWindow | tdo.contentDocument)) + ' and fruits[idx].name=' + fruits[idx].name);
if (m.has(fruits[idx].name)) {
if (('' + fruits[idx].quantity) == ('' + (tdo.innerText | tdo.contentWindow | tdo.contentDocument))) { needto=false; }
}
if (needto) {
fruits[idx].quantity=('' + (tdo.innerText | tdo.contentWindow | tdo.contentDocument));
if (m.has(fruits[idx].name)) {
m.set(fruits[idx].name, fruits[idx].quantity);
}
}
if (needto) { beadjustable(); }
}
}

function thecall() {
var kk=0;

// Group by ok and low
if (altered) {
text=okaytext;
} else {
text="These " + document.getElementById('topic').innerHTML.toLowerCase() + "s are Ok:<br>";
}
try {
const result = Map.groupBy(fruits, myCallback);

// Display Results
try {
for (let x of result.get(okayword)) {
if (x.name != '' || x.quantity != 0) {
text += "" + x.name + " " + x.quantity + "<br>";
}
if (!m.has(x.name)) {
m.set(x.name, x.quantity);
}
}
} catch(ebad) { }
if (altered) {
text+=lowtext;
} else {
text += "<br>These " + document.getElementById('topic').innerHTML.toLowerCase() + "s are low:<br>";
}
try {
for (let x of result.get(lowword)) {
if (x.name != '' || x.quantity != 0) {
text += "" + x.name + " " + x.quantity + "<br>";
}
if (!m.has(x.name)) {
m.set(x.name, x.quantity);
}
}
console.log(result.get(okayword));
} catch(ebad) { }
} catch(overebad) {
if (altered) {
text=okaytext;
} else {
text="These " + document.getElementById('topic').innerHTML.toLowerCase() + "s are Ok:<br>";
}
for (kk=0; kk<fruits.length; kk++) {
if (('' + fruits[kk].quantity).replace('-','').substring(0,1) >= '0' && ('' + fruits[kk].quantity).replace('-','').substring(0,1) <= '9') {
if (mysimpleCallback(fruits[kk].quantity) == 'ok') {
//alert(fruits[kk].name);
text += "" + fruits[kk].name + " " + fruits[kk].quantity + "<br>";
//alert('2:' + fruits[kk].name);
if (!m.has(fruits[kk].name)) {
//alert('3:' + fruits[kk].name);
m.set(fruits[kk].name, fruits[kk].quantity);
//alert('4:' + fruits[kk].name);
}
}
}
}
if (altered) {
text+=lowtext;
} else {
text += "<br>These " + document.getElementById('topic').innerHTML.toLowerCase() + "s are low:<br>";
}
for (kk=0; kk<fruits.length; kk++) {
if (('' + fruits[kk].quantity).replace('-','').substring(0,1) >= '0' && ('' + fruits[kk].quantity).replace('-','').substring(0,1) <= '9') {
if (mysimpleCallback(fruits[kk].quantity) == 'low') {
text += "" + fruits[kk].name + " " + fruits[kk].quantity + "<br>";
if (!m.has(fruits[kk].name)) {
m.set(fruits[kk].name, fruits[kk].quantity);
}
}
}
}

}
document.getElementById("demo").innerHTML = text;

}

function consolelog(inrec) {
if (rspan == 0) {
document.getElementById("tdname").innerHTML=inrec.split('value:')[1].split(' key:')[0].split(' map:')[0];
document.getElementById("tdquantity").innerHTML=inrec.split('key:')[1].split(' value:')[0].split(' map:')[0];
rspan=1;
} else if (inrec.split('value:')[1].split(' key:')[0].split(' map:')[0] == '') {
tabletds+='<tr><td contenteditable=true id=tdname' + rspan + ' onblur=fix(this);>' + inrec.split('value:')[1].split(' key:')[0].split(' map:')[0] + '</td><td contenteditable=true id=tdquantity' + rspan + ' onblur=fix(this);>' + inrec.split('key:')[1].split(' value:')[0].split(' map:')[0] + '</td></tr>';
rspan++;
} else {
tabletds+='<tr><td contenteditable=false id=tdname' + rspan + ' onblur=fix(this);>' + inrec.split('value:')[1].split(' key:')[0].split(' map:')[0] + '</td><td contenteditable=true id=tdquantity' + rspan + ' onblur=fix(this);>' + inrec.split('key:')[1].split(' value:')[0].split(' map:')[0] + '</td></tr>';
rspan++;
}
//alert(inrec);
if (doadd) {
fruits.push({name:"", quantity:0});
m.set('', 0);
tabletds+='<tr><td contenteditable=true id=tdname' + rspan + ' onblur=fix(this);></td><td contenteditable=true id=tdquantity' + rspan + ' onblur=fix(this);>0</td></tr>';
rspan++;
doadd=false;
}
}

function dragElement(elmnt) { // thanks to https://www.w3schools.com/howto/howto_js_draggable.asp
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
if (document.getElementById(elmnt.id + "header")) {
// if present, the header is where you move the DIV from:
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
} else {
// otherwise, move the DIV from anywhere inside the DIV:
elmnt.onmousedown = dragMouseDown;
}

function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
// get the mouse cursor position at startup:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
// call a function whenever the cursor moves:
document.onmousemove = elementDrag;
}

function elementDrag(e) {
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
alert('Here');
}

function closeDragElement() {
// stop moving when mouse button is released:
document.onmouseup = null;
document.onmousemove = null;
}
}


function allowDrop(ev) { // thanks to https://www.w3schools.com/html/html5_draganddrop.asp
ev.preventDefault();
}

function drag(ev) { // thanks to https://www.w3schools.com/html/html5_draganddrop.asp
ev.dataTransfer.setData("text", ev.target.id);
}

function doemail(data) {
var a=null;
a = document.createElement("a");
var contis=(document.getElementById('demo').innerText || document.getElementById('demo').contentWindow || document.getElementById('demo').contentDocument);
var topicis=(document.getElementById('topic').innerText || document.getElementById('topic').contentWindow || document.getElementById('topic').contentDocument);
var subjis=(document.getElementById('threport').innerText || document.getElementById('threport').contentWindow || document.getElementById('threport').contentDocument);
a.href='mailto:?subject=' + encodeURIComponent(topicis) + '%20' + encodeURIComponent(subjis) + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '?tippingvalue=' + moreencodeURIComponent(document.getElementById('itip').value) + '#data=') + encodeURIComponent(encodeURIComponent(contis.replace(/\<bJUNKr\>/g, String.fromCharCode(10))));
a.click();
}

function dosms(data) {
var a=null;
a = document.createElement("a");
var contis=(document.getElementById('demo').innerText || document.getElementById('demo').contentWindow || document.getElementById('demo').contentDocument);
var topicis=(document.getElementById('topic').innerText || document.getElementById('topic').contentWindow || document.getElementById('topic').contentDocument);
a.href='sms:&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '?tippingvalue=' + moreencodeURIComponent(document.getElementById('itip').value) + '#data=') + encodeURIComponent(encodeURIComponent(contis.replace(/\<bJUNKr\>/g, String.fromCharCode(10))));
a.click();
}

function drop(ev) { // thanks to https://www.w3schools.com/html/html5_draganddrop.asp
var ssrect=null, isemail=true, a=null;
ssrect=document.getElementById('droppable').getBoundingClientRect();
if (eval(ssrect.right - ev.clientX) < eval(ev.clientX - ssrect.left)) { isemail=false; }
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
if (isemail) {
//a = document.createElement("a");
//a.href='mailto:?subject=' + encodeURIComponent(document.getElementById('topic').innerHTML) + '%20Report%20of%20Inventory&body=' + encodeURIComponent(document.getElementById(data).innerHTML.replace(/\<bJUNKr\>/g, String.fromCharCode(10)));
//a.click();
doemail(data);
} else if (!isemail) {
//a = document.createElement("a");
//a.href='sms:&body=' + encodeURIComponent(document.getElementById(data).innerHTML.replace(/\<bJUNKr\>/g, String.fromCharCode(10)));
//a.click();
dosms(data);
} else {
ev.target.appendChild(document.getElementById(data));
}
}

function beadjustable() {
var srect=null;
var tpis=location.search.split('tippingvalue=')[1] ? andthendo(decodeURIComponent(location.search.split('tippingvalue=')[1].split('&')[0].split('#')[0])) : document.getElementById('itip').value;
if (!ddone) {
ddone=true;
if (('' + location.hash).indexOf('#data') == 0) {
thiscont=decodeURIComponent(('' + location.hash).substring(5).replace(/^\=/g,'').replace(/^\%3d/g,'').replace(/^\%3D/g,'').replace(/\%0A/g,encodeURIComponent('<br>')));
setTimeout(function(){ document.getElementById('demo').innerHTML=process(decodeURIComponent(('' + location.hash).substring(5).replace(/^\=/g,'').replace(/^\%3d/g,'').replace(/^\%3D/g,'').replace(/\%0A/g,encodeURIComponent('<br>')))); }, 3000);
}
srect=document.getElementById('droppable').getBoundingClientRect();
document.getElementById('droppable').style.border='1px pink dotted';
document.getElementById('droppable').style.position='absolute';
document.getElementById('droppable').style.top='' + srect.top + 'px';
document.getElementById('droppable').style.left='' + srect.left + 'px';
// Make the DIV element draggable ... thanks to https://www.w3schools.com/howto/howto_js_draggable.asp
dragElement(document.getElementById('droppable'));
}
tippingpoint=eval('' + document.getElementById('itip').value);
document.getElementById("mysup").title='Add an editable ' + document.getElementById('topic').innerHTML.toLowerCase();
thecall();
tabletds='';
rspan=0;
m.forEach((k, v, m) => consolelog(`key:${k} value:${v} map:${m}`));
document.getElementById("thd").innerHTML = document.getElementById("thd").innerHTML.split(document.getElementById("demo").innerHTML)[0] + document.getElementById("demo").innerHTML + '</td></tr>' + tabletds;
document.getElementById("demo").rowSpan = rspan;
document.getElementById("tdtip").rowSpan = rspan;
document.getElementById('itip').value = tippingpoint;
if (tpis != tippingpoint) {
setTimeout(function(){
document.getElementById('itip').value=location.search.split('tippingvalue=')[1] ? andthendo(decodeURIComponent(location.search.split('tippingvalue=')[1].split('&')[0].split('#')[0])) : document.getElementById('itip').value;
tippingpoint=eval('' + document.getElementById('itip').value);
beadjustable();
}, 2000);
}
ddone=true;
if (document.getElementById('dif').innerHTML != '' && document.getElementById('myifis')) {
document.getElementById('myifis').src=datait(document.getElementById('myifis').src.split('&data=')[0] + '&data=');
}
}

function askall(preenterall) {
var isfirst=true;
var delall=false;
var enterall=('' + preenterall).replace(/^undefined$/g,'');
if (enterall == '') {
enterall=prompt('Optionally copy all your CSV (comma separated values) data to apply here (where ; or | can be record delimiters). Optionally prefix this CSV data with your topic followed by ~`~' + String.fromCharCode(10) + String.fromCharCode(10) + 'Example ...' + String.fromCharCode(10) + 'Fish~`~taylor,300;barramundi,400;perch,100;mullet,234', '');
} //else {
//alert(enterall);
//}
if (enterall == null) { enterall=''; }
if (enterall.indexOf('~`~') != -1) { document.getElementById('topic').innerHTML=enterall.split('~`~')[0]; enterall=enterall.replace(enterall.split('~`~')[0] + '~`~', ''); }
if (enterall.indexOf(',') != -1) {
var elines=[];
if (enterall.indexOf(String.fromCharCode(10)) != -1) {
elines=enterall.split(String.fromCharCode(10));
} else if (enterall.indexOf(';') != -1) {
elines=enterall.split(';');
} else if (enterall.indexOf('|') != -1) {
elines=enterall.split('|');
}
for (var ie=0; ie<elines.length; ie++) {
if (elines[ie].indexOf('","') != -1 && elines[ie].indexOf('","') < elines[ie].indexOf(',')) {
if (!delall) {
delall=true;
fruits=[];
m = new Map();
}
if (elines[ie].substring(1).replace('-','').substring(0,1) >= '0' && elines[ie].substring(1).replace('-','').substring(0,1) <= '9') {
//alert(1);
addone(elines[ie].split('","')[1].split('"')[0], elines[ie].substring(1).split('"')[0]);
} else {
//alert(2);
addone(elines[ie].substring(1).split('"')[0], elines[ie].split('","')[1].split('"')[0]);
}
} else if (elines[ie].indexOf('",') != -1 && elines[ie].indexOf('",') < elines[ie].indexOf(',')) {
if (!delall) {
delall=true;
fruits=[];
m = new Map();
}
if (elines[ie].substring(1).replace('-','').substring(0,1) >= '0' && elines[ie].substring(1).replace('-','').substring(0,1) <= '9') {
//alert(3);
addone(elines[ie].split('",')[1].split(',')[0], elines[ie].substring(1).split('"')[0]);
} else {
//alert(4);
addone(elines[ie].substring(1).split('"')[0], elines[ie].split('",')[1].split(',')[0]);
}
} else if (elines[ie].indexOf(',"') != -1 && elines[ie].indexOf(',"') == elines[ie].indexOf(',')) {
if (!delall) {
delall=true;
fruits=[];
m = new Map();
}
if (elines[ie].substring(0).replace('-','').substring(0,1) >= '0' && elines[ie].substring(0).replace('-','').substring(0,1) <= '9') {
//alert(5);
addone(elines[ie].split(',"')[1].split('"')[0], elines[ie].substring(0).split(',')[0]);
} else {
//alert(6);
addone(elines[ie].substring(0).split(',')[0], elines[ie].split(',"')[1].split('"')[0]);
}
} else if (elines[ie].indexOf(',') != -1) {
if (!delall) {
delall=true;
fruits=[];
m = new Map();
}
if (elines[ie].substring(0).replace('-','').substring(0,1) >= '0' && elines[ie].substring(0).replace('-','').substring(0,1) <= '9') {
//alert(7);
addone(elines[ie].substring(0).split(',')[1], elines[ie].substring(0).split(',')[0]);
} else {
//alert(8);
if (isfirst && ((elines[ie].substring(0).split(',')[1] + ' ').replace('-','').substring(0,1) < '0' || (elines[ie].substring(0).split(',')[1] + ' ').replace('-','').substring(0,1) > '9')) {
document.getElementById('topic').innerHTML=elines[ie].substring(0).split(',')[0].substring(0,1).toUpperCase() + elines[ie].substring(0).split(',')[0].substring(1);
document.getElementById('thname').innerHTML=elines[ie].substring(0).split(',')[0].substring(0,1).toUpperCase() + elines[ie].substring(0).split(',')[0].substring(1);
document.getElementById('thquantity').innerHTML=elines[ie].substring(0).split(',')[1].substring(0,1).toUpperCase() + elines[ie].substring(0).split(',')[1].substring(1);
} else {
addone(elines[ie].substring(0).split(',')[0], elines[ie].substring(0).split(',')[1]);
}
}
}
isfirst=false;
}
beadjustable();
}
}

function extractContent(s, space) { // thanks to https://stackoverflow.com/questions/28899298/extract-the-text-out-of-html-string-using-javascript
var xmlret='';
if (s.split('>')[0].indexOf('xml') != -1 && eval('' + s.split('>').length) > 1) {
var innards=s.split('>');
for (var iri=1; iri<innards.length; iri++) {
xmlret+=innards[iri].split('<')[0];
}
return xmlret;
}
var span= document.createElement('span');
span.innerHTML= s;
if (space) {
var children= span.querySelectorAll('*');
for(var i = 0 ; i < children.length ; i++) {
if(children[i].textContent)
children[i].textContent+= ' ';
else
children[i].innerText+= ' ';
}
}
return [span.textContent || span.innerText].toString().replace(/ +/g,' ');
}

function yesthreethree(restis) {
if (restis.indexOf(';base64,') != -1) {
var icontent=window.atob(restis.split(';base64,')[1]);
if ((('' + icontent).trim() + ' ').replace(/^\[caption/g,'<').substring(0,1) == '<') {
askall(extractContent(icontent,true));
} else {
askall(icontent);
}
} else {
askall(restis);
}
}

function alatr() {
if (document.getElementById('psubm')) {
document.getElementById('psubm').click();
}
}

function toolong(inup) {
if (inup.split('&emailto=').length > 2) {
while (inup.split('&emailto=').length > 2) {
inup=inup.replace('&emailto=' + inup.split('&emailto=')[1].split('&')[0],'');
}
}
if (inup.split('&emailsubject=').length > 2) {
while (inup.split('&emailsubject=').length > 2) {
inup=inup.replace('&emailsubject=' + inup.split('&emailsubject=')[1].split('&')[0],'');
}
}
if (inup.split('&emailcc=').length > 2) {
while (inup.split('&emailcc=').length > 2) {
inup=inup.replace('&emailcc=' + inup.split('&emailcc=')[1].split('&')[0],'');
}
}
if (inup.split('&emailbcc=').length > 2) {
while (inup.split('&emailbcc=').length > 2) {
inup=inup.replace('&emailbcc=' + inup.split('&emailbcc=')[1].split('&')[0],'');
}
}
if (inup.indexOf('&email') > inup.indexOf('&data')) {
var putb=inup.substring(inup.indexOf('&email'));
inup=inup.replace(putb,'');
inup=inup.replace('&data', putb + '&data');
}
if (window.top && 2 == 5) {
if (top.document.getElementById('myform') || top.document.indexOf('/map_test.htm') != -1) {
top.document.title='86';
alert(86);
if (top.document.getElementById('myform').action.indexOf('#pleaseno') != -1) {
if (inup.length < 900) {
var xszc=prompt('pform', inup);
}
}
}
}
if (inup.length < 900) return inup;
var texr=' target=_self ';
if (document.getElementById('specf')) { texr=' target=specf '; }
var pform='<form' + texr + ' method=POST style=display:none; action=' + inup.split('?')[0] + '><input type=hidden name=wouldlikeyoutoseekpermission value=y></input><input type=submit id=psubm></input></form>';
var pars=inup.replace('?','&').split('#')[0].split('&');
for (var ipars=1; ipars<pars.length; ipars++) {
if (decodeURIComponent(pars[ipars].split('=')[1]).indexOf("data:") != -1) {
pform=pform.replace('</form>', '<input type=hidden name="' + pars[ipars].split('=')[0] + '" value="' + decodeURIComponent(pars[ipars].replace(pars[ipars].split('=')[0] + '=','')).replace(/\+/g,'%2b') + '"></input></form>');
} else {
pform=pform.replace('</form>', '<input type=hidden name="' + pars[ipars].split('=')[0] + '" value="' + decodeURIComponent(pars[ipars].replace(pars[ipars].split('=')[0] + '=','')) + '"></input></form>');
}
}
if (window.top && 3 == 7) {
if (top.document.getElementById('myform') || top.document.indexOf('/map_test.htm') != -1) {
top.document.title='286';
alert(286);
if (top.document.getElementById('myform').action.indexOf('#pleaseno') != -1) {
var xzc=prompt(pform, pform);
}
}
}
//top.document.title='2:' + pform;
document.body.innerHTML+=pform;
//alert(pform.split(' name="task"')[1]);
setTimeout(alatr, 2000); //document.getElementById('psubm').click();
return '#';
}


function datait(oselv) {
var outv=oselv, kk=0, firstdelim='';
//alert(outv);
if (outv != '') {
if (oselv.indexOf('PHP/Pie') != -1) {
document.getElementById('title').value=document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' + document.getElementById('spanlow').innerHTML + ' Report';
document.getElementById('popularity').value=document.getElementById('thquantity').innerHTML;
document.getElementById('task').value=document.getElementById('thquantity').innerHTML;
document.getElementById('country').value=document.getElementById('thname').innerHTML;
document.getElementById('desc').value=document.getElementById('thname').innerHTML;
outv=outv.replace('title=Title', 'title=' + encodeURIComponent(document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' + document.getElementById('spanlow').innerHTML + ' Report'));
outv=outv.replace('popularity=Popularity', 'popularity=' + encodeURIComponent(document.getElementById('thquantity').innerHTML));
outv=outv.replace('country=Country', 'country=' + encodeURIComponent(document.getElementById('thname').innerHTML));
outv=outv.replace('task=Popularity', 'task=' + encodeURIComponent(document.getElementById('thquantity').innerHTML));
outv=outv.replace('desc=Country', 'desc=' + encodeURIComponent(document.getElementById('thname').innerHTML));

for (kk=0; kk<fruits.length; kk++) {
if (('~,' + fruits[kk].quantity + ']').replace(/\~\,\]/g,'~,0]').indexOf('-') == -1) {
outv+=',[~' + encodeURIComponent(fruits[kk].name) + ('~,' + fruits[kk].quantity + ']').replace(/\~\,\]/g,'~,0]');
}
}
} else if (oselv.indexOf('PHP/Histogram') != -1) {
document.getElementById('title').value=document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' + document.getElementById('spanlow').innerHTML + ' Report';
document.getElementById('popularity').value=document.getElementById('thquantity').innerHTML;
document.getElementById('task').value=document.getElementById('thquantity').innerHTML;
document.getElementById('country').value=document.getElementById('thname').innerHTML;
document.getElementById('desc').value=document.getElementById('thname').innerHTML;
outv=outv.replace('title=Title', 'title=' + encodeURIComponent(document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' + document.getElementById('spanlow').innerHTML + ' Report'));
outv=outv.replace('popularity=Popularity', 'popularity=' + encodeURIComponent(document.getElementById('thquantity').innerHTML));
outv=outv.replace('country=Country', 'country=' + encodeURIComponent(document.getElementById('thname').innerHTML));
outv=outv.replace('task=Popularity', 'task=' + encodeURIComponent(document.getElementById('thquantity').innerHTML));
outv=outv.replace('desc=Country', 'desc=' + encodeURIComponent(document.getElementById('thname').innerHTML));

for (kk=0; kk<fruits.length; kk++) {
outv+=',[~' + encodeURIComponent(fruits[kk].name) + ('~,' + fruits[kk].quantity + ']').replace(/\~\,\]/g,'~,0]');
}
//alert(outv);
} else if (oselv.indexOf('PHP/Geo') != -1) {
document.getElementById('title').value=document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' + document.getElementById('spanlow').innerHTML + ' Report';
document.getElementById('popularity').value=document.getElementById('thquantity').innerHTML;
document.getElementById('task').value=document.getElementById('thquantity').innerHTML;
document.getElementById('country').value=document.getElementById('thname').innerHTML;
document.getElementById('desc').value=document.getElementById('thname').innerHTML;
outv=outv.replace('title=Title', 'title=' + encodeURIComponent(document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' + document.getElementById('spanlow').innerHTML + ' Report'));
outv=outv.replace('popularity=Popularity', 'popularity=' + encodeURIComponent(document.getElementById('thquantity').innerHTML));
outv=outv.replace('country=Country', 'country=' + encodeURIComponent(document.getElementById('thname').innerHTML));
outv=outv.replace('task=Popularity', 'task=' + encodeURIComponent(document.getElementById('thquantity').innerHTML));
outv=outv.replace('desc=Country', 'desc=' + encodeURIComponent(document.getElementById('thname').innerHTML));

for (kk=0; kk<fruits.length; kk++) {
outv+=firstdelim + '%20[~' + encodeURIComponent(fruits[kk].name) + ('~,' + fruits[kk].quantity + ']').replace(/\~\,\]/g,'~,0]') + '%20';
firstdelim=',';
}
if (('' + outv).length > 600) { return toolong(outv.replace('&data=%20', '&data=%20#')); }
}
}
if (('' + outv).length > 600) {
document.getElementById('data').value=',' + outv.split('&data=')[1].replace(/\%20/g,' ');
document.getElementById('myform').method='POST';
document.getElementById('myform').action=outv.split('?')[0] + '#pleasenolocationhref';
outv='./map_test.html';
//var xx=prompt(document.getElementById('myform').outerHTML,document.getElementById('myform').innerHTML);
setTimeout(function(){ document.getElementById('mysub').click(); }, 3000);
} else if (2 == 2) {
document.getElementById('data').value=outv.split('&data=')[1].replace(/\%20/g,' ');
document.getElementById('myform').method='GET';
document.getElementById('myform').action=outv.split('?')[0];
//outv='./map_test.html';
setTimeout(function(){ document.getElementById('mysub').click(); }, 3000);
}
return outv;
}

function selit(osel) {
if (osel.value != '') {
geovalis=osel.value;
document.getElementById('defopt').innerText='Google Chart display of ... relevant ' + osel.value.split('PHP/')[1].split('/')[0].replace('Chart',' Chart') + ' below ...';
document.getElementById('dif').innerHTML='<br><br><a id=atop href="#myh1">Back to top ...</a><br><br><iframe name=myifis id=myifis src="' + datait(osel.value) + '" style="width:100%;height:700px;"></iframe>';
document.getElementById('dif').style.display='block';
}
osel.value='';
location.href='#atop';
}

// https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php#title=World%20Map&width=834&height=520&country=Country&popularity=Popularity&data=%20[~AD~,42.546245]%20,%20[~AE~,23.424076]%20,%20[~AF~,33.93911]%20,%20[~AG~,17.060816]%20,%20[~AI~,18.220554]%20,%20[~AL~,41.153332]%20,%20[~AM~,40.069099]%20,%20[~AN~,12.226079]%20,%20[~AO~,-11.202692]%20,%20[~AQ~,-75.250973]%20,%20[~AR~,-38.416097]%20,%20[~AS~,-14.270972]%20,%20[~AT~,47.516231]%20,%20[~AU~,-25.274398]%20,%20[~AW~,12.52111]%20,%20[~AZ~,40.143105]%20,%20[~BA~,43.915886]%20,%20[~BB~,13.193887]%20,%20[~BD~,23.684994]%20,%20[~BE~,50.503887]%20,%20[~BF~,12.238333]%20,%20[~BG~,42.733883]%20,%20[~BH~,25.930414]%20,%20[~BI~,-3.373056]%20,%20[~BJ~,9.30769]%20,%20[~BM~,32.321384]%20,%20[~BN~,4.535277]%20,%20[~BO~,-16.290154]%20,%20[~BR~,-14.235004]%20,%20[~BS~,25.03428]%20,%20[~BT~,27.514162]%20,%20[~BV~,-54.423199]%20,%20[~BW~,-22.328474]%20,%20[~BY~,53.709807]%20,%20[~BZ~,17.189877]%20,%20[~CA~,56.130366]%20,%20[~CC~,-12.164165]%20,%20[~CD~,-4.038333]%20,%20[~CF~,6.611111]%20,%20[~CG~,-0.228021]%20,%20[~CH~,46.818188]%20,%20[~CI~,7.539989]%20,%20[~CK~,-21.236736]%20,%20[~CL~,-35.675147]%20,%20[~CM~,7.369722]%20,%20[~CN~,35.86166]%20,%20[~CO~,4.570868]%20,%20[~CR~,9.748917]%20,%20[~CU~,21.521757]%20,%20[~CV~,16.002082]%20,%20[~CX~,-10.447525]%20,%20[~CY~,35.126413]%20,%20[~CZ~,49.817492]%20,%20[~DE~,51.165691]%20,%20[~DJ~,11.825138]%20,%20[~DK~,56.26392]%20,%20[~DM~,15.414999]%20,%20[~DO~,18.735693]%20,%20[~DZ~,28.033886]%20,%20[~EC~,-1.831239]%20,%20[~EE~,58.595272]%20,%20[~EG~,26.820553]%20,%20[~EH~,24.215527]%20,%20[~ER~,15.179384]%20,%20[~ES~,40.463667]%20,%20[~ET~,9.145]%20,%20[~FI~,61.92411]%20,%20[~FJ~,-16.578193]%20,%20[~FK~,-51.796253]%20,%20[~FM~,7.425554]%20,%20[~FO~,61.892635]%20,%20[~FR~,46.227638]%20,%20[~GA~,-0.803689]%20,%20[~GB~,55.378051]%20,%20[~GD~,12.262776]%20,%20[~GE~,42.315407]%20,%20[~GF~,3.933889]%20,%20[~GG~,49.465691]%20,%20[~GH~,7.946527]%20,%20[~GI~,36.137741]%20,%20[~GL~,71.706936]%20,%20[~GM~,13.443182]%20,%20[~GN~,9.945587]%20,%20[~GP~,16.995971]%20,%20[~GQ~,1.650801]%20,%20[~GR~,39.074208]%20,%20[~GS~,-54.429579]%20,%20[~GT~,15.783471]%20,%20[~GU~,13.444304]%20,%20[~GW~,11.803749]%20,%20[~GY~,4.860416]%20,%20[~GZ~,31.354676]%20,%20[~HK~,22.396428]%20,%20[~HM~,-53.08181]%20,%20[~HN~,15.199999]%20,%20[~HR~,45.1]%20,%20[~HT~,18.971187]%20,%20[~HU~,47.162494]%20,%20[~ID~,-0.789275]%20,%20[~IE~,53.41291]%20,%20[~IL~,31.046051]%20,%20[~IM~,54.236107]%20,%20[~IN~,20.593684]%20,%20[~IO~,-6.343194]%20,%20[~IQ~,33.223191]%20,%20[~IR~,32.427908]%20,%20[~IS~,64.963051]%20,%20[~IT~,41.87194]%20,%20[~JE~,49.214439]%20,%20[~JM~,18.109581]%20,%20[~JO~,30.585164]%20,%20[~JP~,36.204824]%20,%20[~KE~,-0.023559]%20,%20[~KG~,41.20438]%20,%20[~KH~,12.565679]%20,%20[~KI~,-3.370417]%20,%20[~KM~,-11.875001]%20,%20[~KN~,17.357822]%20,%20[~KP~,40.339852]%20,%20[~KR~,35.907757]%20,%20[~KW~,29.31166]%20,%20[~KY~,19.513469]%20,%20[~KZ~,48.019573]%20,%20[~LA~,19.85627]%20,%20[~LB~,33.854721]%20,%20[~LC~,13.909444]%20,%20[~LI~,47.166]%20,%20[~LK~,7.873054]%20,%20[~LR~,6.428055]%20,%20[~LS~,-29.609988]%20,%20[~LT~,55.169438]%20,%20[~LU~,49.815273]%20,%20[~LV~,56.879635]%20,%20[~LY~,26.3351]%20,%20[~MA~,31.791702]%20,%20[~MC~,43.750298]%20,%20[~MD~,47.411631]%20,%20[~ME~,42.708678]%20,%20[~MG~,-18.766947]%20,%20[~MH~,7.131474]%20,%20[~MK~,41.608635]%20,%20[~ML~,17.570692]%20,%20[~MM~,21.913965]%20,%20[~MN~,46.862496]%20,%20[~MO~,22.198745]%20,%20[~MP~,17.33083]%20,%20[~MQ~,14.641528]%20,%20[~MR~,21.00789]%20,%20[~MS~,16.742498]%20,%20[~MT~,35.937496]%20,%20[~MU~,-20.348404]%20,%20[~MV~,3.202778]%20,%20[~MW~,-13.254308]%20,%20[~MX~,23.634501]%20,%20[~MY~,4.210484]%20,%20[~MZ~,-18.665695]%20,%20[~NA~,-22.95764]%20,%20[~NC~,-20.904305]%20,%20[~NE~,17.607789]%20,%20[~NF~,-29.040835]%20,%20[~NG~,9.081999]%20,%20[~NI~,12.865416]%20,%20[~NL~,52.132633]%20,%20[~NO~,60.472024]%20,%20[~NP~,28.394857]%20,%20[~NR~,-0.522778]%20,%20[~NU~,-19.054445]%20,%20[~NZ~,-40.900557]%20,%20[~OM~,21.512583]%20,%20[~PA~,8.537981]%20,%20[~PE~,-9.189967]%20,%20[~PF~,-17.679742]%20,%20[~PG~,-6.314993]%20,%20[~PH~,12.879721]%20,%20[~PK~,30.375321]%20,%20[~PL~,51.919438]%20,%20[~PM~,46.941936]%20,%20[~PN~,-24.703615]%20,%20[~PR~,18.220833]%20,%20[~PS~,31.952162]%20,%20[~PT~,39.399872]%20,%20[~PW~,7.51498]%20,%20[~PY~,-23.442503]%20,%20[~QA~,25.354826]%20,%20[~RE~,-21.115141]%20,%20[~RO~,45.943161]%20,%20[~RS~,44.016521]%20,%20[~RU~,61.52401]%20,%20[~RW~,-1.940278]%20,%20[~SA~,23.885942]%20,%20[~SB~,-9.64571]%20,%20[~SC~,-4.679574]%20,%20[~SD~,12.862807]%20,%20[~SE~,60.128161]%20,%20[~SG~,1.352083]%20,%20[~SH~,-24.143474]%20,%20[~SI~,46.151241]%20,%20[~SJ~,77.553604]%20,%20[~SK~,48.669026]%20,%20[~SL~,8.460555]%20,%20[~SM~,43.94236]%20,%20[~SN~,14.497401]%20,%20[~SO~,5.152149]%20,%20[~SR~,3.919305]%20,%20[~ST~,0.18636]%20,%20[~SV~,13.794185]%20,%20[~SY~,34.802075]%20,%20[~SZ~,-26.522503]%20,%20[~TC~,21.694025]%20,%20[~TD~,15.454166]%20,%20[~TF~,-49.280366]%20,%20[~TG~,8.619543]%20,%20[~TH~,15.870032]%20,%20[~TJ~,38.861034]%20,%20[~TK~,-8.967363]%20,%20[~TL~,-8.874217]%20,%20[~TM~,38.969719]%20,%20[~TN~,33.886917]%20,%20[~TO~,-21.178986]%20,%20[~TR~,38.963745]%20,%20[~TT~,10.691803]%20,%20[~TV~,-7.109535]%20,%20[~TW~,23.69781]%20,%20[~TZ~,-6.369028]%20,%20[~UA~,48.379433]%20,%20[~UG~,1.373333]%20,%20[~UM~,0]%20,%20[~US~,37.09024]%20,%20[~UY~,-32.522779]%20,%20[~UZ~,41.377491]%20,%20[~VA~,41.902916]%20,%20[~VC~,12.984305]%20,%20[~VE~,6.42375]%20,%20[~VG~,18.420695]%20,%20[~VI~,18.335765]%20,%20[~VN~,14.058324]%20,%20[~VU~,-15.376706]%20,%20[~WF~,-13.768752]%20,%20[~WS~,-13.759029]%20,%20[~XK~,42.602636]%20,%20[~YE~,15.552727]%20,%20[~YT~,-12.8275]%20,%20[~ZA~,-30.559482]%20,%20[~ZM~,-13.133897]%20,%20[~ZW~,-19.015438]%20
// https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=World%20Map&width=834&height=520&country=Country&popularity=Popularity&data=%20#[~AD~,42.546245]%20,%20[~AE~,23.424076]%20,%20[~AF~,33.93911]%20,%20[~AG~,17.060816]%20,%20[~AI~,18.220554]%20,%20[~AL~,41.153332]%20,%20[~AM~,40.069099]%20,%20[~AN~,12.226079]%20,%20[~AO~,-11.202692]%20,%20[~AQ~,-75.250973]%20,%20[~AR~,-38.416097]%20,%20[~AS~,-14.270972]%20,%20[~AT~,47.516231]%20,%20[~AU~,-25.274398]%20,%20[~AW~,12.52111]%20,%20[~AZ~,40.143105]%20,%20[~BA~,43.915886]%20,%20[~BB~,13.193887]%20,%20[~BD~,23.684994]%20,%20[~BE~,50.503887]%20,%20[~BF~,12.238333]%20,%20[~BG~,42.733883]%20,%20[~BH~,25.930414]%20,%20[~BI~,-3.373056]%20,%20[~BJ~,9.30769]%20,%20[~BM~,32.321384]%20,%20[~BN~,4.535277]%20,%20[~BO~,-16.290154]%20,%20[~BR~,-14.235004]%20,%20[~BS~,25.03428]%20,%20[~BT~,27.514162]%20,%20[~BV~,-54.423199]%20,%20[~BW~,-22.328474]%20,%20[~BY~,53.709807]%20,%20[~BZ~,17.189877]%20,%20[~CA~,56.130366]%20,%20[~CC~,-12.164165]%20,%20[~CD~,-4.038333]%20,%20[~CF~,6.611111]%20,%20[~CG~,-0.228021]%20,%20[~CH~,46.818188]%20,%20[~CI~,7.539989]%20,%20[~CK~,-21.236736]%20,%20[~CL~,-35.675147]%20,%20[~CM~,7.369722]%20,%20[~CN~,35.86166]%20,%20[~CO~,4.570868]%20,%20[~CR~,9.748917]%20,%20[~CU~,21.521757]%20,%20[~CV~,16.002082]%20,%20[~CX~,-10.447525]%20,%20[~CY~,35.126413]%20,%20[~CZ~,49.817492]%20,%20[~DE~,51.165691]%20,%20[~DJ~,11.825138]%20,%20[~DK~,56.26392]%20,%20[~DM~,15.414999]%20,%20[~DO~,18.735693]%20,%20[~DZ~,28.033886]%20,%20[~EC~,-1.831239]%20,%20[~EE~,58.595272]%20,%20[~EG~,26.820553]%20,%20[~EH~,24.215527]%20,%20[~ER~,15.179384]%20,%20[~ES~,40.463667]%20,%20[~ET~,9.145]%20,%20[~FI~,61.92411]%20,%20[~FJ~,-16.578193]%20,%20[~FK~,-51.796253]%20,%20[~FM~,7.425554]%20,%20[~FO~,61.892635]%20,%20[~FR~,46.227638]%20,%20[~GA~,-0.803689]%20,%20[~GB~,55.378051]%20,%20[~GD~,12.262776]%20,%20[~GE~,42.315407]%20,%20[~GF~,3.933889]%20,%20[~GG~,49.465691]%20,%20[~GH~,7.946527]%20,%20[~GI~,36.137741]%20,%20[~GL~,71.706936]%20,%20[~GM~,13.443182]%20,%20[~GN~,9.945587]%20,%20[~GP~,16.995971]%20,%20[~GQ~,1.650801]%20,%20[~GR~,39.074208]%20,%20[~GS~,-54.429579]%20,%20[~GT~,15.783471]%20,%20[~GU~,13.444304]%20,%20[~GW~,11.803749]%20,%20[~GY~,4.860416]%20,%20[~GZ~,31.354676]%20,%20[~HK~,22.396428]%20,%20[~HM~,-53.08181]%20,%20[~HN~,15.199999]%20,%20[~HR~,45.1]%20,%20[~HT~,18.971187]%20,%20[~HU~,47.162494]%20,%20[~ID~,-0.789275]%20,%20[~IE~,53.41291]%20,%20[~IL~,31.046051]%20,%20[~IM~,54.236107]%20,%20[~IN~,20.593684]%20,%20[~IO~,-6.343194]%20,%20[~IQ~,33.223191]%20,%20[~IR~,32.427908]%20,%20[~IS~,64.963051]%20,%20[~IT~,41.87194]%20,%20[~JE~,49.214439]%20,%20[~JM~,18.109581]%20,%20[~JO~,30.585164]%20,%20[~JP~,36.204824]%20,%20[~KE~,-0.023559]%20,%20[~KG~,41.20438]%20,%20[~KH~,12.565679]%20,%20[~KI~,-3.370417]%20,%20[~KM~,-11.875001]%20,%20[~KN~,17.357822]%20,%20[~KP~,40.339852]%20,%20[~KR~,35.907757]%20,%20[~KW~,29.31166]%20,%20[~KY~,19.513469]%20,%20[~KZ~,48.019573]%20,%20[~LA~,19.85627]%20,%20[~LB~,33.854721]%20,%20[~LC~,13.909444]%20,%20[~LI~,47.166]%20,%20[~LK~,7.873054]%20,%20[~LR~,6.428055]%20,%20[~LS~,-29.609988]%20,%20[~LT~,55.169438]%20,%20[~LU~,49.815273]%20,%20[~LV~,56.879635]%20,%20[~LY~,26.3351]%20,%20[~MA~,31.791702]%20,%20[~MC~,43.750298]%20,%20[~MD~,47.411631]%20,%20[~ME~,42.708678]%20,%20[~MG~,-18.766947]%20,%20[~MH~,7.131474]%20,%20[~MK~,41.608635]%20,%20[~ML~,17.570692]%20,%20[~MM~,21.913965]%20,%20[~MN~,46.862496]%20,%20[~MO~,22.198745]%20,%20[~MP~,17.33083]%20,%20[~MQ~,14.641528]%20,%20[~MR~,21.00789]%20,%20[~MS~,16.742498]%20,%20[~MT~,35.937496]%20,%20[~MU~,-20.348404]%20,%20[~MV~,3.202778]%20,%20[~MW~,-13.254308]%20,%20[~MX~,23.634501]%20,%20[~MY~,4.210484]%20,%20[~MZ~,-18.665695]%20,%20[~NA~,-22.95764]%20,%20[~NC~,-20.904305]%20,%20[~NE~,17.607789]%20,%20[~NF~,-29.040835]%20,%20[~NG~,9.081999]%20,%20[~NI~,12.865416]%20,%20[~NL~,52.132633]%20,%20[~NO~,60.472024]%20,%20[~NP~,28.394857]%20,%20[~NR~,-0.522778]%20,%20[~NU~,-19.054445]%20,%20[~NZ~,-40.900557]%20,%20[~OM~,21.512583]%20,%20[~PA~,8.537981]%20,%20[~PE~,-9.189967]%20,%20[~PF~,-17.679742]%20,%20[~PG~,-6.314993]%20,%20[~PH~,12.879721]%20,%20[~PK~,30.375321]%20,%20[~PL~,51.919438]%20,%20[~PM~,46.941936]%20,%20[~PN~,-24.703615]%20,%20[~PR~,18.220833]%20,%20[~PS~,31.952162]%20,%20[~PT~,39.399872]%20,%20[~PW~,7.51498]%20,%20[~PY~,-23.442503]%20,%20[~QA~,25.354826]%20,%20[~RE~,-21.115141]%20,%20[~RO~,45.943161]%20,%20[~RS~,44.016521]%20,%20[~RU~,61.52401]%20,%20[~RW~,-1.940278]%20,%20[~SA~,23.885942]%20,%20[~SB~,-9.64571]%20,%20[~SC~,-4.679574]%20,%20[~SD~,12.862807]%20,%20[~SE~,60.128161]%20,%20[~SG~,1.352083]%20,%20[~SH~,-24.143474]%20,%20[~SI~,46.151241]%20,%20[~SJ~,77.553604]%20,%20[~SK~,48.669026]%20,%20[~SL~,8.460555]%20,%20[~SM~,43.94236]%20,%20[~SN~,14.497401]%20,%20[~SO~,5.152149]%20,%20[~SR~,3.919305]%20,%20[~ST~,0.18636]%20,%20[~SV~,13.794185]%20,%20[~SY~,34.802075]%20,%20[~SZ~,-26.522503]%20,%20[~TC~,21.694025]%20,%20[~TD~,15.454166]%20,%20[~TF~,-49.280366]%20,%20[~TG~,8.619543]%20,%20[~TH~,15.870032]%20,%20[~TJ~,38.861034]%20,%20[~TK~,-8.967363]%20,%20[~TL~,-8.874217]%20,%20[~TM~,38.969719]%20,%20[~TN~,33.886917]%20,%20[~TO~,-21.178986]%20,%20[~TR~,38.963745]%20,%20[~TT~,10.691803]%20,%20[~TV~,-7.109535]%20,%20[~TW~,23.69781]%20,%20[~TZ~,-6.369028]%20,%20[~UA~,48.379433]%20,%20[~UG~,1.373333]%20,%20[~UM~,0]%20,%20[~US~,37.09024]%20,%20[~UY~,-32.522779]%20,%20[~UZ~,41.377491]%20,%20[~VA~,41.902916]%20,%20[~VC~,12.984305]%20,%20[~VE~,6.42375]%20,%20[~VG~,18.420695]%20,%20[~VI~,18.335765]%20,%20[~VN~,14.058324]%20,%20[~VU~,-15.376706]%20,%20[~WF~,-13.768752]%20,%20[~WS~,-13.759029]%20,%20[~XK~,42.602636]%20,%20[~YE~,15.552727]%20,%20[~YT~,-12.8275]%20,%20[~ZA~,-30.559482]%20,%20[~ZM~,-13.133897]%20,%20[~ZW~,-19.015438]%20
// https://www.rjmprogramming.com.au/PHP/GeoChart/index.php?title=World%20Map&width=834&height=520&country=Country&popularity=Popularity&data=%20#[~AD~,42.546245]%20,%20[~AE~,23.424076]%20,%20[~AF~,33.93911]%20,%20[~AG~,17.060816]%20,%20[~AI~,18.220554]%20,%20[~AL~,41.153332]%20,%20[~AM~,40.069099]%20,%20[~AN~,12.226079]%20,%20[~AO~,-11.202692]%20,%20[~AQ~,-75.250973]%20,%20[~AR~,-38.416097]%20,%20[~AS~,-14.270972]%20,%20[~AT~,47.516231]%20,%20[~AU~,-25.274398]%20,%20[~AW~,12.52111]%20,%20[~AZ~,40.143105]%20,%20[~BA~,43.915886]%20,%20[~BB~,13.193887]%20,%20[~BD~,23.684994]%20,%20[~BE~,50.503887]%20,%20[~BF~,12.238333]%20,%20[~BG~,42.733883]%20,%20[~BH~,25.930414]%20,%20[~BI~,-3.373056]%20,%20[~BJ~,9.30769]%20,%20[~BM~,32.321384]%20,%20[~BN~,4.535277]%20,%20[~BO~,-16.290154]%20,%20[~BR~,-14.235004]%20,%20[~BS~,25.03428]%20,%20[~BT~,27.514162]%20,%20[~BV~,-54.423199]%20,%20[~BW~,-22.328474]%20,%20[~BY~,53.709807]%20,%20[~BZ~,17.189877]%20,%20[~CA~,56.130366]%20,%20[~CC~,-12.164165]%20,%20[~CD~,-4.038333]%20,%20[~CF~,6.611111]%20,%20[~CG~,-0.228021]%20,%20[~CH~,46.818188]%20,%20[~CI~,7.539989]%20,%20[~CK~,-21.236736]%20,%20[~CL~,-35.675147]%20,%20[~CM~,7.369722]%20,%20[~CN~,35.86166]%20,%20[~CO~,4.570868]%20,%20[~CR~,9.748917]%20,%20[~CU~,21.521757]%20,%20[~CV~,16.002082]%20,%20[~CX~,-10.447525]%20,%20[~CY~,35.126413]%20,%20[~CZ~,49.817492]%20,%20[~DE~,51.165691]%20,%20[~DJ~,11.825138]%20,%20[~DK~,56.26392]%20,%20[~DM~,15.414999]%20,%20[~DO~,18.735693]%20,%20[~DZ~,28.033886]%20,%20[~EC~,-1.831239]%20,%20[~EE~,58.595272]%20,%20[~EG~,26.820553]%20,%20[~EH~,24.215527]%20,%20[~ER~,15.179384]%20,%20[~ES~,40.463667]%20,%20[~ET~,9.145]%20,%20[~FI~,61.92411]%20,%20[~FJ~,-16.578193]%20,%20[~FK~,-51.796253]%20,%20[~FM~,7.425554]%20,%20[~FO~,61.892635]%20,%20[~FR~,46.227638]%20,%20[~GA~,-0.803689]%20,%20[~GB~,55.378051]%20,%20[~GD~,12.262776]%20,%20[~GE~,42.315407]%20,%20[~GF~,3.933889]%20,%20[~GG~,49.465691]%20,%20[~GH~,7.946527]%20,%20[~GI~,36.137741]%20,%20[~GL~,71.706936]%20,%20[~GM~,13.443182]%20,%20[~GN~,9.945587]%20,%20[~GP~,16.995971]%20,%20[~GQ~,1.650801]%20,%20[~GR~,39.074208]%20,%20[~GS~,-54.429579]%20,%20[~GT~,15.783471]%20,%20[~GU~,13.444304]%20,%20[~GW~,11.803749]%20,%20[~GY~,4.860416]%20,%20[~GZ~,31.354676]%20,%20[~HK~,22.396428]%20,%20[~HM~,-53.08181]%20,%20[~HN~,15.199999]%20,%20[~HR~,45.1]%20,%20[~HT~,18.971187]%20,%20[~HU~,47.162494]%20,%20[~ID~,-0.789275]%20,%20[~IE~,53.41291]%20,%20[~IL~,31.046051]%20,%20[~IM~,54.236107]%20,%20[~IN~,20.593684]%20,%20[~IO~,-6.343194]%20,%20[~IQ~,33.223191]%20,%20[~IR~,32.427908]%20,%20[~IS~,64.963051]%20,%20[~IT~,41.87194]%20,%20[~JE~,49.214439]%20,%20[~JM~,18.109581]%20,%20[~JO~,30.585164]%20,%20[~JP~,36.204824]%20,%20[~KE~,-0.023559]%20,%20[~KG~,41.20438]%20,%20[~KH~,12.565679]%20,%20[~KI~,-3.370417]%20,%20[~KM~,-11.875001]%20,%20[~KN~,17.357822]%20,%20[~KP~,40.339852]%20,%20[~KR~,35.907757]%20,%20[~KW~,29.31166]%20,%20[~KY~,19.513469]%20,%20[~KZ~,48.019573]%20,%20[~LA~,19.85627]%20,%20[~LB~,33.854721]%20,%20[~LC~,13.909444]%20,%20[~LI~,47.166]%20,%20[~LK~,7.873054]%20,%20[~LR~,6.428055]%20,%20[~LS~,-29.609988]%20,%20[~LT~,55.169438]%20,%20[~LU~,49.815273]%20,%20[~LV~,56.879635]%20,%20[~LY~,26.3351]%20,%20[~MA~,31.791702]%20,%20[~MC~,43.750298]%20,%20[~MD~,47.411631]%20,%20[~ME~,42.708678]%20,%20[~MG~,-18.766947]%20,%20[~MH~,7.131474]%20,%20[~MK~,41.608635]%20,%20[~ML~,17.570692]%20,%20[~MM~,21.913965]%20,%20[~MN~,46.862496]%20,%20[~MO~,22.198745]%20,%20[~MP~,17.33083]%20,%20[~MQ~,14.641528]%20,%20[~MR~,21.00789]%20,%20[~MS~,16.742498]%20,%20[~MT~,35.937496]%20,%20[~MU~,-20.348404]%20,%20[~MV~,3.202778]%20,%20[~MW~,-13.254308]%20,%20[~MX~,23.634501]%20,%20[~MY~,4.210484]%20,%20[~MZ~,-18.665695]%20,%20[~NA~,-22.95764]%20,%20[~NC~,-20.904305]%20,%20[~NE~,17.607789]%20,%20[~NF~,-29.040835]%20,%20[~NG~,9.081999]%20,%20[~NI~,12.865416]%20,%20[~NL~,52.132633]%20,%20[~NO~,60.472024]%20,%20[~NP~,28.394857]%20,%20[~NR~,-0.522778]%20,%20[~NU~,-19.054445]%20,%20[~NZ~,-40.900557]%20,%20[~OM~,21.512583]%20,%20[~PA~,8.537981]%20,%20[~PE~,-9.189967]%20,%20[~PF~,-17.679742]%20,%20[~PG~,-6.314993]%20,%20[~PH~,12.879721]%20,%20[~PK~,30.375321]%20,%20[~PL~,51.919438]%20,%20[~PM~,46.941936]%20,%20[~PN~,-24.703615]%20,%20[~PR~,18.220833]%20,%20[~PS~,31.952162]%20,%20[~PT~,39.399872]%20,%20[~PW~,7.51498]%20,%20[~PY~,-23.442503]%20,%20[~QA~,25.354826]%20,%20[~RE~,-21.115141]%20,%20[~RO~,45.943161]%20,%20[~RS~,44.016521]%20,%20[~RU~,61.52401]%20,%20[~RW~,-1.940278]%20,%20[~SA~,23.885942]%20,%20[~SB~,-9.64571]%20,%20[~SC~,-4.679574]%20,%20[~SD~,12.862807]%20,%20[~SE~,60.128161]%20,%20[~SG~,1.352083]%20,%20[~SH~,-24.143474]%20,%20[~SI~,46.151241]%20,%20[~SJ~,77.553604]%20,%20[~SK~,48.669026]%20,%20[~SL~,8.460555]%20,%20[~SM~,43.94236]%20,%20[~SN~,14.497401]%20,%20[~SO~,5.152149]%20,%20[~SR~,3.919305]%20,%20[~ST~,0.18636]%20,%20[~SV~,13.794185]%20,%20[~SY~,34.802075]%20,%20[~SZ~,-26.522503]%20,%20[~TC~,21.694025]%20,%20[~TD~,15.454166]%20,%20[~TF~,-49.280366]%20,%20[~TG~,8.619543]%20,%20[~TH~,15.870032]%20,%20[~TJ~,38.861034]%20,%20[~TK~,-8.967363]%20,%20[~TL~,-8.874217]%20,%20[~TM~,38.969719]%20,%20[~TN~,33.886917]%20,%20[~TO~,-21.178986]%20,%20[~TR~,38.963745]%20,%20[~TT~,10.691803]%20,%20[~TV~,-7.109535]%20,%20[~TW~,23.69781]%20,%20[~TZ~,-6.369028]%20,%20[~UA~,48.379433]%20,%20[~UG~,1.373333]%20,%20[~UM~,0]%20,%20[~US~,37.09024]%20,%20[~UY~,-32.522779]%20,%20[~UZ~,41.377491]%20,%20[~VA~,41.902916]%20,%20[~VC~,12.984305]%20,%20[~VE~,6.42375]%20,%20[~VG~,18.420695]%20,%20[~VI~,18.335765]%20,%20[~VN~,14.058324]%20,%20[~VU~,-15.376706]%20,%20[~WF~,-13.768752]%20,%20[~WS~,-13.759029]%20,%20[~XK~,42.602636]%20,%20[~YE~,15.552727]%20,%20[~YT~,-12.8275]%20,%20[~ZA~,-30.559482]%20,%20[~ZM~,-13.133897]%20,%20[~ZW~,-19.015438]%20

</script>
</head>
<body onload='beadjustable();'>
<h1 id='myh1' title='Can browse for incoming CSV style input data (of your inventory) with Choose File button' style=height:80px;overflow-y:hidden;>Arrays and Maps <iframe title='Can browse for incoming CSV style input data (of your inventory) here' class="spag" scrolling="no" data-onload="iifopen(this);" id="cbi" frameborder="0" style="width:173px;height:218px;margin-top:-204px;" src="/HTMLCSS/client_browsing.htm?totype=csv&d=1989786754"></iframe> <select style=display:inline-block; id=gcopts onchange=selit(this);><option id=defopt value=''>Google Chart display of ...</option><option value='//www.rjmprogramming.com.au/PHP/PieChart/pie_chart.php?title=Title&onclick=y&task=Country&desc=Populations&data='>Pie Chart</option><option value='//www.rjmprogramming.com.au/PHP/HistogramChart/histogram_chart.php?title=Title&onclick=y&task=Number&desc=Count&data='>Histogram Chart</option><option id=geoopt style=display:none; value='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Title&width=834&height=520&country=Country&popularity=Popularity&data='>Geo Chart</option></select>                            <span style='font-size:12px;display:inline-block;' ondrop="drop(event);" ondragover="allowDrop(event);" title='You can drag CSV inventory data to here as required to Email or SMS report' id=droppable><span onclick=doemail('demo');>📧 </span><span onclick=dosms('demo');> 📟</span></span></h1>
<h3>RJM Programming - August, 2024 ... thanks to https://www.w3schools.com/js/tryit.asp?filename=tryjs_map_groupby and https://medium.com/@sotoer/your-foreach-example-has-the-wrong-order-of-params-which-you-are-also-demonstrating-in-your-sample-42f5491b604e</h3>
<br>
<table id=mytable border=20 style="width:80%;" cellpadding=10 cellspacing=10>
<thead id=thd>
<tr><th colspan=4><span title='Double click to be able to enter CSV data' id=topic contenteditable=true onblur=beadjustable(); ondblclick=askall();>Fruit</span> Report <sup id=mysup style=cursor:pointer; title='Add an editable fruit' onclick=addone();>++</sup></th></tr>
<tr><th id=thname contenteditable=true>Name</th><th id=thquantity contenteditable=true>Quantity</th><th>Tipping Value</th><th id=threport contenteditable=true><span id=spanok>Ok</span> versus <span id=spanlow>Low</span> Report</th></tr>
<tr><td id=tdname contenteditable=false onblur=fix(this);></td><td id=tdquantity contenteditable=true onblur=fix(this);></td><td id=tdtip rowspan=1><input style=width:98%; onblur="tippingpoint=eval('' + this.value); beadjustable();" onchange="tippingpoint=eval('' + this.value); beadjustable();" type=number id=itip step=1 value=200 data-min=0></input></td><td onblur=alteredstate(this); contenteditable=true draggable="true" ondragstart="drag(event);" id=demo rowspan=1></td></tr>
</thead>
<tbody id=tbd>
</tbody>
</table>
<form target=myifis style=display:none; method=POST id=myform action=./map_test.html><input type=hidden name=title id=title value='Title'></input><input type=hidden name=wouldlikeyoutoseekpermission value=y></input><input type=hidden name=nojwin value=Q></input><input type=hidden name=onclick value=y></input><input type=hidden name=desc id=desc value='Populations'></input><input type=hidden name=task id=task value='Country'></input><input type=hidden name=width id=width value='834'></input><input type=hidden name=height id=height value='520'></input><input type=hidden name=popularity id=popularity value='Popularity'></input><input type=hidden name=country id=country value='Country'></input><input type=hidden name=data id=data value=''></input><input id=mysub type=submit style=display:none; value=Display></input></form>
<div id=dif style=display:none;width:100%;></div>
<input type=hidden id=cfrom value=''></input><input type=hidden id=cto value=''></input><input type=hidden id=outputname value=''></input><input type=hidden id=thewords value=''></input><input type=hidden id=saysub value=''></input><input type=hidden id=resultout value=''></input><input type=hidden id=resJUNKult value=''></input><input type=hidden id=audioname value=''></input>
</body>
</html>