<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>
  body {
     background-color: #f9f9f9; 
  }
  table {
     background-color: #f0f0d0; 
  }
  td { 
     vertical-align: top;
     background-color: #ffffff; 
  }
  
  #demo, #droppable {
     background-color: yellow;
  }
  
  input[type=number] {
     background-color: lightgreen;
  }
  
  th:not([colspan=4]) {
     background-color: #d0f0f0; 
  }
  
  select {
     background-color: lightblue;
  }
</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 undone=false;
var wheres=[];
var orderbys=[];
var wheresn=[];
var orderbysn=[];
var ors=[];
var ands=[];
var mappings=[];
eval('mappings.push({ from: "1", to:"' + 'Name' + '"})');
eval('mappings.push({ from: "2", to:"' + 'Quantity' + '"})');
var fromplace='';
var sqlis='';
var lasttr='';
var ify=0;
var compositename='';
var compositequantity='';
var elines=[];
var eelines=[];
var efields=[];
var goselv='';
var outv='';
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='';
var aconto=null;
var rawhtml='';
var zhr=null;
var enterall='';
// 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}
];
var fruity = [
  {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 : eval(('' + quantity).split(',')[0])) > eval('' + tippingpoint) ? okayword : lowword;
}
function asit(inid) {
  var sdfa=inid.split(' as ');
  if (eval('' + sdfa.length) > 1) {
     return sdfa[eval(-1 + sdfa.length)];
  }
  return inid;
}
function alertsql() {
   var ij=0, jk=0;
   console.log(mappings);
   sqlis='SELECT ';
   if (document.getElementById('thname').innerHTML == 'Name' && document.getElementById('thquantity').innerHTML == 'Quantity') {
      sqlis+=document.getElementById('thname').innerHTML;
      sqlis+=',' + document.getElementById('thquantity').innerHTML + ' ';
   } else {
      if (document.getElementById('thquantity').innerHTML.indexOf(',') != -1) {
      sqlis+=document.getElementById('thname').innerHTML;
   console.log(mappings);
      sqlis+=',' + document.getElementById('thquantity').innerHTML;
      } else {
      sqlis+=document.getElementById('thname').innerHTML;
      sqlis+=',(' + document.getElementById('thquantity').innerHTML + ') as field2 ';
      }
   }
   if (fromplace.trim() != '') {
      sqlis+=' FROM ' + fromplace + ' ';
   }
   if (eval('' + wheres.length) > 0) {
      console.log(wheres);
      for (ij=0; ij<wheres.length; ij++) {
         wheresn.push(wheres[ij]);
         for (jk=0; jk<mappings.length; jk++) {
           wheres[ij]=asit(wheres[ij].replace(' ' + mappings[jk].from, ' ' + mappings[jk].to));
         }
      console.log(wheres);
         if (ij == 0) {
           sqlis+=' WHERE ' + wheres[ij].trim().replace(/^\!/g, ' NOT ') + ' ';
         } else {
           sqlis+=' AND ' + wheres[ij].trim().replace(/^\!/g, ' NOT ') + ' ';
         }
      }
   }
   if (eval('' + orderbys.length) > 0) {
      for (ij=0; ij<orderbys.length; ij++) {
         ordersbyn.push(ordersby[ij]);
         for (jk=0; jk<mappings.length; jk++) {
           orderbys[ij]=asit(orderbys[ij].replace(' ' + mappings[jk].from, ' ' + mappings[jk].to));
         }
         if (ij == 0) {
           if (orderbys[ij].indexOf('~') != -1) {
           sqlis+=' ORDER BY ' + orderbys[ij].trim().replace(/\~/g, '').replace(/\`/g, '') + ' ASC ';
           } else {
           sqlis+=' ORDER BY ' + orderbys[ij].trim().replace(/\~/g, '').replace(/\`/g, '') + ' DESC ';
           }
         } else {
           if (orderbys[ij].indexOf('~') != -1) {
           sqlis+=' AND ' + orderbys[ij].trim().replace(/\~/g, '').replace(/\`/g, '') + ' ASC ';
           } else {
           sqlis+=' AND ' + orderbys[ij].trim().replace(/\~/g, '').replace(/\`/g, '') + ' DESC ';
           }
         }
      }
   }
   //document.title=sqlis;
   //var xsew=prompt(sqlis, '');
   document.body.title=sqlis;
}
function mappingsget(what) {
   var ij;
   //alert('mappings.length=' + mappings.length);
   for (ij=0; ij<mappings.length; ij++) {
      if (('' + mappings[ij].from) == ('' + what)) {
        return true;
      }
   }
   return false;
}
function doalias(twocomp) {
   if (!mappingsget("2") || undone) {
   //alert('(' + twocomp + ') as field2');
      eval('mappings.unshift({ from: "2", to:"' + '(' + twocomp + ') as field2' + '"})');
      undone=false;
   } else if (1 == 6 && eval('' + mappings.length) == 0) {
   //alert(1);
      eval('mappings.push({ from: "1", to:"' + 'Name' + '"})');
   //alert(11);
      eval('mappings.push({ from: "2", to:"' + '(' + twocomp + ') as field2' + '"})');
   } else if (1 == 6 && eval('' + mappings.length) == 1) {
   //alert(2);
      eval('mappings.push({ from: "2", to:"' + '(' + twocomp + ') as field2' + '"})');
   } else if (1 == 6) {
   //alert(3);
      eval('mappings.unshift({ from: "2", to:"' + '(' + twocomp + ') as field2' + '"})');
   }
}
function mysimpleCallback(qty) {
  //alert(qty);
  return (('' + qty).trim() == '' ? 0 : eval(('' + qty).split(',')[0])) > eval('' + tippingpoint) ? okayword : lowword;
}
function maybenotdefn(inidea) {
  var startcn=compositename, outidea=inidea, fieldnum='', ii;
  if (eval('' + efields.length) > 0) {
  efields[eval(-1 + efields.length)]=efields[eval(-1 + efields.length)].split(' //')[0].split('// ')[0];
  }
  if (compositename != '') {
    outidea='';
    while (startcn != '') {
    fieldnum='' + startcn.split('&')[0].split('+')[0].split('/')[0].split('*')[0].split('-')[0].split('%')[0].split('^')[0];
    if (!mappingsget(fieldnum)) {
       for (ii=fieldnum; ii>=1; ii--) {
          if (!mappingsget(ii)) {
            //if (ii == 1) { alert('Oops'); }
            eval('mappings.push({ from: "' + fieldnum + '", to: "field' + ii + '" })');
          }
       }
    }
    startcn=startcn.replace(fieldnum,'');
    outidea+=('' + efields[eval(-1 + eval('' + fieldnum))]).replace(/\,/g,' ').substring(0,1).toUpperCase() + ('' + efields[eval(-1 + eval('' + fieldnum))] + ' ').replace(/\,/g,' ').substring(1).replace(/\ $/g,'').toLowerCase();
    if (startcn != '') {
      if (startcn.substring(1) != '') {
        outidea+=',';
        startcn=startcn.substring(1);
      } else {
        startcn='';
      }
    }
    }
    return outidea;
  }
  return inidea;
}
function maybenotdefq(inidea) {
  var startcn=compositequantity, outidea=inidea, fieldnum='';
  if (eval('' + efields.length) > 0) {
  efields[eval(-1 + efields.length)]=efields[eval(-1 + efields.length)].split(' //')[0].split('// ')[0];
  }
  if (compositequantity != '') {
    outidea='';
    while (startcn != '') {
    fieldnum='' + startcn.split('&')[0].split('+')[0].split('/')[0].split('*')[0].split('-')[0].split('%')[0].split('^')[0];
    if (!mappingsget(fieldnum)) {
       for (ii=fieldnum; ii>=1; ii--) {
          if (!mappingsget(ii)) {
             //if (ii == 1) { alert('OOps'); }
           eval('mappings.push({ from: "' + fieldnum + '", to: "field' + ii + '" })');
          }
       }
    }
    startcn=startcn.replace(fieldnum,'');
    outidea+=('' + efields[eval(-1 + eval('' + fieldnum))]).replace(/\,/g,' ').substring(0,1).toUpperCase() + ('' + efields[eval(-1 + eval('' + fieldnum))] + ' ').replace(/\,/g,' ').substring(1).replace(/\ $/g,'').toLowerCase();
    if (startcn != '') {
      if (startcn.substring(1) != '') {
        outidea+=',';
        startcn=startcn.substring(1);
      } else {
        startcn='';
      }
    }
    }
    return outidea;
  }
  return inidea;
}
function maybenotvaln(inidea) {
  var startcn=compositename, outidea=inidea, fieldnum='';
  if (eval('' + efields.length) > 0) {
  efields[eval(-1 + efields.length)]=efields[eval(-1 + efields.length)].split(' //')[0].split('// ')[0];
  }
  if (compositename != '') {
    //console.log('fruity.length=' + fruity.length);
    if (eval('' + fruity.length) > 0) {
      for (var ijk=0; ijk<fruity.length; ijk++) {
        if (('' + inidea).split(',')[0] == ('' + fruity[ijk].name).split(',')[0]) {
           return ('' + fruity[ijk].name);
        }
      }
    }
    outidea='';
    while (startcn != '') {
    fieldnum='' + startcn.split('&')[0].split('+')[0].split('/')[0].split('*')[0].split('-')[0].split('%')[0].split('^')[0];
    if (!mappingsget(fieldnum)) {
       for (ii=fieldnum; ii>=1; ii--) {
          if (!mappingsget(ii)) {
            //if (ii == 1) { alert('OoPs'); }
            eval('mappings.push({ from: "' + fieldnum + '", to: "field' + ii + '" })');
          }
       }
    }
    startcn=startcn.replace(fieldnum,'');
    outidea+=('' + efields[eval(-1 + eval('' + fieldnum))]).replace(/\,/g,' ');
    if (startcn != '') {
      if (startcn.substring(1) != '') {
        outidea+=',';
        startcn=startcn.substring(1);
      } else {
        startcn='';
      }
    }
    }
    return outidea;
  }
  return inidea;
}
function maybenotvalq(injdea, injdean) {
  var startcn=compositequantity, outjdea=injdea, fieldnum='', isnotanumber=true, isthenumber=0, lastop=' ', istwonumber=0;
  if (eval('' + efields.length) > 0) {
  efields[eval(-1 + efields.length)]=efields[eval(-1 + efields.length)].split(' //')[0].split('// ')[0];
  }
  if (compositequantity != '') {
    //console.log('fruity.length=' + fruity.length);
    if (eval('' + fruity.length) > 0 && 7 == 7) {
      for (var ijk=0; ijk<fruity.length; ijk++) {
        if (('' + injdean).split(',')[0] == ('' + fruity[ijk].name).split(',')[0]) {
        //alert(injdea + ' and ' + ('' + fruity[ijk].quantity));
           if (('' + fruity[ijk].quantity).indexOf(',') != -1 && thqit(compositequantity) != '') {  return ('' + fruity[ijk].quantity); }
           if (('' + fruity[ijk].quantity).indexOf(',') == -1 && ('' + injdea) != ('' + fruity[ijk].quantity) && thqit(compositequantity) == '') {  return ('' + fruity[ijk].quantity); }
        }
      }
    }
    outjdea='';
    while (startcn != '') {
    fieldnum='' + startcn.split('&')[0].split('+')[0].split('/')[0].split('*')[0].split('-')[0].split('%')[0].split('^')[0];
    if (!mappingsget(fieldnum)) {
       for (ii=fieldnum; ii>=1; ii--) {
          if (!mappingsget(ii)) {
            //if (ii == 1) { alert('OopS'); }
            eval('mappings.push({ from: "' + fieldnum + '", to: "field' + ii + '" })');
          }
       }
    }
    if (1 == 1) {
    if (fieldnum.trim() == '') { isnotanumber=true;   } else if (!isnotanumber || lastop.trim() == '') { isnotanumber=isNaN('' + fieldnum); }
    if (!isnotanumber && lastop.trim() == '') {    
      isthenumber=efields[-1 + eval('' + fieldnum)]; 
      isnotanumber=isNaN('' + isthenumber);
      if (!isnotanumber) { isthenumber=eval('' + isthenumber); }
    } else if (!isnotanumber && (lastop == '+' || lastop == '-' || lastop == '*' || lastop == '/' || lastop == '%')) {
      istwonumber=efields[-1 + eval('' + fieldnum)]; 
      isnotanumber=isNaN('' + istwonumber);
      if (!isnotanumber) { istwonumber=eval('' + istwonumber); }
      if (!isnotanumber) {
      if (lastop == '+') {
       isthenumber+=eval('' + istwonumber);
      } else if (lastop == '-') {
       isthenumber-=eval('' + istwonumber);
      } else if (lastop == '*') {
       isthenumber*=eval('' + istwonumber);
      } else if (lastop == '/') {
       isthenumber/=eval('' + istwonumber);
      } else if (lastop == '%') {
       isthenumber%=eval('' + istwonumber);
      } else if (lastop == '^') {
       isthenumber^=eval('' + istwonumber);
      } else {
       isnotanumber=true;
       lastop=',';
      } 
      }
    }
    }
    startcn=startcn.replace('' + fieldnum,'');
    if (eval('' + efields.length) > eval(-1 + eval('' + fieldnum))) {
    outjdea+=('' + efields[eval(-1 + eval('' + fieldnum))]).replace(/\,/g,' ');
    }
    if (startcn != '') {
      if (startcn.substring(1) != '') {
        outjdea+=',';
        lastop=startcn.substring(0,1).replace('&',',');
        startcn=startcn.substring(1);
      } else {
        startcn='';
      }
    }
    }
    if (!isnotanumber && lastop.replace(' ','&').replace(',','&') != '&') {  document.getElementById('thquantity').innerHTML=document.getElementById('thquantity').innerHTML.replace(/\,/g,lastop);  doalias(document.getElementById('thquantity').innerHTML);  return '' + isthenumber + ','; }
    //alert('outjdea=' + outjdea + ' and efields.length=' + efields.length + ' and injdea=' + injdea + ' and compositequantity=' + compositequantity);
    return outjdea;
  }
  return injdea;
}
function process(what) {
   document.getElementById('demo').innerHTML=thiscont;
   fruits=[];
   fruity=[];
   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) {
      //alert('Ok oOps=' + theses.length + ' and fruits.length=' + fruits.length);
     if (theses[1].indexOf(':') != -1 && theses[2].indexOf(':') != -1) {
      //alert('Okay oOps=' + theses.length);
        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() + ' and fruits.length=' + fruits.length);
               if (reprecs[ireprecs].indexOf(',') != -1) { efields=reprecs[ireprecs].split(','); }
               //alert('reprecs[ireprecs]=' + reprecs[ireprecs]);
               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() + ' and fruits.length=' + fruits.length);
               if (reprecs[ireprecs].indexOf(',') != -1) { efields=reprecs[ireprecs].split(','); }
               //alert('reprecs[ireprecs] =' + reprecs[ireprecs]);
               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;
  var kval='';
  var qval='';
  //alert(knownname);
  //alert(knownquantity);
  if (('' + knownname) != 'undefined' && ('' + knownquantity) != 'undefined') {
  if (('' + knownquantity).indexOf(',') != -1 || ('' + knownname).indexOf(',') != -1) {
  fruits.push({name:knownname, quantity:eval(('' + knownquantity).split(',')[0])});
  qval=maybenotvalq(('' + knownquantity), knownname);
  fruity.push({name:maybenotvaln(knownname), quantity:qval});
  m.set(maybenotvaln(knownname), qval);
  } else {
  fruits.push({name:knownname, quantity:knownquantity});
  qval=maybenotvalq(('' + knownquantity), knownname);
  fruity.push({name:maybenotvaln(knownname), quantity:qval});
  m.set(maybenotvaln(knownname), qval);
  }
  } else if (('' + knownname) != 'undefined') {
  fruits.push({name:knownname, quantity:0});
  fruity.push({name:knownname, quantity:"0"});
  m.set(maybenotvaln(knownname), maybenotvalq("0",knownname));
  } else {
  fruits.push({name:"", quantity:0});
  qval=0; //maybenotvalq("0","");
  fruity.push({name:"", quantity:qval});
  m.set('', qval);
  setTimeout(function(){ if (document.getElementById('tdquantity' + fruity.length)) { document.getElementById('tdquantity' + fruity.length).innerHTML='0'; } if (document.getElementById('tdname' + fruity.length)) { document.getElementById('tdname' + fruity.length).scrollIntoView(); }  }, 3000);
  }
  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)); idx--;  }
    while (!fruits[idx]) { fruits.push({name:'',quantity:0});  fruity.push({name:'',quantity:0});   }
    fruits[idx].name=('' + tdo.innerHTML).split(',')[0];
    fruity[idx].name=('' + tdo.innerHTML);
    if (m.has("")) {
      m.delete("");
      m.set(fruity[idx].name, fruity[idx].quantity);
      tdo.setAttribute('contenteditable', false);
    }
    if (needto) { beadjustable(); }
  } else {
    if (tdo.id != 'tdquantity') { idx=eval(('' + tdo.id).substring(10)); idx--;  }
    //alert(tdo.outerHTML);
    //alert('idx=' + idx + ' and ' + ('' + (tdo.innerText | tdo.contentWindow | tdo.contentDocument)) + ' and fruits[idx].name=' + fruits[idx].name);
    if (m.has(fruity[idx].name)) {
      if (('' + fruity[idx].quantity) == ('' + (tdo.innerText | tdo.contentWindow | tdo.contentDocument))) { needto=false; }
    }
    if (needto) {
    while (!fruits[idx]) { fruits.push({name:'',quantity:0});  fruity.push({name:'',quantity:0});   }
    fruits[idx].quantity=('' + (tdo.innerText | tdo.contentWindow | tdo.contentDocument)).split(',')[0];
    fruity[idx].quantity=('' + (tdo.innerText | tdo.contentWindow | tdo.contentDocument));
    if (m.has(fruits[idx].name)) {
      m.set(fruity[idx].name, fruity[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(fruity, myCallback);
// Display Results
try {
for (let x of result.get(okayword)) {
  if (x.name != '' || x.quantity != 0) {
  text += "" + x.name.split(',')[0] + " " + x.quantity.split(',')[0] + "<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.split(',')[0] + " " + x.quantity.split(',')[0] + "<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<fruity.length; kk++) {
    if (('' + fruity[kk].quantity).replace('-','').substring(0,1) >= '0' && ('' + fruity[kk].quantity).replace('-','').substring(0,1) <= '9') {
    //alert('fruity[kk].quantity=' + fruity[kk].quantity);
    if (mysimpleCallback(fruity[kk].quantity) == 'ok') {
    //alert(fruity[kk].name);
  text += "" + fruity[kk].name.split(',')[0] + " " + fruity[kk].quantity.split(',')[0] + "<br>";
    //alert('2:' + fruity[kk].name);
  if (!m.has(fruity[kk].name)) {
    //alert('3:' + fruity[kk].name);
    m.set(fruity[kk].name, fruity[kk].quantity);
    //alert('4:' + fruity[kk].name);
  }
    }
    }
}
if (altered) {
text+=lowtext;
} else {
text += "<br>These " + document.getElementById('topic').innerHTML.toLowerCase() + "s are low:<br>";
}
for (kk=0; kk<fruity.length; kk++) {
    if (('' + fruity[kk].quantity).replace('-','').substring(0,1) >= '0' && ('' + fruity[kk].quantity).replace('-','').substring(0,1) <= '9') {
    if (mysimpleCallback(fruity[kk].quantity) == 'low') {
  text += "" + fruity[kk].name.split(',')[0] + " " + fruity[kk].quantity.split(',')[0] + "<br>";
  if (!m.has(fruity[kk].name)) {
    m.set(fruity[kk].name, fruity[kk].quantity);
  }
    }
    }
}
}
document.getElementById("demo").innerHTML = text;
}
function maybetr(inid) {
   var rrspan='' + rspan + ' ';
   if (tabletds.replace('' + rrspan, '').replace('' + rrspan, '').indexOf(inid.replace('' + rrspan, '').replace('' + rrspan, '')) != -1 || ('' + inid).indexOf('undefined') != -1) {
   //alert(22);
     return '';
   } 
   if (lasttr.replace('' + rrspan, '').replace('' + rrspan, '') == inid.replace('' + rrspan, '').replace('' + rrspan, '')) {
   //alert(2);
     return '';
   }
   //if (lasttr.indexOf('1.601554') != -1 && inid.indexOf('1,601554') != -1) {
   //   alert(rrspan + ' ' + lasttr + ' ... ' + inid);
   //}
   if (lasttr.replace('' + rrspan, '').replace('' + rrspan, '').indexOf(inid.replace('' + rrspan, '').replace('' + rrspan, '').split('</td>')[0]) != -1) {
   return '';
      var thistr=inid.split('</td>')[0] + '</td>' + lasttr.split(inid.split('</td>')[0] + '</td>')[1];
      var newlast=thistr.split('</td></tr>')[0] + ',' + inid.split('</td></tr>')[0].split('>')[eval(-1 + inid.split('</td></tr>')[0].split('>').length)] + '</td></tr>';
      //alert('found ' + thistr + ' via inid=' + inid + ' and newlast=' + newlast + ' ' + tabletds.length + ' ' + tabletds.replace(lasttr, newlast).length);
      tabletds=tabletds.replace(thistr, newlast);
      lasttr=newlast;
      return '';
   }
   lasttr=inid;
   return inid;
}
function consolelog(inrec) {
//   console.log('' + inrec);
   var interim='';
   var dl='';
   if (eval('' + eelines.length) > ify) {
   efields=eelines[ify].split(',');
   dl=''; //' title="' + eelines[ify] + '"';
   }
   if (rspan == 0 || document.getElementById("tdname").innerHTML == '') {
   document.getElementById("tdname").innerHTML=maybenotvaln(inrec.split('value:')[1].split(' key:')[0].split(' map:')[0]);
   interim=maybenotvalq(inrec.split('key:')[1].split(' value:')[0].split(' map:')[0], inrec.split('value:')[1].split(' key:')[0].split(' map:')[0]);
   //alert(interim);
   document.getElementById("tdquantity").innerHTML=interim; //maybenotvalq(inrec.split('key:')[1].split(' value:')[0].split(' map:')[0], document.getElementById("tdname").innerHTML);
   document.getElementById("tdquantity").title=interim; //maybenotvalq(inrec.split('key:')[1].split(' value:')[0].split(' map:')[0], document.getElementById("tdname").innerHTML);
   rspan=1;
   } else if (inrec.split('value:')[1].split(' key:')[0].split(' map:')[0] == '') {
   interim=maybenotvalq(inrec.split('key:')[1].split(' value:')[0].split(' map:')[0], inrec.split('value:')[1].split(' key:')[0].split(' map:')[0]);
   tabletds+=maybetr('<tr' + dl + '><td contenteditable=true id=tdname' + rspan + ' onblur=fix(this);>' + maybenotvaln(inrec.split('value:')[1].split(' key:')[0].split(' map:')[0]) + '</td><td contenteditable=true id=tdquantity' + rspan + ' onblur=fix(this); title="' + inrec.split('key:')[1].split(' value:')[0].split(' map:')[0] + ',' + inrec.split('value:')[1].split(' key:')[0].split(' map:')[0] + '">' + interim + '</td></tr>');
   rspan++;
// console.log('here1:' + rspan);
   } else {
   interim=maybenotvalq(inrec.split('key:')[1].split(' value:')[0].split(' map:')[0], inrec.split('value:')[1].split(' key:')[0].split(' map:')[0]);
   tabletds+=maybetr('<tr' + dl + '><td contenteditable=false id=tdname' + rspan + ' onblur=fix(this);>' + maybenotvaln(inrec.split('value:')[1].split(' key:')[0].split(' map:')[0]) + '</td><td contenteditable=true id=tdquantity' + rspan + ' onblur=fix(this); title="' + inrec.split('key:')[1].split(' value:')[0].split(' map:')[0] + ',' + inrec.split('value:')[1].split(' key:')[0].split(' map:')[0] + '">' + interim + '</td></tr>');
   rspan++;
// console.log('here2:' + rspan);
   }
   //alert(inrec);
   if (doadd) {
   fruits.push({name:"", quantity:0});
   fruity.push({name:maybenotvaln(""), quantity:maybenotvalq('0','')});
   m.set('', 0);
   tabletds+=maybetr('<tr' + dl + '><td contenteditable=true id=tdname' + rspan + ' onblur=fix(this);>' + maybenotvaln('') + '</td><td contenteditable=true id=tdquantity' + rspan + ' onblur=fix(this); title="">' + maybenotvalq('0','') + '</td></tr>');
   rspan++;
// console.log('here3:' + rspan);
   doadd=false;
   }
   ify++;
}
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 weedout(intrs) {
   var outrs=intrs, ju=2, vsju=2;
   var trlines=intrs.split('</td></tr>');
   if (eval('' + trlines.length) > 1) {
   outrs='';
   if (trlines[0].split('</td>')[0].split('>')[eval(-1 + trlines[0].split('</td>')[0].split('>').length)] != document.getElementById('tdname').innerHTML) { outrs+=trlines[0].replace(/\,$/g,'') + '</td></tr>'; }
   for (var iu=1; iu<trlines.length; iu++) {
     if (trlines[iu].trim().indexOf('tdname') != -1 && trlines[iu].split('</td>')[0].split('>')[eval(-1 + trlines[iu].split('</td>')[0].split('>').length)] != trlines[-1 + iu].split('</td>')[0].split('>')[eval(-1 + trlines[-1 + iu].split('</td>')[0].split('>').length)]) {
       //alert(trlines[iu]);
       vsju=trlines[iu].split('tdname')[1].split(' ')[0];
       outrs+=trlines[iu].replace('tdname' + vsju + ' ', 'tdname' + ju + ' ').replace('tdquantity' + vsju + ' ', 'tdquantity' + ju + ' ') + '</td></tr>';
       ju++;
     }
   }
   }
   return outrs;
}
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) {
       document.getElementById('tdname').innerHTML='';
       document.getElementById('tdquantity').innerHTML='';
       thiscont=decodeURIComponent(('' + location.hash).substring(5).replace(/^\=/g,'').replace(/^\%3d/g,'').replace(/^\%3D/g,'').replace(/\%0A/g,encodeURIComponent('<br>')));
       setTimeout(function(){ document.getElementById('tdname').innerHTML=''; document.getElementById('tdquantity').innerHTML=''; 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;
  eelines=[];
  ify=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>' + weedout(tabletds);
  var tds=document.getElementsByTagName('td');
  var toc=',,';
  if (document.getElementById('thquantity').innerHTML.indexOf(',') != -1) { toc=',';  }
  if (document.getElementById('tdquantity').outerHTML.indexOf(',</td>') != -1) { document.getElementById('tdquantity').innerHTML=document.getElementById('tdquantity').innerHTML.replace(/\,$/g,'');  }
  for (var itd=0; itd<tds.length; itd++) {
     if (('' + tds[itd].title).replace(',',toc).indexOf(',,') != -1) {
        tds[itd].innerHTML=(tds[itd].title).replace(',',',,').split(',,')[0];
     }
  }
  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);
       document.getElementById('tdname').innerHTML='';
       document.getElementById('tdquantity').innerHTML='';
     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 anal(inen) {
   var ibn=0;
   var xenterrall=inen;
   //alert(4987);
   if (('' + inen).replace(/^undefined/g,'').trim() == '') {
   xenterall=prompt('Optionally enter a # (hashtag) delimited composite field scenario to apply for next input data (perhaps CSV) file application, such as in examples below.  ' + String.fromCharCode(10) + String.fromCharCode(10) + 'Examples ...' + String.fromCharCode(10) + '#1,3&2&4' + String.fromCharCode(10) + '#4,2*3' + String.fromCharCode(10) + '#1&4,3+2', '');
   } else {
     undone=true;
     mappings=[];
      eval('mappings.push({ from: "1", to:"' + 'Name' + '"})');
      eval('mappings.push({ from: "2", to:"' + 'Quantity' + '"})');
   console.log(mappings);
   xenterall=inen;
   }
   if (xenterall.split('#')[0].indexOf(',') == -1 && xenterall.trim() != '' && xenterall.indexOf('~`~') == -1) {
      compositename='';
      compositequantity='';
      wheres=[];
      orderbys=[];
      ors=[];
      ands=[];
      if (xenterall.indexOf('#') != -1) {
        var compstuff=xenterall.split('#')[1];
        xenterall=xenterall.split('#')[0];
        var csfs=compstuff.split(',');
        for (ibn=0; ibn<csfs.length; ibn++) {
            if (csfs[ibn].replace('!','=').replace('<','=').replace('>','=').indexOf('=') != -1) {  // where
              wheres.push(' ' + csfs[ibn]);
              if (compstuff.indexOf(csfs[ibn] + ',') != -1) {
                compstuff=compstuff.replace(csfs[ibn] + ',', '');
              } else if (compstuff.indexOf(',' + csfs[ibn]) != -1) {
                compstuff=compstuff.replace(',' + csfs[ibn], '');
              } else {
                compstuff=compstuff.replace(csfs[ibn], '');
              }
            } else if (csfs[ibn].replace('~','`').indexOf('`') != -1) { // order by
              orderbys.push(' ' + csfs[ibn]);
              if (compstuff.indexOf(csfs[ibn] + ',') != -1) {
                compstuff=compstuff.replace(csfs[ibn] + ',', '');
              } else if (compstuff.indexOf(',' + csfs[ibn]) != -1) {
                compstuff=compstuff.replace(',' + csfs[ibn], '');
              } else {
                compstuff=compstuff.replace(csfs[ibn], '');
              }
            }
        }
        csfs=compstuff.split(',');
        compositename=csfs[0];
        if (compositename != '') { 
          if (eval(('' + compositename).split('&')[0].split('+')[0].split('/')[0].split('*')[0].split('-')[0].split('%')[0].split('^')[0]) > 1 && eval('' + csfs.length) <= 1) {
            compositequantity='1';
          } else if (eval('' + csfs.length) > 1) {
            compositequantity=csfs[1];
          }
        }
        //alert(xenterall);
        //alert(compositename);
        //alert(compositequantity);
      }
      xenterall='';
   }
   xenterall='';
}
function askall(preenterall) {
   var je=1;
   var isfirst=true;
   var delall=false;
   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).  Or specify a URL we shall try to extract from where a # (hashtag) delimiter can separate composite field scenarios such as in example below.    Optionally prefix this CSV data with your topic followed by ~`~' + String.fromCharCode(10) + 'Examples ...' + String.fromCharCode(10) + 'Fish~`~taylor,300;barramundi,400;perch,100;mullet,234' + String.fromCharCode(10) + 'https://www.rjmprogramming.com.au/HTMLCSS/country.csv#1,3&2&4', '');
   if (enterall == null) {  enterall=''; }
//alert(enterall);
   if (enterall.split('#')[0].indexOf(',') == -1 && enterall.trim() != '' && enterall.indexOf('~`~') == -1) {
      compositename='';
      compositequantity='';
      if (enterall.indexOf('#') != -1) {
        var compstuff=enterall.split('#')[1];
        anal('#' + compstuff);
        enterall=enterall.split('#')[0];
      }
      //document.getElementById('dif').innerHTML='';
//alert(enterall);
   fruits=[];
   fruity=[];
   m = new Map();
   rspan=0;
   eelines=[];
   document.getElementById('tdname').innerHTML='';
   document.getElementById('tdquantity').innerHTML='';
   document.body.style.cursor='progress';
      ajaxit(enterall.replace(/^https\:/g,'').replace(/^http\:/g,'')); //document.getElementById('ifmy').src=enterall.replace(/^https\:/g,'').replace(/^http\:/g,'');
      enterall='';
   }
   } //else {
   //alert(enterall);
   //}
   if (enterall.indexOf('~`~') != -1) {  document.getElementById('topic').innerHTML=enterall.split('~`~')[0];  enterall=enterall.replace(enterall.split('~`~')[0] + '~`~', '');  }
   if (enterall.indexOf(',') != -1) {
     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('|');
     } 
     var ke=0;
     for (var ie=0; ie<elines.length; ie++) {
        elines[ie]=elines[ie].split(' //')[0].split('// ')[0];
        if (elines[ie].indexOf(',') != -1) { efields=elines[ie].split(','); }
        if (isfirst && eval('' + elines.length) > 1 && elines[ie].indexOf(',') != -1 && elines[ie].replace(/9/g,'0').replace(/8/g,'0').replace(/7/g,'0').replace(/6/g,'0').replace(/5/g,'0').replace(/4/g,'0').replace(/3/g,'0').replace(/2/g,'0').replace(/1/g,'0').indexOf('0') == -1) {
            efields=elines[ie].replace(/\"/g,'').split(',');
            if (elines[je].replace(/^\"/g,'').substring(0).replace('-','').substring(0,1) >= '0' && elines[je].replace(/^\"/g,'').substring(0).replace('-','').substring(0,1) <= '9') {
              for (ke=0; ke<efields.length; ke++) {
                 eval('mappings.unshift({ from: "' + eval(ke + 1) + '", to: "' + efields[ke] + '"})');
              }
              document.getElementById('topic').innerHTML=elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[1].substring(0,1).toUpperCase() + elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[1].substring(1);
              document.getElementById('thname').innerHTML=maybenotdefn(elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[1].substring(0,1).toUpperCase() + elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[1].substring(1));
              document.getElementById('thquantity').innerHTML=maybenotdefq(elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[0].substring(0,1).toUpperCase() + elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[0].substring(1));
            } else {
              for (ke=0; ke<efields.length; ke++) {
                 //alert('mappings.unshift({ from: "' + eval(ke + 1) + '", to: "' + efields[ke] + '"})');
                 eval('mappings.unshift({ from: "' + eval(ke + 1) + '", to: "' + efields[ke] + '"})');
              }
              document.getElementById('topic').innerHTML=elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[0].substring(0,1).toUpperCase() + elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[0].substring(1);
              document.getElementById('thname').innerHTML=maybenotdefn(elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[0].substring(0,1).toUpperCase() + elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[0].substring(1));
              document.getElementById('thquantity').innerHTML=maybenotdefq(elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[1].substring(0,1).toUpperCase() + elines[ie].replace(/^\"/g,'').substring(0).split('"')[0].split(',')[1].substring(1));
            }
            isfirst=false;
            //alert('isfirst');
        }
        je++;
        if (eval('' + ie) != 0 || isfirst) {
             //alert(elines[ie]);
        if (elines[ie].indexOf(',') != -1) { eelines.push(elines[ie]); efields=elines[ie].split(','); }
        if (elines[ie].indexOf('","') != -1 && elines[ie].indexOf('","') < elines[ie].indexOf(',')) {
          //efields=elines[ie].split('","');
          if (!delall) {
            delall=true;
            fruits=[];
            fruity=[];
            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(',')) {
          efields[0]=efields[0].replace(/\"$/g,'').replace(/^\"$/g,'');
          if (!delall) {
            delall=true;
            fruits=[];
            fruity=[];
            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(',')) {
          efields[1]=efields[1].replace(/\"$/g,'').replace(/^\"$/g,'');
          if (!delall) {
            delall=true;
            fruits=[];
            fruity=[];
            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=[];
            fruity=[];
            m = new Map();
          }
          if (elines[ie].substring(0).replace('-','').substring(0,1) >= '0' && elines[ie].substring(0).replace('-','').substring(0,1) <= '9') {
          //alert(7);
            if (9 == 7 && isfirst && ((elines[ie].substring(0).split(',')[0] + ' ').replace('-','').substring(0,1) < '0' || (elines[ie].substring(0).split(',')[0] + ' ').replace('-','').substring(0,1) > '9')) {
              document.getElementById('topic').innerHTML=elines[ie].substring(0).split(',')[1].substring(0,1).toUpperCase() + elines[ie].substring(0).split(',')[1].substring(1);
              document.getElementById('thname').innerHTML=maybenotdefn(elines[ie].substring(0).split(',')[1].substring(0,1).toUpperCase() + elines[ie].substring(0).split(',')[1].substring(1));
              document.getElementById('thquantity').innerHTML=maybenotdefq(elines[ie].substring(0).split(',')[0].substring(0,1).toUpperCase() + elines[ie].substring(0).split(',')[0].substring(1));
            } else {
            addone(elines[ie].substring(0).split(',')[1], elines[ie].substring(0).split(',')[0]);
            }
          } else {
          //alert(8);
            if (9 == 7 && 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=maybenotdefn(elines[ie].substring(0).split(',')[0].substring(0,1).toUpperCase() + elines[ie].substring(0).split(',')[0].substring(1));
              document.getElementById('thquantity').innerHTML=maybenotdefq(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;
        }
        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) {
   //alert(1987);
   document.getElementById('tdname').innerHTML='';
   document.getElementById('tdquantity').innerHTML='';
   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);
   }
   setTimeout(function(){ fromplace=document.getElementById('outputname').value.replace(/\./g, '_');  }, 3000);
  }
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 nooneencodeURIComponent(compm) {
    return encodeURIComponent(('' + compm)).replace(/\'/g,'`').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',').replace(encodeURIComponent(','),',');
  }
  
  function geoitdependsoneencodeURIComponent(compm, compv) {
   if (thqit(compositequantity) != '') {
        var fgh=document.getElementById('thquantity').innerHTML;
        if (fgh.indexOf('ongitude') != -1 && fgh.indexOf('atitude') != -1 && fgh.indexOf(',') != -1) {
        if (fgh.indexOf('atitude') < fgh.indexOf('ongitude')) {
        if (outv.indexOf('&aregeographicals=') == -1) { outv=outv.replace('&','&aregeographicals=y&');  }
        return ('' + compv).split(',')[0] + '|' + ('' + compv).split(',')[1] + '|~' +  (compm).split(',')[0].replace(/\'/g,'`').replace(/\ /g,'%20'); // .replace(/\%20/g,'+');
        } else {
        if (outv.indexOf('&aregeographicals=') == -1) { outv=outv.replace('&','&aregeographicals=y&');  }
        return ('' + compv).split(',')[1] + '|' + ('' + compv).split(',')[0] + '|~' +  (compm).split(',')[0].replace(/\'/g,'`').replace(/\ /g,'%20'); // .replace(/\%20/g,'+');
        }
        }
   } 
   return '~' + oneencodeURIComponent(compm);
  }
  
  function itdependsoneencodeURIComponent(compm) {
   if (goselv.indexOf('PHP/Histogram') != -1 || goselv.indexOf('PHP/Pie') != -1 || goselv.indexOf('PHP/Line') != -1 || goselv.indexOf('PHP/Area') != -1 || goselv.indexOf('PHP/Column') != -1 || goselv.indexOf('PHP/Bar') != -1) {
     if (compositename != '' && thqit(compositequantity) != '') {
        return encodeURIComponent(compm.split(',')[eval(-1 + compm.split(',').length)].replace(/\'/g,'`')); // .replace(/\%20/g,'+');
     }
   } 
   return oneencodeURIComponent(compm);
  }
  function oneencodeURIComponent(compm) {
    return encodeURIComponent(('' + compm).split(',')[0].replace(/\'/g,'`').replace(/\[/g,' ').replace(/\]/g,' '));
  }
  function nojustone(compm) {
    return (('' + compm)).replace(/\'/g,'`');
  }
  function justone(compm) {
    return (('' + compm).split(',')[0]).replace(/\'/g,'`');
  }
  
  function geojustone(compm) {
    // https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php/PHP/GeoChart/geo_chart.php?onclick=y&retsvg=y&overlay=aHT&shade=HT&iso=HT&text=text&wouldlikeyoutoseekpermission=y&width=834&height=520&country=Places&popularity=&aregeographicals=y&title=HT%3BHaiti&data=%20[19.45|-72.6833|~Artibonite+department~,2]%20,%20[19.15|-72.0167|~Centre+department~,2]%20,%20[18.6667|-74.1167|~Grand%2527Anse+department~,2]%20,%20[18.450|-73.100|~Nippes~,2]%20,%20[19.7667|-72.2|~Nord+Haitian+department~,2]%20,%20[19.6678|-71.8397|~Nord-Est+department~,2]%20,%20[19.95|-72.8333|~Nord-Ouest+department~,2]%20,%20[18.2|-73.75|~Sud+department~,2]%20,%20[18.2333|-72.5333|~Sud-Est+department~,2]%20,%20[18.450|-73.100|~Nippes~,2]%20
    if (thqit(compositequantity) != '') {
      return (('' + compm).split(',')[0]); // '2';
    }
    return encodeURIComponent(('' + compm).split(',')[0]);
  }
  
  function thqit(prop) {
     if (document.getElementById('thquantity').innerHTML.indexOf(',') == -1) {
        return '';
     } 
     return prop;  
  }
  
  function datait(oselv) {
    var kk=0, firstdelim='';
    var ov='';
    var fromis='youllneverfindthis', tois='youllneverfindthis';
    outv=oselv;
    goselv=oselv;
    //alert(outv);
    if (outv != '') {
    //alert('Fruits.length=' + fruits.length);
    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;
      document.getElementById('value').value=document.getElementById('thquantity').innerHTML;
      document.getElementById('label').value=document.getElementById('thname').innerHTML;
      outv=outv.replace('value=Quantity', 'value=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('label=Name', 'label=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      outv=outv.replace('title=Title', 'title=' + oneencodeURIComponent(document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' +   document.getElementById('spanlow').innerHTML + ' Report'));
      outv=outv.replace('popularity=Popularity', 'popularity=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('country=Country', 'country=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      outv=outv.replace('task=Popularity', 'task=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('desc=Country', 'desc=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      
      for (kk=0; kk<fruits.length; kk++) {
        if (('~,' + fruits[kk].quantity + ']').replace(/\~\,\]/g,'~,0]').indexOf('-') == -1 || 7 == 7) {
        outv+=',[~' + itdependsoneencodeURIComponent(fruity[kk].name) + ('~,' + justone(('' + fruity[kk].quantity).replace(/\,$/g,'')) + ']').replace(/\~\,\]/g,'~,0]').replace('-','');
        }
      }
      if (('' + outv).length > 600) { document.getElementById('lhashis').value='#' + outv.replace('],[', ']#,[').split('#')[1]; ov=outv.replace('],[', ']#,[');   outv=ov.split('#')[0] + '#' + encodeURIComponent(ov.split('#')[1]); return outv; }
    } 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;
      document.getElementById('value').value=document.getElementById('thquantity').innerHTML;
      document.getElementById('label').value=document.getElementById('thname').innerHTML;
      outv=outv.replace('value=Quantity', 'value=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('label=Name', 'label=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      outv=outv.replace('title=Title', 'title=' + oneencodeURIComponent(document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' +   document.getElementById('spanlow').innerHTML + ' Report'));
      outv=outv.replace('popularity=Popularity', 'popularity=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('country=Country', 'country=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      outv=outv.replace('task=Popularity', 'task=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('desc=Country', 'desc=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      
      for (kk=0; kk<fruits.length; kk++) {
        outv+=',[~' + itdependsoneencodeURIComponent(fruity[kk].name) + ('~,' + justone(('' + fruity[kk].quantity).replace(/\,$/g,'')) + ']').replace(/\~\,\]/g,'~,0]');
      }
      //alert(outv);
      if (('' + outv).length > 600) { document.getElementById('lhashis').value='#' + outv.replace('],[', ']#,[').split('#')[1];  return outv.replace('],[', ']#,['); }
    } else if (oselv.indexOf('PHP/Geo') != -1) {
      if (thqit(compositequantity) == '') { outv=outv.replace('aregeographicals=', 'notare=');  }
      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.split(',')[0];
      document.getElementById('task').value=document.getElementById('thquantity').innerHTML.split(',')[0];
      document.getElementById('country').value=document.getElementById('thname').innerHTML.split(',')[0];
      document.getElementById('desc').value=document.getElementById('thname').innerHTML.split(',')[0];
      document.getElementById('value').value=document.getElementById('thquantity').innerHTML.split(',')[0];
      document.getElementById('label').value=document.getElementById('thname').innerHTML.split(',')[0];
      outv=outv.replace('value=Quantity', 'value=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('label=Name', 'label=' + oneencodeURIComponent(document.getElementById('thname').innerHTML.split(',')[0]));
      outv=outv.replace('title=Title', 'title=' + oneencodeURIComponent(document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' +   document.getElementById('spanlow').innerHTML + ' Report'));
      outv=outv.replace('popularity=Popularity', 'popularity=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML.split(',')[0])); //document.getElementById('thquantity').innerHTML));
      outv=outv.replace('country=Country', 'country=' + oneencodeURIComponent(document.getElementById('thname').innerHTML.split(',')[0]));
      outv=outv.replace('task=Popularity', 'task=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML.split(',')[0]));
      outv=outv.replace('desc=Country', 'desc=' + oneencodeURIComponent(document.getElementById('thname').innerHTML.split(',')[0]));
      
      for (kk=0; kk<fruits.length; kk++) {
        //if (kk == 0) { fromis=firstdelim + '%20[' + geoitdependsoneencodeURIComponent(fruity[kk].name,fruity[kk].quantity) + ('~,' + geojustone('' + fruity[kk].quantity) + ']').replace(/\~\,\]/g,'~,0]') + '%20';  }
        outv+=firstdelim + ('%20[' + geoitdependsoneencodeURIComponent(fruity[kk].name,fruity[kk].quantity) + ('~,' + geojustone(('' + fruity[kk].quantity).replace(/\,$/g,'')) + ']').replace(/\~\,\]/g,'~,0]')).replace(String.fromCharCode(39),'~') + '%20';
        //if (kk == 0) { tois=encodeURIComponent(fromis);  }
        firstdelim=',';
      }
      //if (('' + outv).length > 600) { return outv=outv.replace('onclick=y&','').replace('?', '#onclick=y&').replace('&data=%20','&data=%2C'); }
      if (('' + outv).length > 600) { document.getElementById('lhashis').value='#' + outv.replace(']%20,%20[', ']%20#,%20[').replace('],[', ']#,[').split('#')[1]; if (thqit(compositequantity) != 'JUNK') { ov=outv.replace(']%20,%20[', ']%20#,%20[').replace('],[', ']#,[');   outv=ov.split('#')[0].replace(fromis,tois) + '#' + (ov.split('#')[1]);  return outv; } }
    } else if (oselv.indexOf('PHP/Line') != -1 || oselv.indexOf('PHP/Area') != -1 || oselv.indexOf('PHP/Column') != -1 || oselv.indexOf('PHP/Bar') != -1) {
      firstdelim=',';
      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;
      document.getElementById('value').value=document.getElementById('thquantity').innerHTML;
      document.getElementById('label').value=document.getElementById('thname').innerHTML;
      outv=outv.replace('value=Quantity', 'value=' + nooneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('label=Name', 'label=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      outv=outv.replace('title=Title', 'title=' + oneencodeURIComponent(document.getElementById('topic').innerHTML + ' ' + document.getElementById('spanok').innerHTML + ' versus ' +   document.getElementById('spanlow').innerHTML + ' Report'));
      outv=outv.replace('popularity=Popularity', 'popularity=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('country=Country', 'country=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      outv=outv.replace('task=Popularity', 'task=' + oneencodeURIComponent(document.getElementById('thquantity').innerHTML));
      outv=outv.replace('desc=Country', 'desc=' + oneencodeURIComponent(document.getElementById('thname').innerHTML));
      
      for (kk=0; kk<fruits.length; kk++) {
        outv+=firstdelim + '%20[~' + itdependsoneencodeURIComponent(fruity[kk].name) + ('~,' + nojustone(('' + fruity[kk].quantity).replace(/\,$/g,'')) + ']').replace(/\~\,\]/g,'~,0]') + '%20';
        //if (kk == 0) { var zxs=prompt(outv,outv);  }
        firstdelim=',';
      }
      if (('' + outv).length > 600) {  document.getElementById('lhashis').value='#' + outv.replace(']%20,%20[', ']%20#,%20[').replace('],[', ']#,[').split('#')[1]; return outv.replace(']%20,%20[', ']%20#,%20[').replace('],[', ']#,['); }
    } 
    }
    document.getElementById('lhashis').value='';
    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';
  }
  
 function iifopen(iois) {
  if (iois != null) {
    aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto.document) { aconto = aconto.document; }
    if (aconto != null) {
      if (aconto.getElementById('distyle')) {
        setTimeout(function(){ aconto.getElementById('distyle').innerHTML+='<style> input[type=file]::file-selector-button { background-color: pink; } </style>'; }, 3000);
      }
    }
  }
 }  
  
function stateChanged() {
 if (zhr.readyState == 4) {
  if (zhr.status == 200) {
   rawhtml = ('' + zhr.response);
   //alert(rawhtml);
   askall(rawhtml);
   document.body.style.cursor='pointer';
   alertsql();
  } else {
   document.body.style.cursor='pointer';
  }
 }
}
function ajaxit(inu) {
  document.body.style.cursor='progress';
  zhr = new XMLHttpRequest();
  zhr.responseType='Document';
  zhr.onreadystatechange=stateChanged;
  fromplace=('/' + inu).split('/')[eval(-1 + ('/' + inu).split('/').length)].replace(/\./g, '_'); 
  zhr.open('get', inu, true);
  zhr.send(null);
}
  
  
 function ifopen(iois) {
  if (iois != null) {
   if (iois.src.indexOf('About_Us.htm') == -1) {
   //alert(1);
    var xaconto = (iois.contentWindow || iois.contentDocument);
    //alert(11);
    if (xaconto.document) { xaconto = xaconto.document; }
    //alert(12);
    if (xaconto != null) {
      askall(xaconto.body.innerHTML);
    }
   }
  }
 }  
  
//  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
//  https://www.rjmprogramming.com.au/PHP/LineChart/line_chart.php?title=Title&label=Name&value=Quantity&data=,%20[~thing1~,56]%20,%20[~thing2~,-78]%20,%20[~thing3~,54.5]
</script>
</head>
<body onload='beadjustable();'>
<h1 id='myh1' ondblclick="anal('');" title='Can browse for incoming CSV style input data (of your inventory) with Choose File button.  Double click to optionally define (perhaps CSV) file field positional configuartions for the next execution run.' 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" 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 value='//www.rjmprogramming.com.au/PHP/LineChart/line_chart.php?title=Title&label=Name&value=Quantity&data='>Line Chart</option><option value='//www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php?title=Title&label=Name&value=Quantity&data='>Area Chart</option><option value='//www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php?title=Title&label=Name&value=Quantity&data='>Column Chart</option><option value='//www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php?title=Title&label=Name&value=Quantity&data='>Bar Chart</option><option id=geoopt value='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Title&width=834&height=520&wouldlikeyoutoseekpermission=y&aregeographicals=y&country=Country&popularity=Popularity&data='>Geo Chart</option></select>                            <span style='font-size:14px;display:inline-block;padding:5 5 5 5;' 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="rspan=1; 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=label id=label value='Name'></input><input type=hidden name=value id=value value='Quantity'></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=lhashis value=''></input><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>