<?php
// journal.php
// Maintain a journal
// RJM Programming
// January, 2025

$aname="";
$adob="";
$asecret="";
$vsb="visible";
  
function server_remote_addr($howlong) {
    $rma = $_SERVER['REMOTE_ADDR'];
    if ($howlong > 0) {
      $endthing='';
      $fromstart=true;
      $charnum=1;
      $idea=str_replace('.','_',$rma);
      while (strlen($endthing) < $howlong) {
        $thisc=0;
        $lastn="0";
        if ($fromstart) {
          for ($i=0; $i<strlen($idea); $i++) {
           if (substr(substr($idea,$i),0,1) >= '0' && substr(substr($idea,$i),0,1) <= '9') {
             $thisc++;
             if ($thisc == $charnum) {  $lastn=substr(substr($idea,$i),0,1); }
           }
          }
          $fromstart=false;
        } else {
          for ($i=(-1 + strlen($idea)); $i>=0; $i--) {
           if (substr(substr($idea,$i),0,1) >= '0' && substr(substr($idea,$i),0,1) <= '9') {
             $thisc++;
             if ($thisc == $charnum) {  $lastn=substr(substr($idea,$i),0,1); }
           }
          }
          $fromstart=true;
          $charnum++;
        }
        $endthing.=$lastn;
      }
      return $endthing;
    }
    return str_replace('.','_',$rma);
}

function decodeHtmlEnt($str) {  // thanks to https://www.google.com/search?q=%22function+decodeHtmlEnt(%24str)+%7B%22&rlz=1C5OZZY_en&oq=%22function+decodeHtmlEnt(%24str)+%7B%22&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIJCAEQIRgKGKABMgcIAhAhGI8CMgcIAxAhGI8C0gEJNDE1MWowajE1qAIIsAIB8QUWMCi1asf-fA&sourceid=chrome&ie=UTF-8
    $ret = html_entity_decode($str, ENT_COMPAT, 'UTF-8');
    $p2 = -1;
    for(;;) {
        $p = strpos($ret, '&#', $p2+1);
        if ($p === FALSE)
            break;
        $p2 = strpos($ret, ';', $p);
        if ($p2 === FALSE)
            break;
            
        if (substr($ret, $p+2, 1) == 'x')
            $char = hexdec(substr($ret, $p+3, $p2-$p-3));
        else
            $char = intval(substr($ret, $p+2, $p2-$p-2));
            
        //echo "$char\n";
        $newchar = iconv(
            'UCS-4', 'UTF-8',
            chr(($char>>24)&0xFF).chr(($char>>16)&0xFF).chr(($char>>8)&0xFF).chr($char&0xFF) 
        );
        //echo "$newchar<$p<$p2<<\n";
        $ret = substr_replace($ret, $newchar, $p, 1+$p2-$p);
        $p2 = $p + strlen($newchar);
    }
    return $ret;
}

if (isset($_POST['nearby']) && isset($_POST['wascont']) && isset($_POST['nowcont']) && isset($_POST['relfile'])) {
  if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['relfile'])) . '.html'))) {
    $origcont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['relfile'])) . '.html'));
    $ocont=$origcont;
    $tsis=str_replace('+',' ',urldecode($_POST['nearby']));
    $wasc=str_replace('+',' ',urldecode($_POST['wascont']));
    $nowc=str_replace('+',' ',urldecode($_POST['nowcont']));
    if (strpos($tsis, ' ') === false) {
    $tsis=base64_decode($_POST['nearby']);
    }
    if (strpos($wasc, ' ') === false) {
    $wasc=base64_decode($_POST['wascont']);
    }
    if (strpos($nowc, ' ') === false) {
    $nowc=base64_decode($_POST['nowcont']);
    }
    //file_put_contents('xa.xa', $tsis . "\n" . $wasc . "\n" . $nowc . "\n" . $origcont . "\n" . urlencode($wasc) . "\n" . urlencode($nowc) . "\n" . urlencode($origcont));
    $ndone=false;
    if (strpos($origcont, $tsis) !== false) {
      $relcont=$tsis . explode($tsis, $origcont)[1];
            //if (strpos($origcont, trim($relcont)) !== false) {
    //file_put_contents('xa.xa2z', $relcont . "\nvs\n" . $wasc);
            //}
      //$relcont=explode($tsis, $origcont)[1];
    //file_put_contents('xa.xa2', $relcont . "\nvs\n" . $wasc);
    if (9 == 9) {
      if (strpos(trim($relcont), trim($wasc)) === false || (strpos($relcont, explode("\n",$wasc)[0]) !== false && strpos($relcont, $wasc) === false)) {
    //file_put_contents('xa.xa2g', $relcont . "\nvs\n" . $wasc);
        $wsc=''; //explode("\n",$wasc)[0];
    //file_put_contents('xa.xa2h', $relcont . "\nvs\n" . $wasc);
        $afterrel=explode($tsis . $wsc, $origcont)[-1 + sizeof(explode($tsis . $wsc, $origcont))]; //$relcont)[1];
    //file_put_contents('xa.xa2j', $afterrel);
        $tsl=strlen($tsis);
    //file_put_contents('xa.xa2k', $tsl);
        $tslws=explode(' ',$tsis);
    //file_put_contents('xa.xa2m', sizeof($tslws));
        $afs=explode("\n", $afterrel);
    //file_put_contents('xa.xa2n', sizeof($afs));
        for ($jj=0; $jj<sizeof($afs); $jj++) {
          if (!$ndone && (strlen($tsl) != strlen($afs[$jj]) || sizeof($tslws) != sizeof(explode(' ',$afs[$jj])))) {
            $wsc.=$afs[$jj] . "\n";
          } else if (strlen($tsl) == strlen($afs[$jj]) && sizeof($tslws) == sizeof(explode(' ',$afs[$jj]))) {
            $ndone=true;
    //file_put_contents('xa.xa2q', '' . $ndone . ' ' . $relcont . "\nvs\n" . $wasc);
          }
        }
    //file_put_contents('xa.xa2p', '' . $ndone . ' ' . $relcont . "\nvs\n" . $wasc);
        $wasc=trim($wsc);
    //file_put_contents('xa.xa2aa', '' . $ndone . ' ' . $relcont . "\nvs\n" . $wasc);
      }
      }
      //if (strpos($relcont, explode("\n",$wasc)[0]) !== false) {
      if (strpos($origcont, trim($wasc)) !== false && strpos(trim($relcont), trim($wasc)) === false) {
        $relcont=$origcont;
      }
      if ((trim(str_replace('&nbsp;',' ',$wasc)) == '' || strpos(trim($relcont), trim($wasc)) === false) && (trim(str_replace('&nbsp;',' ',$wasc)) == '' || !$ndone) && sizeof(explode($tsis, $origcont)) == 2) {
    //file_put_contents('xa.xa2aab', '' . $ndone . ' ' . $relcont . "\nvs\n" . $wasc);
         $origcont=str_replace($tsis, $tsis . "\n" . trim($nowc) . "\n", $origcont);
         file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['relfile'])) . '.html'), $origcont);
         echo "<html><body><p>Did Change</p></body></html>";
         exit;
      } else if (strpos(trim($relcont), trim($wasc)) !== false) {
    //file_put_contents('xa.xa2a', $relcont);
        if (strpos($origcont, trim($wasc) . "\n") !== false && strpos($origcont, trim($relcont) . "\n") !== false) {
    //file_put_contents('xa.xa2y', $relcont);
        $origcont=str_replace(trim($relcont) . "\n", str_replace(trim($wasc) . "\n",trim($nowc) . "\n",trim($relcont) . "\n"), $origcont);
        } else {
        $origcont=str_replace(trim($relcont), str_replace(trim($wasc),trim($nowc),trim($relcont)), $origcont);
        }
            if (strpos($relcont, trim($wasc)) !== false) {
    //file_put_contents('xa.xa3z', $relcont . "\nvs\n" . $wasc);
            }
    //file_put_contents('xa.xa3', $relcont);
        if ($origcont != $ocont) {
    //file_put_contents('xa.xa4', $relcont);
         file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['relfile'])) . '.html'), $origcont);
         echo "<html><body><p>Did change</p></body></html>";
         exit;
        }
      }
    }
  }
  echo "<html><body></body></html>";
  exit;
}

if ((isset($_GET['isname']) && isset($_GET['isdob']) && isset($_GET['issecret'])) || (isset($_POST['name']) && isset($_POST['dob']) && isset($_POST['snum']))) {
  $fcnt=0;
  $gcnt=-1;
  $fillins="";
  $fsuff="";
  $afnd='';
  $isdone=false;
  if (!$isdone && strlen($_POST['name']) > 0) {
    if (strlen($_POST['dob']) > 0 && strlen($_POST['snum']) > 0) {
      if (isset($_POST['posting']) && isset($_POST['timestamp'])) {
       if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html')) {
        $sofar=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html');
        file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html', $sofar . "\n\n" . str_replace('+',' ',urldecode($_POST['timestamp'])) . "\n" . str_replace('+',' ',urldecode($_POST['posting'])));
        $fsuff=" if (1 == 1) { parent.document.getElementById('fjnamemore').value='" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html'))[0] . "'; parent.document.getElementById('subfjnamemore').click();  } else { parent.location.href='./journal.php?fjname=" . urlencode(explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html'))[0]) . "'; } "; 
        $fillins.=" var allbef=(('' + window.localStorage.getItem(windowbtoa('list_journal'))).replace(/^null/g,'').replace(/^undefined/g,'')), bef=(('' + window.localStorage.getItem(windowbtoa('unique_journal'))).replace(/^null/g,'').replace(/^undefined/g,'')), vsbef=windowbtoa('" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html'))[0] . "'); parent.document.getElementById('ysecret').value='" . $_POST['snum'] . "';  parent.document.getElementById('ysecret').disabled=true;  parent.document.getElementById('yname').disabled=true;   parent.document.getElementById('ydob').disabled=true; if (bef == '') {  window.localStorage.setItem(windowbtoa('unique_journal'), windowbtoa('" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html'))[0] . "'));  } else if (bef != vsbef) { if (allbef == '') {  window.localStorage.setItem(windowbtoa('list_journal'), (bef == '' ? '' : windowbtoa(windowatob(bef) + (',') + ('" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html'))[0] . "'))));  } else {     window.localStorage.setItem(windowbtoa('list_journal'), (allbef == '' ? '' : windowbtoa(windowatob(allbef) + (',') + ('" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html'))[0] . "'))));   }  } " . $fsuff . " ";
       }
   $jcont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html');
   $jtitle=explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_POST['name']))) . '-' . $_POST['dob'] . '-' . $_POST['snum'] . '.html'))[0];
   $none="block";
   $open=" open";
   $doneanddusted=true;
      }
      $isdone=true;
    } 
  } else if (!$isdone && strlen($_GET['isname']) > 0) {
    if (strlen($_GET['isdob']) > 0 && strlen($_GET['issecret']) > 0) {
      $isdone=true;
    } else if (strlen($_GET['isdob']) > 0 && strlen($_GET['issecret']) == 0) {
        //file_put_contents('xx.xxx', $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-*.*');
      foreach (glob($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-*.*') as $fln) {
        $afnd=$fln;
        $fcnt++;
      }
      if ($fcnt == 1) {
        if (isset($_GET['fillif'])) { $fsuff=" if (1 == 1) { parent.document.getElementById('fjnamemore').value='" . explode('.',basename($afnd))[0] . "'; parent.document.getElementById('subfjnamemore').click();  } else {  parent.location.href='./journal.php?fjname=" . urlencode(explode('.',basename($afnd))[0]) . "'; } ";  }
        //file_put_contents('xx.x', $fsuff);
        $fillins.=" parent.document.getElementById('ysecret').value='" . explode('.', explode($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-', $fln)[1])[0] . "'; " . $fsuff . " ";
        //file_put_contents('xx.xx', $fillins);
      } else if ($fcnt == 0 && !isset($_GET['fillif'])) {
        $sug=server_remote_addr(6);
        if (!file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-' . $sug . '.html')) {
        $rand=$sug;
        } else {
        while ($gcnt != 0) {
          $gcnt=0;
          $rand=rand(100000, 999999);
          foreach (glob($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-*-' . $rand . '.*') as $fln) {
           $gcnt++;
          }
        }
        }
        file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-' . $rand . '.html', '');
        $fillins.=" var allbef=(('' + window.localStorage.getItem(windowbtoa('list_journal'))).replace(/^null/g,'').replace(/^undefined/g,'')), bef=(('' + window.localStorage.getItem(windowbtoa('unique_journal'))).replace(/^null/g,'').replace(/^undefined/g,'')), vsbef=windowbtoa('" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-' . $rand . '.html'))[0] . "'); parent.document.getElementById('ysecret').value='" . $rand . "';  parent.document.getElementById('ysecret').disabled=true;  parent.document.getElementById('yname').disabled=true;   parent.document.getElementById('ydob').disabled=true; if (bef == '') {    window.localStorage.setItem(windowbtoa('unique_journal'), windowbtoa('" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-' . $rand . '.html'))[0] . "'));  } else if (bef != vsbef) { if (allbef == '') {   window.localStorage.setItem(windowbtoa('list_journal'), (bef == '' ? '' : windowbtoa((windowatob(bef) + (',') + ('" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-' . $rand . '.html'))[0] . "'))));  } else {    window.localStorage.setItem(windowbtoa('list_journal'), (allbef == '' ? '' : windowbtoa(windowatob(allbef) + (',') + ('" . explode('.',basename($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' . $_GET['isdob'] . '-' . $rand . '.html'))[0] . "'))));   }  }  ";
      }
    } else if (strlen($_GET['isdob']) == 0 && strlen($_GET['issecret']) > 0) {
       foreach (glob($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-*-' . $_GET['issecret'] . '.*') as $fln) {
        $fcnt++;
        $afnd=$fln;
      }
      if ($fcnt == 1) {
        if (isset($_GET['fillif'])) { $fsuff=" if (1 == 1) { parent.document.getElementById('fjnamemore').value='" . explode('.',basename($afnd))[0] . "'; parent.document.getElementById('subfjnamemore').click();  } else {  parent.location.href='./journal.php?fjname=" . urlencode(explode('.',basename($afnd))[0]) . "'; } ";  }
        $fillins.=" parent.document.getElementById('ydob').value='" . explode('-', explode($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-', $fln)[1])[0] . "'; " . $fsuff . " ";
      }
   } else if (strlen($_GET['isdob']) == 0 && strlen($_GET['issecret']) == 0) {
      foreach (glob($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-*.*') as $fln) {
        $fcnt++;
        $afnd=$fln;
      }
      if ($fcnt == 1) {
        $fillins.=" parent.document.getElementById('ydob').value='" .    explode('-', explode($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-', $fln)[1])[0] . "'; ";
        $fillins.=" parent.document.getElementById('ysecret').value='" . explode('.', explode($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-' .explode('-', explode($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace(' ','_',str_replace('+',' ', urldecode($_GET['isname']))) . '-', $fln)[1])[0] . '-', $fln)[1])[0] . "'; ";
      }
    }
  }
  if (!$isdone && strlen($_GET['isdob']) > 0) {
    if (strlen($_GET['isname']) > 0 && strlen($_GET['issecret']) > 0) {
      $isdone=true;
    }
  }
  if (!$isdone && strlen($_GET['issecret']) > 0) {
    if (strlen($_GET['isname']) > 0 && strlen($_GET['isdob']) > 0) {
      $isdone=true;
    }
  }
  echo "<html><head><meta charset=UTF-8/><scr" . "ipt type=text/javascript src=/ytaudioonly.js defer></scr" . "ipt><scr" . "ipt type=text/javascript>  
   var itchanged=false, ifnum=0;
  
/**
 * Convert a string to HTML entities ... Thanks to https://stackoverflow.com/questions/1354064/how-to-convert-characters-to-html-entities-using-plain-javascript
 */
String.prototype.toHtmlEntities = function() {
    return this.replace(/[\u00A0-\u2666]/g, function(c) {
      return '&#x'+c.charCodeAt(0).toString(16).toUpperCase()+';';
    });
};


  
  function inline_linking(xname) {
   var oklast=['A','E','I','M','Q','U','Y','c','g','k','o','s','w','0','4','8'];
   var pword='', origxname=xname, thiss='', thiscp='', xsuffix='', durl='';
   xname=(xname + ' ').replace(/\#qrcode\ /g,' QrCoDe ').replace(/\#qrcode/g,' QrCoDe').replace(/\#play\ /g,' PlAy ').replace(/\#display\ /g,' DiSpLaY ').replace(/\#listen\ /g,' LiStEn ').replace(/\#embed\ /g,' EmBeD ').replace(/\#show\ /g,' ShOw ').replace(/\#background\ /g,' BaCkGrOuNd ').replace(/\ $/g,'');
   xname=(xname + ' ').replace(/\#qrcode/g,' QrCoDe').replace(/\#play/g,' PlAy').replace(/\#display/g,' DiSpLaY').replace(/\#listen/g,' LiStEn').replace(/\#embed/g,' EmBeD').replace(/\#show/g,' ShOw').replace(/\#background/g,' BaCkGrOuNd').replace(/\ $/g,'');
   var htes=xname.split('&#');
   for (ih=1; ih<htes.length; ih++) {
     if (ih < htes.length) {
      thiss='&#';
      thiscp=\"xname=xname.replace('&#',String.fromCodePoint()); htes=xname.split('&#'); \";
      thiscp=thiscp.replace(\"',\", (xname.substring(2 + xname.indexOf('&#')) + ' ').split('; ')[0] + \";',\");
      thiscp=thiscp.replace(\"()\", '('  + (xname.substring(2 + xname.indexOf('&#')) + ' ').split('; ')[0].replace(/^x/g,'0x').replace(/\;\&\#x/g,',0x').replace(/\;\&\#/g,',') + \")\");
      eval(thiscp); //alert(thiscp);
     }
   }
   var xxname=xname;
   var delim=' ', pdelim=' ';
   while (xxname.indexOf(String.fromCharCode(10)) != -1) {
     xxname=xxname.replace(String.fromCharCode(10), ' ');
   }
   while (xxname.indexOf('<br>') != -1) {
     xxname=xxname.replace('<br>', ' ');
   }
   var thewords=xxname.split(' ');
   thewords.push('');
   thewords.push('');
   for (var jw=0; jw<thewords.length; jw++) {
    xsuffix='';
    pword=thewords[jw].replace(/PlAy/g,'').replace(/DiSpLaY/g,'').replace(/LiStEn/g,'').replace(/EmBeD/g,'').replace(/ShOw/g,'').replace(/BaCkGrOuNd/g,'').replace(/QrCoDe/g,'');
    if (pword != '') {
    pdelim='';
    durl='';
    if (xname.indexOf(' ' + pword) != -1) {  pdelim=' '; }
    if (xname.indexOf(String.fromCharCode(10) + pword) != -1) {  pdelim=String.fromCharCode(10); }
    if (xname.indexOf('<br>' + pword) != -1) {  pdelim='<br>'; }
    delim='';
    if (xname.indexOf(pdelim + pword + ' ') != -1) {  delim=' '; }
    if (xname.indexOf(pdelim + pword + String.fromCharCode(10)) != -1) {  delim=String.fromCharCode(10); }
    if (xname.indexOf(pdelim + pword + '<br>') != -1) {  delim='<br>'; }
    if (pword.indexOf('data:') == 0) {
      durl='<details contenteditable=false style=\"display:inline-flex;justify-content: space-between;align-items:flex-end;\" open><summary title=' + pword + ' contenteditable=false></summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#' + pword + '\"></iframe></details>';
      
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.rjmprogramming.com.au/recording_ideas.php#' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(1 + jw)]) {
      case 'PlAy': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#play</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'BaCkGrOuNd': //yt background
      if (durl.indexOf('data:image') != -1) {
      durl=durl.replace('width:','opacity:0.0;width:').replace('<iframe ','<iframe id=if' + ifnum + ' data-ifid=if' + ifnum + ' onload=\"' + \"setInterval(function(event){ document.getElementById('if\" + ifnum + \"').style.opacity='' + (eval('0' + document.getElementById('if\" + ifnum + \"').style.opacity) > 0.005 ? '0.0' : '1.0'); \" + '  }, 20000);\" ');
      ifnum++;
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace(' style=\"',' style=\"background:url(' + pword + ');background-repeat:no-repeat;background-size:contain;').replace('></summary>',' style=\"opacity:0.5;color:lightgray;background:url(' + pword + ');background-repeat:repeat;background-size:contain;\">#background</summary>') + xsuffix + delim);
      } else {
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#background</summary>') + xsuffix + delim);
      }
      thewords[eval(1 + jw)]='';
      break;
      
      case 'QrCoDe': // inhouse qr code representation
      //alert('0:' + xname);
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#qrcode</summary>').replace('#NOWAYJOSE' + pword,'#' + encodeURIComponent('https://www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#' + pword)) + xsuffix + delim);
      //alert(xname);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'ShOw': // inhouse details closed
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#show</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'EmBeD': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#embed</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'LiStEn': // inline inhouse
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#listen</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'DiSpLaY': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#display</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      default:
      xname=xname.replace(pdelim + pword + delim,pdelim + durl + xsuffix + delim);
      break;
      }
    } else if (pword.replace(/\@$/g,'').indexOf('@') > 0 && pword.indexOf('.') != -1 && eval('' + pword.split('@').length) >= 2) {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Email to\" contenteditable=false target=_top href=\"mailto:' + pword + '?subject=&body=\">' + pword + '</a>' + delim);
    } else if (pword == encodeURIComponent(pword) && eval('' + pword.trim().length) == 11 && oklast.indexOf(pword.slice(-1)) != -1) {
      //alert('Pword=' + pword + ' pdelim=' + pdelim.replace(String.fromCharCode(10),'x')+ ' delim=' + delim.replace(String.fromCharCode(10),'x') + ' ' + xname);
  //alert('35:' + thewords[eval(1 + jw)]);
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(1 + jw)]) {
      case 'PlAy': // inhouse details open non-mobile playing unmuted
      //xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#play</a> <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>' + xsuffix + delim);
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '</a><details contenteditable=false style=\"display:inline-block;\" open><summary title=' + pword + ' contenteditable=false>#play</summary><iframe contenteditable=false style=\"width:100%;height:800px;display:block;\" src=\"//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + pword + '&youtube_duration=12345&email=&email=&emoji=on&i0=0&j0=12345&c0=on&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=\"></iframe></details>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'BaCkGrOuNd': //yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#background</a> <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'QrCoDe': // inhouse qr code representation
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\">' + pword + '</a><details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\"></iframe></details>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'ShOw': // inhouse details open non-mobile playing muted
      //xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#show</a> <iframe style=\"width:100%;height:800px;\" src=\"//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + pword + '&youtube_duration=12345&email=&email=&emoji=on&i0=0&j0=12345&c0=on&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=\"></iframe>' + delim);
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '</a><details contenteditable=false style=\"display:inline-block;\" open><summary title=' + pword + ' contenteditable=false>#show</summary><iframe onload=\"top.document.title+=' mute control'; var acontodd = (this.contentWindow || this.contentDocument);  if (acontodd != null) {  if (acontodd.document) { acontodd = acontodd.document; acontodd.title=' + \"'YouTube video mute control'\" + '; } } \" contenteditable=false title=\"YouTube video mute control\" style=\"width:100%;height:800px;display:block;\" src=\"//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + pword + '&youtube_duration=22234.0&email=&email=&emoji=on&i0=0&j0=12345&c0=on&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=\"></iframe></details>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'EmBeD': // yt embed
      //xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#embed</a> <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>' + xsuffix + delim);
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '</a><details contenteditable=false style=\"display:inline-flex;justify-content: space-between;align-items:flex-end;\" open><summary title=' + pword + ' contenteditable=false>#embed</summary><iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe></details>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'LiStEn': // inline inhouse
      xname=xname.replace(pdelim + pword + delim,pdelim + '<span contenteditable=false><a target=\"_blank\" class=\"audioytplay\" title=\"?\" href=\"https://www.youtube.com/watch?v=' + pword + '\" rel=\"noopener\">' + pword + '#listen</a></span>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'DiSpLaY': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#display</a> <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      default:
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '</a>' + xsuffix + delim);
      break;
      }
      //alert(xname);
    } else if (pword == encodeURIComponent(pword) && eval('' + pword.trim().length) == 34) {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube playlist\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=&index=1&list=' + pword + '\">' + pword + '</a>' + delim);
    } else if (pword == encodeURIComponent(pword) && eval('' + pword.trim().length) == 22) {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Spotify playlist\" contenteditable=false target=_blank href=\"//open.spotify.com/playlist/' + pword + '\">' + pword + '</a>' + delim).trim();
    } else if (eval('' + pword.split(',')[0].length) > 4 && pword.replace(/\,/g,'').replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"SMS to\" contenteditable=false target=_top href=\"sms:' + pword + '&body=\">' + pword + '</a>' + delim);
    } else if (pword.toLowerCase().indexOf('http') == 0 && pword.indexOf(':') != -1 && pword.indexOf('//') != -1) {
      durl='<details contenteditable=false style=\"display:inline-flex;justify-content: space-between;align-items:flex-end;\" open><summary title=' + pword + ' contenteditable=false></summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#' + pword + '\"></iframe></details>';
      
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.rjmprogramming.com.au/recording_ideas.php#' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(1 + jw)]) {
      case 'PlAy': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#play</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'BaCkGrOuNd': //yt background
      if (durl.indexOf('data:image') != -1) {
      //durl=durl.replace('width:','opacity:0.0;width:').replace('<iframe ','<iframe onload=\"setInterval(function(event){ event.target.style.opacity=' + \"'' + (eval('0' + event.target.style.opacity) > 0.005 ? '0.0' : '1.0'); \" + '  }, 20000);\" ');
      durl=durl.replace('width:','opacity:0.0;width:').replace('<iframe ','<iframe id=if' + ifnum + ' data-ifid=if' + ifnum + ' onload=\"' + \"setInterval(function(event){ document.getElementById('if\" + ifnum + \"').style.opacity='' + (eval('0' + document.getElementById('if\" + ifnum + \"').style.opacity) > 0.005 ? '0.0' : '1.0'); \" + '  }, 20000);\" ');
      ifnum++;
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>',' style=\"opacity:0.5;color:lightgray;background:url(' + pword + ');background-repeat:repeat;background-size:contain;\">#background</summary>').replace(' style=\"',' style=\"background:url(' + pword + ');background-repeat:no-repeat;background-size:contain;') + xsuffix + delim);
      //xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace(' style=\"',' style=\"background:url(' + pword + ');background-repeat:no-repeat;background-size:contain;').replace(' style=\"background:url(' + pword + ');background-repeat:repeat;background-size:contain;\"></summary>','>#background</summary>') + xsuffix + delim);
      } else {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#background</summary>') + xsuffix + delim);
      }
      thewords[eval(1 + jw)]='';
      break;
      
      case 'QrCoDe': // inhouse qr code representation
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#qrcode</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'ShOw': // inhouse details closed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#show</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'EmBeD': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#embed</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'LiStEn': // inline inhouse
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#listen</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'DiSpLaY': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#display</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      default:
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + delim);
      break;
      }
    }
    }
    
   }
   if (origxname != xname) { itchanged=true;  }
   setTimeout(function(){ document.getElementById('indiv').title='Journal text goes here where hashtags #qrcode and #play and #display and #listen and #embed and #show and #background are hashtag media effect options along with an understanding of data URI media entries'; }, 5000);
   return xname.replace(/PlAy/g,'').replace(/DiSpLaY/g,'').replace(/LiStEn/g,'').replace(/EmBeD/g,'').replace(/ShOw/g,'').replace(/BaCkGrOuNd/g,'').replace(/QrCoDe/g,'');
  }

   function windowatob(astr) { // decodes
    if (astr.indexOf('_') != -1 || astr.indexOf('-') != -1) {
      //alert(astr + ' decodes as ' + window.atob(astr));
      return astr;
    }
    //alert(astr + ' ' + window.atob(window.atob(astr)));
    var atb='';
    try {
      atb=window.atob(astr);
    } catch(fhyg) {
      if (1 == 4) { alert('Bad ' + astr); }
    }
    if (atb.indexOf('_') == -1 && atb.indexOf('-') == -1) { 
      try {
        var xcv=window.atob(atb);
      } catch(hyg) {
        if (1 == 4) { alert('bad ' + atb); }
        atb=astr;
      }
      return window.atob(atb); 
    }
    return window.atob(astr);
  }
  
  function windowbtoax(astr) { 
      return astr;
  }
  
  function windowbtoa(astr) { // encodes
    if ((astr.indexOf('_') != -1 || astr.indexOf('-') != -1) && astr != 'list_journal' && astr != 'unique_journal' && 2 == 5) {
      //alert(astr + ' encodes as ' + window.btoa(astr));
      return astr;
    }
    return window.btoa(astr);
  }
</scr" . "ipt></head><body onload=\"" . $fillins . "\"></body></html>";
  exit;
}

$none="none";
$jtitle="";
$jcont="";
$suffnum="";
if (isset($_GET['snum'])) {
  $suffnum=$_GET['snum'];
} else if (isset($_POST['snum'])) {
  $suffnum=$_POST['snum'];
} 
$dob="";
$yname="";
$open="";
$doneanddusted=false;

if (isset($_GET['fjname'])) {
  if (strlen($_GET['fjname']) > 0) {
  if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['fjname']))))) {
   $jcont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['fjname']))));
   $jtitle=explode('.',basename(str_replace('+',' ',urldecode($_GET['fjname']))))[0];
   $none="block";
   $open=" open";
   $doneanddusted=true;
   if (sizeof(explode('-',$jtitle)) == 3) {
   $aname=str_replace('_',' ',explode('-', $jtitle)[0]);
   $adob=str_replace('_',' ',explode('-', $jtitle)[1]);
   $asecret=explode('.',str_replace('_',' ',explode('-', $jtitle)[2]))[0];
   }
  } else if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['fjname'])) . ".html"))) {
   $jcont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['fjname'])) . ".html"));
   $jtitle=basename(str_replace('+',' ',urldecode($_GET['fjname'])));
   $none="block";
   $open=" open";
   $doneanddusted=true;
   if (sizeof(explode('-',$jtitle)) == 3) {
   $aname=str_replace('_',' ',explode('-', $jtitle)[0]);
   $adob=str_replace('_',' ',explode('-', $jtitle)[1]);
   $asecret=explode('.',str_replace('_',' ',explode('-', $jtitle)[2]))[0];
   }
  }
  }
}


if (isset($_POST['fjname'])) {
  if (strlen($_POST['fjname']) > 0) {
  if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_POST['fjname']))))) {
   $jcont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_POST['fjname']))));
   $jtitle=explode('.',basename(str_replace('+',' ',urldecode($_POST['fjname']))))[0];
   $none="block";
   $open=" open";
   $vsb="hidden";   
   $doneanddusted=true;
   if (sizeof(explode('-',$jtitle)) == 3) {
   $aname=str_replace('_',' ',explode('-', $jtitle)[0]);
   $adob=str_replace('_',' ',explode('-', $jtitle)[1]);
   $asecret=explode('.',str_replace('_',' ',explode('-', $jtitle)[2]))[0];
   }
  } else if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_POST['fjname'])) . ".html"))) {
   $jcont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_POST['fjname'])) . ".html"));
   $jtitle=basename(str_replace('+',' ',urldecode($_POST['fjname'])));
   $none="block";
   $open=" open";
   $vsb="hidden";   
   $doneanddusted=true;
   if (sizeof(explode('-',$jtitle)) == 3) {
   $aname=str_replace('_',' ',explode('-', $jtitle)[0]);
   $adob=str_replace('_',' ',explode('-', $jtitle)[1]);
   $asecret=explode('.',str_replace('_',' ',explode('-', $jtitle)[2]))[0];
   }
  }
  }
}

if (!$doneanddusted) {
if (isset($_GET['name']) && isset($_GET['dob'])) {
  if ($suffnum == '') {
  } else {
  }

} else if (isset($_GET['name'])) {

} else if (isset($_GET['dob'])) {
} else if (isset($_GET['fjname'])) {
  if (strlen($_GET['fjname']) > 0) {
  if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['fjname']))))) {
   $jcont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['fjname']))));
   $jtitle=explode('.',basename(str_replace('+',' ',urldecode($_GET['fjname']))))[0];
   $none="block";
   $open=" open";
  } else if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['fjname'])) . ".html"))) {
   $jcont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . basename(str_replace('+',' ',urldecode($_GET['fjname'])) . ".html"));
   $jtitle=basename(str_replace('+',' ',urldecode($_GET['fjname'])));
   $none="block";
   $open=" open";
  }
  }
}
}

if ($jcont != '') {
 $jcont = decodeHtmlEnt($jcont); //html_entity_decode($jcont, ENT_QUOTES | ENT_XML1, 'UTF-8'); //preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $jcont);
 //file_put_contents('xa.xaw', $jcont);
}

echo "<html>
<head>
<title>Personal Journal - RJM Programming - January, 2026</title>
<meta charset=UTF-8/>
<style>
  button { color: blue; }
  input[type=\"submit\"] { color: blue; }
</style>
<scr" . "ipt type=text/javascript src=/ytaudioonly.js defer></scr" . "ipt>
<scr" . "ipt type=text/javascript>

  var thissuff='';
  var nextsuff='2';
  var xfill='';
  var acontod=null, divelem=null, gtao=null;
  var startid='s0', endid='s';
  var thissid='';
  var canedit=false;
  var contprefix='', contsuffix='';
  var notfirsttime=true;
  var spanolast=null;
  var itchanged=false, ifnum=0;
  

/**
 * Convert a string to HTML entities ... Thanks to https://zditect.com/code/javascript/easy-solution-to-encode-html-entities-in-javascript.html
 */
String.prototype.toHtmlEntities = function() {
    return this.replace(/./gm, function(s) {
        return (s.match(/[a-z0-9" . "\\" . "s]+/i)) ? s : '&#x' + s.charCodeAt(0).toString(16).toUpperCase() + ';';
    });
};
  
/**
 * Convert a string to HTML entities ... Thanks to https://stackoverflow.com/questions/1354064/how-to-convert-characters-to-html-entities-using-plain-javascript
 */
String.prototype.toTheHtmlEntities = function() {
    return this.replace(/[\u00A0-\u2666]/g, function(c) {
      return '&#'+c.charCodeAt(0)+';';
    });
};

  function inline_linking(xname) {
   var oklast=['A','E','I','M','Q','U','Y','c','g','k','o','s','w','0','4','8'];
   var pword='', origxname=xname, thiss='', thiscp='', xsuffix='', durl='';
   xname=(xname + ' ').replace(/\#qrcode\ /g,' QrCoDe ').replace(/\#qrcode/g,' QrCoDe').replace(/\#play\ /g,' PlAy ').replace(/\#display\ /g,' DiSpLaY ').replace(/\#listen\ /g,' LiStEn ').replace(/\#embed\ /g,' EmBeD ').replace(/\#show\ /g,' ShOw ').replace(/\#background\ /g,' BaCkGrOuNd ').replace(/\ $/g,'');
   xname=(xname + ' ').replace(/\#qrcode/g,' QrCoDe').replace(/\#play/g,' PlAy').replace(/\#display/g,' DiSpLaY').replace(/\#listen/g,' LiStEn').replace(/\#embed/g,' EmBeD').replace(/\#show/g,' ShOw').replace(/\#background/g,' BaCkGrOuNd').replace(/\ $/g,'');
   var htes=xname.split('&#');
   for (ih=1; ih<htes.length; ih++) {
     if (ih < htes.length) {
      thiss='&#';
      thiscp=\"xname=xname.replace('&#',String.fromCodePoint()); htes=xname.split('&#'); \";
      thiscp=thiscp.replace(\"',\", (xname.substring(2 + xname.indexOf('&#')) + ' ').split('; ')[0] + \";',\");
      thiscp=thiscp.replace(\"()\", '('  + (xname.substring(2 + xname.indexOf('&#')) + ' ').split('; ')[0].replace(/^x/g,'0x').replace(/\;\&\#x/g,',0x').replace(/\;\&\#/g,',') + \")\");
      eval(thiscp); //alert(thiscp);
     }
   }
   var xxname=xname;
   var delim=' ', pdelim=' ';
   while (xxname.indexOf(String.fromCharCode(10)) != -1) {
     xxname=xxname.replace(String.fromCharCode(10), ' ');
   }
   while (xxname.indexOf('<br>') != -1) {
     xxname=xxname.replace('<br>', ' ');
   }
   var thewords=xxname.split(' ');
   thewords.push('');
   thewords.push('');
   for (var jw=0; jw<thewords.length; jw++) {
    xsuffix='';
    pword=thewords[jw].replace(/PlAy/g,'').replace(/DiSpLaY/g,'').replace(/LiStEn/g,'').replace(/EmBeD/g,'').replace(/ShOw/g,'').replace(/BaCkGrOuNd/g,'').replace(/QrCoDe/g,'');
    if (pword != '') {
    pdelim='';
    durl='';
    if (xname.indexOf(' ' + pword) != -1) {  pdelim=' '; }
    if (xname.indexOf(String.fromCharCode(10) + pword) != -1) {  pdelim=String.fromCharCode(10); }
    if (xname.indexOf('<br>' + pword) != -1) {  pdelim='<br>'; }
    delim='';
    if (xname.indexOf(pdelim + pword + ' ') != -1) {  delim=' '; }
    if (xname.indexOf(pdelim + pword + String.fromCharCode(10)) != -1) {  delim=String.fromCharCode(10); }
    if (xname.indexOf(pdelim + pword + '<br>') != -1) {  delim='<br>'; }
    if (pword.indexOf('data:') == 0) {
      durl='<details contenteditable=false style=\"display:inline-flex;justify-content: space-between;align-items:flex-end;\" open><summary title=' + pword + ' contenteditable=false></summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#' + pword + '\"></iframe></details>';
      
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.rjmprogramming.com.au/recording_ideas.php#' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(1 + jw)]) {
      case 'PlAy': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#play</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'BaCkGrOuNd': //yt background
      if (durl.indexOf('data:image') != -1) {
      //durl=durl.replace('width:','opacity:0.0;width:').replace('<iframe ','<iframe onload=\"setInterval(function(event){ event.target.style.opacity=' + \"'' + (eval('0' + event.target.style.opacity) > 0.005 ? '0.0' : '1.0'); \" + '  }, 20000);\" ');
      durl=durl.replace('width:','opacity:0.0;width:').replace('<iframe ','<iframe id=if' + ifnum + ' data-ifid=if' + ifnum + ' onload=\"' + \"setInterval(function(event){ document.getElementById('if\" + ifnum + \"').style.opacity='' + (eval('0' + document.getElementById('if\" + ifnum + \"').style.opacity) > 0.005 ? '0.0' : '1.0'); \" + '  }, 20000);\" ');
      ifnum++;
//alert(durl);
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace(' style=\"',' style=\"background:url(' + pword + ');background-repeat:no-repeat;background-size:contain;').replace('></summary>',' style=\"opacity:0.5;color:lightgray;background:url(' + pword + ');background-repeat:repeat;background-size:contain;\">#background</summary>') + xsuffix + delim);
      //xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace(' style=\"',' style=\"background:url(' + pword + ');background-repeat:no-repeat;background-size:contain;').replace(' style=\"background:url(' + pword + ');background-repeat:repeat;background-size:contain;\"></summary>','>#background</summary>') + xsuffix + delim);
      } else {
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#background</summary>') + xsuffix + delim);
      }
      thewords[eval(1 + jw)]='';
      break;
      
      case 'QrCoDe': // inhouse qr code representation
      //xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#qrcode</summary>') + xsuffix + delim);
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#qrcode</summary>').replace('#NOWAYJOSE' + pword,'#' + encodeURIComponent('https://www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#' + pword)) + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'ShOw': // inhouse details closed
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#show</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'EmBeD': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#embed</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'LiStEn': // inline inhouse
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#listen</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'DiSpLaY': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace('></summary>','>#display</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      default:
      xname=xname.replace(pdelim + pword + delim,pdelim + durl + xsuffix + delim);
      break;
      }
    } else if (pword.replace(/\@$/g,'').indexOf('@') > 0 && pword.indexOf('.') != -1 && eval('' + pword.split('@').length) >= 2) {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Email to\" contenteditable=false target=_top href=\"mailto:' + pword + '?subject=&body=\">' + pword + '</a>' + delim);
    } else if (pword == encodeURIComponent(pword) && eval('' + pword.trim().length) == 11 && oklast.indexOf(pword.slice(-1)) != -1) {
      //alert('Pword=' + pword + ' pdelim=' + pdelim.replace(String.fromCharCode(10),'x')+ ' delim=' + delim.replace(String.fromCharCode(10),'x') + ' ' + xname);
  //alert('35:' + thewords[eval(1 + jw)]);
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(1 + jw)]) {
      case 'PlAy': // inhouse details open non-mobile playing non-muted
      //xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#play</a> <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>' + xsuffix + delim);
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '</a><details contenteditable=false style=\"display:inline-block;\" open><summary title=' + pword + ' contenteditable=false>#play</summary><iframe contenteditable=false style=\"width:100%;height:800px;display:block;\" src=\"//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + pword + '&youtube_duration=12345&email=&email=&emoji=on&i0=0&j0=12345&c0=on&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=\"></iframe></details>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'BaCkGrOuNd': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#background</a> <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'QrCoDe': // inhouse qr code representation
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\">' + pword + '</a><details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\"></iframe></details>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'ShOw': // inhouse details open non-mobile playing muted
      //xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#show</a> <iframe style=\"width:100%;height:800px;\" src=\"//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + pword + '&youtube_duration=12345&email=&email=&emoji=on&i0=0&j0=12345&c0=on&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=\"></iframe>' + delim);
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '</a><details contenteditable=false style=\"display:inline-block;\" open><summary title=' + pword + ' contenteditable=false>#show</summary><iframe onload=\"var acontodd = (this.contentWindow || this.contentDocument);  if (acontodd != null) {  if (acontodd.document) { acontodd = acontodd.document; acontodd.title=' + \"'YouTube video mute control'\" + '; } } \" contenteditable=false title=\"YouTube video mute control\" style=\"width:100%;height:800px;display:block;\" src=\"//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + pword + '&youtube_duration=22234.0&email=&email=&emoji=on&i0=0&j0=12345&c0=on&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=\"></iframe></details>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'EmBeD': // yt embed
      //xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#embed</a> <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>' + xsuffix + delim);
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '</a><details contenteditable=false style=\"display:inline-flex;justify-content: space-between;align-items:flex-end;\" open><summary title=' + pword + ' contenteditable=false>#embed</summary><iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe></details>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'LiStEn': // inline inhouse
      xname=xname.replace(pdelim + pword + delim,pdelim + '<span contenteditable=false><a target=\"_blank\" class=\"audioytplay\" title=\"?\" href=\"https://www.youtube.com/watch?v=' + pword + '\" rel=\"noopener\">' + pword + '#listen</a></span>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'DiSpLaY': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '#display</a> <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' + pword + '?si=FbkG3MuvQtUnTEg5\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>' + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      default:
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube video\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=' + pword + '\">' + pword + '</a>' + xsuffix + delim);
      break;
      }
      //alert(xname);
    } else if (pword == encodeURIComponent(pword) && eval('' + pword.trim().length) == 34) {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"YouTube playlist\" contenteditable=false target=_blank href=\"//www.youtube.com/watch?v=&index=1&list=' + pword + '\">' + pword + '</a>' + delim);
    } else if (pword == encodeURIComponent(pword) && eval('' + pword.trim().length) == 22) {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Spotify playlist\" contenteditable=false target=_blank href=\"//open.spotify.com/playlist/' + pword + '\">' + pword + '</a>' + delim).trim();
    } else if (eval('' + pword.split(',')[0].length) > 4 && pword.replace(/\,/g,'').replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"SMS to\" contenteditable=false target=_top href=\"sms:' + pword + '&body=\">' + pword + '</a>' + delim);
    } else if (pword.toLowerCase().indexOf('http') == 0 && pword.indexOf(':') != -1 && pword.indexOf('//') != -1) {
      durl='<details contenteditable=false style=\"display:inline-flex;justify-content: space-between;align-items:flex-end;\" open><summary title=' + pword + ' contenteditable=false></summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#' + pword + '\"></iframe></details>';
      
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.rjmprogramming.com.au/recording_ideas.php#' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(2 + jw)]) {
      
      case 'QrCoDe': // inhouse qr code representation
      xsuffix='<details contenteditable=false style=\"display:inline-block;\"><summary title=' + pword + ' contenteditable=false>#qrcode</summary><iframe contenteditable=false style=\"width:100%;height:550px;display:block;\" src=\"//www.rjmprogramming.com.au/recording_ideas.php?noinitialwo=y#https://www.youtube.com/watch?v=' + pword + '\"></iframe></details>';
      break;
      
      default:
      break;
      }
      
      switch (thewords[eval(1 + jw)]) {
      case 'PlAy': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#play</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'BaCkGrOuNd': //yt background
      if (durl.indexOf('data:image') != -1) {
      //durl=durl.replace('width:','opacity:0.0;width:').replace('<iframe ','<iframe onload=\"setInterval(function(event){ event.target.style.opacity=' + \"'' + (eval('0' + event.target.style.opacity) > 0.005 ? '0.0' : '1.0'); \" + '  }, 20000);\" ');
      durl=durl.replace('width:','opacity:0.0;width:').replace('<iframe ','<iframe id=if' + ifnum + ' data-ifid=if' + ifnum + ' onload=\"' + \"setInterval(function(event){ document.getElementById('if\" + ifnum + \"').style.opacity='' + (eval('0' + document.getElementById('if\" + ifnum + \"').style.opacity) > 0.005 ? '0.0' : '1.0'); \" + '  }, 20000);\" ');
      ifnum++;
//alert(durl);
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace(' style=\"',' style=\"background:url(' + pword + ');background-repeat:no-repeat;background-size:contain;').replace('></summary>',' style=\"opacity:0.5;color:lightgray;background:url(' + pword + ');background-repeat:repeat;background-size:contain;\">#background</summary>') + xsuffix + delim);
      //xname=xname.replace(pdelim + pword + delim,pdelim + durl.replace(' style=\"',' style=\"background:url(' + pword + ');background-repeat:no-repeat;background-size:contain;').replace(' style=\"background:url(' + pword + ');background-repeat:repeat;background-size:contain;\"></summary>','>#background</summary>') + xsuffix + delim);
      } else {
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#background</summary>') + xsuffix + delim);
      }
      thewords[eval(1 + jw)]='';
      break;
      
      case 'QrCoDe': // inhouse qr code representation
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#qrcode</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'ShOw': // inhouse details closed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#show</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'EmBeD': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#embed</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'LiStEn': // inline inhouse
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#listen</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      case 'DiSpLaY': // yt embed
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + durl.replace('></summary>','>#display</summary>') + xsuffix + delim);
      thewords[eval(1 + jw)]='';
      break;
      
      default:
      xname=xname.replace(pdelim + pword + delim,pdelim + '<a title=\"Link to\" contenteditable=false target=_blank href=\"' + pword + '\">' + pword + '</a>' + delim);
      break;
      }
    }
    }
    
   }
   if (origxname != xname) { itchanged=true;  }
   setTimeout(function(){ acontod.getElementById('indiv').title='Journal text goes here where hashtags #qrcode and #play and #display and #listen and #embed and #show and #background are hashtag media effect options along with an understanding of data URI media entries'; }, 5000);
   return xname.replace(/PlAy/g,'').replace(/DiSpLaY/g,'').replace(/LiStEn/g,'').replace(/EmBeD/g,'').replace(/ShOw/g,'').replace(/BaCkGrOuNd/g,'').replace(/QrCoDe/g,'');
  }

    
  function setcanedit(tow) {
    if (tow) {
      contprefix=('<span>').replace('<span>','');
      contsuffix='</span>';
    } else {
      contprefix='';
      contsuffix='';
    }
    canedit=tow;
  }
  
  function windowatob(astr) { // decodes
    if (astr.indexOf('_') != -1 || astr.indexOf('-') != -1) {
      //alert(astr + ' decodes as ' + window.atob(astr));
      return astr;
    }
    //alert(astr + ' ' + window.atob(window.atob(astr)));
    var atb='';
    try {
      atb=window.atob(astr);
    } catch(fhyg) {
      if (1 == 4) { alert('Bad ' + astr); }
    }
    if (atb.indexOf('_') == -1 && atb.indexOf('-') == -1) { 
      try {
        var xcv=window.atob(atb);
      } catch(hyg) {
        if (1 == 4) { alert('bad ' + atb); }
        atb=astr;
      }
      return window.atob(atb); 
    }
    return window.atob(astr);
  }
  
  function windowbtoax(astr) { 
      return astr;
  }
  
  function windowbtoa(astr) { // encodes
    if ((astr.indexOf('_') != -1 || astr.indexOf('-') != -1) && astr != 'list_journal' && astr != 'unique_journal' && 2 == 5) {
      //alert(astr + ' encodes as ' + window.btoa(astr));
      return astr;
    }
    return window.btoa(astr);
  }

  function checkls() {
    document.getElementById('ytimestamp').value=('' + new Date());
    document.getElementById('posting').placeholder='Journal Entry for ' + document.getElementById('ytimestamp').value + ' goes here ...';
    var allbef=(('' + window.localStorage.getItem(windowbtoa('list_journal'))).replace(/^null/g,'').replace(/^undefined/g,''));
    var bef=(('' + window.localStorage.getItem(windowbtoa('unique_journal'))).replace(/^null/g,'').replace(/^undefined/g,''));
    if (allbef != '') {
      document.getElementById('divlist').style.display='block';
      document.getElementById('divlist').innerHTML=\"<select style=background-color:yellow; id=mysel onchange=gto(this);><option value=''>Optionally select a Journal of interest</option></select>\";
//alert('0:' + windowatob(allbef));
      var ljs=windowatob(allbef).split(',');
      for (var jls=0; jls<ljs.length; jls++) {
      if (document.getElementById('mysel').innerHTML.indexOf('>' + ljs[jls].split('-')[0].replace(/\_/g,' ') + '</option>') == -1) {
        document.getElementById('mysel').innerHTML+='<option value=' + ljs[jls] + '>' + ljs[jls].split('-')[0].replace(/\_/g,' ') + '</option>';
      }
      }
    } else if (bef != '') {
      document.getElementById('divlist').style.display='block';
      document.getElementById('uniquej').style.display='block';
      document.getElementById('uniquej').innerHTML='Display Default Journal for ' + windowatob(bef).split('-')[0].replace(/\_/g,' ');
      document.getElementById('uniquej').title=windowatob(bef).split('-')[0].replace(/\_/g,' ');
    }
    
    setTimeout(function(){
      if (document.getElementById('sc').value == document.getElementById('ysecret').value || document.getElementById('sc').value == document.getElementById('ysecret').placeholder) {
       canedit=true;
       contprefix=('<span>').replace('<span>','');
       contsuffix='</span>';
      }
    }, 3000);
  }
  
  function getu() {
    document.getElementById('yname').value=document.getElementById('uniquej').title;
    setTimeout(function(){
    var eight=8;
    var allbef=(('' + window.localStorage.getItem(windowbtoa('list_journal'))).replace(/^null/g,'').replace(/^undefined/g,''));
    var bef=(('' + window.localStorage.getItem(windowbtoa('unique_journal'))).replace(/^null/g,'').replace(/^undefined/g,''));
    var huh=prompt('Please enter relevant 8 digit date of birth ( eg, 20041231 ) or 6 digit secret number', '');
    if (huh == null) { huh=''; }
    if (eval('' + huh.length) == 8 && (windowatob(bef) + windowatob(allbef)).indexOf(document.getElementById('yname').value.replace(/\ /g,'_') + '-' + huh + '-' + document.getElementById('sc').value) == -1 && (windowatob(bef) + windowatob(allbef)).indexOf(document.getElementById('yname').value.replace(/\ /g,'_') + '-' + huh + '-') != -1) {
      eight=-1;
      huh=prompt('Please enter 6 digit secret number', '');
      if (huh == null) { huh=''; }
    }
    if (eval('' + huh.length) == eight) {
      xfill='&fillif=ok';
      document.getElementById('ydob').value=huh;
      validatename(document.getElementById('yname'));
      xfill='';
    } else if (eval('' + huh.length) == 6) {
      xfill='&fillif=ok';
      document.getElementById('ysecret').value=huh;
      validatename(document.getElementById('yname'));
      xfill='';
    }
    }, 1000);
  }
  
  function gto(osel) {
    if (osel.value.trim() != '') {
    document.getElementById('yname').value=osel.value.split('-')[0].replace(/\_/g,' ')
    setTimeout(function(){
    var eight=8;
    var allbef=(('' + window.localStorage.getItem(windowbtoa('list_journal'))).replace(/^null/g,'').replace(/^undefined/g,''));
    var bef=(('' + window.localStorage.getItem(windowbtoa('unique_journal'))).replace(/^null/g,'').replace(/^undefined/g,''));
    var huh=prompt('Please enter relevant 8 digit date of birth ( eg, 20041231 ) or 6 digit secret number', '');
    if (huh == null) { huh=''; }
    if (eval('' + huh.length) == 8 && (windowatob(bef) + windowatob(allbef)).indexOf(document.getElementById('yname').value.replace(/\ /g,'_') + '-' + huh + '-' + document.getElementById('sc').value) == -1 && (windowatob(bef) + windowatob(allbef)).indexOf(document.getElementById('yname').value.replace(/\ /g,'_') + '-' + huh + '-') != -1) {
      eight=-1;
      huh=prompt('Please enter 6 digit secret number', '');
      if (huh == null) { huh=''; }
    }
    if (eval('' + huh.length) == eight) {
      xfill='&fillif=ok';
      document.getElementById('ydob').value=huh;
      validatename(document.getElementById('yname'));
      xfill='';
    } else if (eval('' + huh.length) == 6) {
      xfill='&fillif=ok';
      document.getElementById('ysecret').value=huh;
      validatename(document.getElementById('yname'));
      xfill='';
    }
    }, 1000);
    }
  }
  
  function preform() {
    document.getElementById('yname').value=document.getElementById('yname').value.replace(/\-/g,' ').replace(/\./g,' ').replace(/\,/g,' ').replace(/\'/g,'`').replace(/^\"/g,'').replace(/\"$/g,'').replace(/\"/g,'`');
    if (document.getElementById('yname').placeholder != '' && '" . $aname . "' != '' && document.getElementById('yname').value == '') {
      document.getElementById('yname').value=document.getElementById('yname').placeholder;
    }
    if (document.getElementById('ydob').placeholder != '' && '" . $adob . "' != '' && document.getElementById('ydob').value == '') {
      document.getElementById('ydob').value=document.getElementById('ydob').placeholder;
    }
    if (document.getElementById('ysecret').placeholder != '' && '" . $asecret . "' != '' && document.getElementById('ysecret').value == '') {
      document.getElementById('ysecret').value=document.getElementById('ysecret').placeholder;
    }
  }
  
  function afterscrutiny() {
    document.getElementById('yname').value=document.getElementById('yname').value.replace(/\-/g,' ').replace(/\./g,' ').replace(/\,/g,' ').replace(/\'/g,'`').replace(/^\"/g,'').replace(/\"$/g,'').replace(/\"/g,'`');
    if (document.getElementById('yname').placeholder != '' && '" . $aname . "' != '' && document.getElementById('yname').value == '') {
      document.getElementById('yname').value=document.getElementById('yname').placeholder;
    }
    if (document.getElementById('ydob').placeholder != '' && '" . $adob . "' != '' && document.getElementById('ydob').value == '') {
      document.getElementById('ydob').value=document.getElementById('ydob').placeholder;
    }
    if (document.getElementById('ysecret').placeholder != '' && '" . $asecret . "' != '' && document.getElementById('ysecret').value == '') {
      document.getElementById('ysecret').value=document.getElementById('ysecret').placeholder;
    }
    
    if (eval('' + document.getElementById('posting').value).length > 5000) {
      alert('Sorry, please make journal entry smaller ... up to 5000 characters');
      return false;
    } else if (eval('' + document.getElementById('posting').value.replace(String.fromCharCode(10),'').replace(String.fromCharCode(10),'').replace(String.fromCharCode(10),'').replace(String.fromCharCode(10),'').replace(String.fromCharCode(10),'').trim()).length == 0) {
      document.getElementById('posting').value='   ';
    }
  
    return true;
  }
  
  function domore() {
  }
  
  function validatename(otb) {
    document.getElementById('yname').value=document.getElementById('yname').value.replace(/\-/g,' ').replace(/\./g,' ').replace(/\,/g,' ').replace(/\'/g,'`').replace(/^\"/g,'').replace(/\"$/g,'').replace(/\"/g,'`');
    document.getElementById('helpout').src='./journal.php?isname=' + encodeURIComponent(otb.value.replace(/\ /g,'_')) + '&isdob=' + encodeURIComponent(document.getElementById('ydob').value) + '&issecret=' + encodeURIComponent(document.getElementById('ysecret').value) + xfill;
  }
  
  function validatedob(otb) {
    document.getElementById('helpout').src='./journal.php?isdob=' + encodeURIComponent(otb.value.replace(/\ /g,'_')) + '&isname=' + encodeURIComponent(document.getElementById('yname').value.replace(/\ /g,'_')) + '&issecret=' + encodeURIComponent(document.getElementById('ysecret').value) + xfill;
  }
  
  function validatesecret(otb) {
    document.getElementById('helpout').src='./journal.php?issecret=' + encodeURIComponent(otb.value.replace(/\ /g,'_')) + '&isdob=' + encodeURIComponent(document.getElementById('ydob').value) + '&isname=' + encodeURIComponent(document.getElementById('yname').value.replace(/\ /g,'_')) + xfill;
  }
  
  function wbt(taow,tao) {
    //alert(tao.value);
    if (acontod && tao) {
     if (!divelem) {
     document.getElementById('helpout').style.backgroundColor='yellow';
     document.getElementById('dcont').style.backgroundColor='yellow';
     divelem = acontod.getElementById('djc');
     gtao=tao;
     var recto = tao.getBoundingClientRect();
     if (divelem) { // thanks to ideas off http://stackoverflow.com/questions/12266320/copy-div-content-to-textarea-or-text-with-the-same-font-family-style
      divelem.style.display='flex';
    //divelem.style.alignItems='flex-end';
      divelem.style.overflowY='scroll';
      //divelem.style.flexFlow='column nowrap';
      divelem.style.flexDirection='column-reverse';
      divelem.style.fontFamily = window.getComputedStyle(tao,null).fontFamily || tao.style.fontFamily || tao.currentStyle.getCurrentProperty('font-family');
      divelem.style.fontSize = window.getComputedStyle(tao,null).fontSize || tao.style.fontSize || tao.currentStyle.getCurrentProperty('font-size');
      divelem.style.border = window.getComputedStyle(tao,null).border || tao.style.border || tao.currentStyle.getCurrentProperty('border');
      divelem.style.padding = window.getComputedStyle(tao,null).padding || tao.style.padding || tao.currentStyle.getCurrentProperty('padding');
      divelem.style.margin = window.getComputedStyle(tao,null).margin || tao.style.margin || tao.currentStyle.getCurrentProperty('margin');
      divelem.style.overflow = window.getComputedStyle(tao,null).overflow || tao.style.overflow || tao.currentStyle.getCurrentProperty('overflow');
      divelem.style.position='absolute';
      divelem.style.left='' + recto.left + 'px';
      divelem.style.width='' + eval(0 + recto.width) + 'px';
      divelem.style.height='' + recto.height + 'px';
      divelem.style.top='' + eval(-12 + recto.top) + 'px';
      //alert('' + recto.top + ' ' + recto.height + ' ' + ' ... ' + 'eval(-12 + recto.top + recto.height)=' + eval(-12 + recto.top + recto.height));
      //divelem.style.bottom='' + eval(-12 + recto.top + recto.height) + 'px';
      divelem.style.zIndex='999';
      divelem.scrollTop=divelem.scrollHeight;
      tao.style.color='transparent';
     }
     }
     var taovalue=tao.value.replace(/\</g,'&lt;').replace(/\>/g,'&gt;');
     while (taovalue.indexOf(String.fromCharCode(10)) != -1) {
      taovalue=taovalue.replace(String.fromCharCode(10),'<br>');
     }
     acontod.getElementById('djc').innerHTML='<div id=indiv title=\"Journal\" style=\"text-shadow:-0.5px 0.5px 0.5px #ff0000;background: linear-gradient(to right, #e0eafc, #ffffff);margin-top: auto !important;\">' + massage(taovalue) + '</div>';
     var sps=acontod.getElementsByTagName('span');
     for (var isps=0; isps<sps.length; isps++) {
       if (('' + sps[isps].className) == 'sed') {
         //sps[isps].setAttribute('data-oit', encodeURIComponent(sps[isps].innerText.toHtmlEntities()).replace(/\%0A$/g,''));
         if (sps[isps].innerHTML.indexOf('   ') == 0) { 
           sps[isps].innerHTML=sps[isps].innerHTML.replace('   ','&nbsp;&nbsp;&nbsp;'); 
           //sps[isps].setAttribute('data-oit', encodeURIComponent(sps[isps].innerText.replace('   ','&nbsp;&nbsp;&nbsp;')).replace(/\%0A$/g,''));
           sps[isps].setAttribute('data-oit', encodeURIComponent(sps[isps].innerHTML).replace(/\%0A$/g,''));
         } else {
           sps[isps].setAttribute('data-oit', encodeURIComponent(sps[isps].innerText.toHtmlEntities()).replace(/\%0A$/g,''));
         }
       }
     }
    }
    return '';
  }
  
  function documentgetElementById(insid) {
    if (acontod.getElementById(insid)) {
     thissid=insid;
     acontod.getElementById(insid).style.backgroundColor='#daddfa';
     setTimeout(function(){ acontod.getElementById(thissid).style.backgroundColor='#fadadd'; }, 1500); 
    }
    return acontod.getElementById(insid);
  }
  
  function sedit(spano) {
    if (spano.innerText != decodeURIComponent(('' + spano.getAttribute('data-oit')).replace(/^null/g,'').replace(/^undefined/g,''))) {
      try {
      document.getElementById('nearby').value=window.btoa(('' + spano.getAttribute('data-ts')).replace(/^null/g,'').replace(/^undefined/g,'').replace(/\_/g, ' '));
      } catch(hy) {
      document.getElementById('nearby').value=('' + spano.getAttribute('data-ts')).replace(/^null/g,'').replace(/^undefined/g,'').replace(/\_/g, ' ');
      }
      try {
      document.getElementById('wascont').value=window.btoa(decodeURIComponent(('' + spano.getAttribute('data-oit')).replace(/^null/g,'').replace(/^undefined/g,'')));
  //alert('0:' + decodeURIComponent(('' + spano.getAttribute('data-oit'))) + ' ' + document.getElementById('wascont').value);
      } catch(hdfy) {
      document.getElementById('wascont').value=decodeURIComponent(('' + spano.getAttribute('data-oit')).replace(/^null/g,'').replace(/^undefined/g,''));
  //alert('10:' + document.getElementById('wascont').value);
      }
      spano.setAttribute('data-oit', encodeURIComponent(spano.innerText));
      try {
      //alert(0);
      document.getElementById('nowcont').value=window.btoa(spano.innerText.toHtmlEntities());
      //alert(spano.innerText.toHtmlEntities());
      if (inline_linking(spano.innerText.toHtmlEntities()) != spano.innerText.toHtmlEntities()) {
        spano.innerHTML=inline_linking(spano.innerText.toHtmlEntities()) + '<br>';
      }
      } catch(hdy) {
      //alert(10);
      document.getElementById('nowcont').value=spano.innerText.toHtmlEntities();
      //alert(spano.innerText.toHtmlEntities());
      if (inline_linking(spano.innerText.toHtmlEntities()) != spano.innerText.toHtmlEntities()) {
        spano.innerHTML=inline_linking(spano.innerText.toHtmlEntities()) + '<br>';
      }
      }
      spanolast=spano;
      document.getElementById('editsub').click();
    }
  }
  
  function massage(tv) {
    var tscnt=0, itv=0;
    tv=inline_linking(tv);
    var tlls=tv.split('<br>');
    if (document.getElementById('sc').value == document.getElementById('ysecret').value || document.getElementById('sc').value == document.getElementById('ysecret').placeholder) {
       canedit=true;
       contprefix=('<span>').replace('<span>','');
       contsuffix='</span>';
    } else {
       canedit=false;
       contprefix=('<span>').replace('<span>','');
       contsuffix='';
    }
    var proposedcs=contsuffix.replace('</span>','<span>');
    var tslist=[], selis='<select style=background-color:#fadadd; id=thesel onchange=\"if (this.value.length > 0) {  parent.documentgetElementById(this.value).scrollIntoView();  } this.value=this.getAttribute(' + \"'data-orv'\" + ');\"><option value=></option></select>';
    for (itv=0; itv<tlls.length; itv++) {
      if (tlls[itv].indexOf(' GMT') != -1 && eval('' + tlls[itv].split(':').length) >= 3) {
        tslist.push(tlls[itv]);
        selis=selis.replace('</select>', '<option value=s' + tscnt + '>' + tlls[itv].replace(/\ /g,'  ') + '</option></select>');
        parent.endid='s' + tscnt;
        tscnt++;
      }
    }
    tscnt=0;
    var bprev='<button onclick=\"parent.documentgetElementById(' + \"'s'\" + ').scrollIntoView();\">&#x2196;&#xFE0F;</button>&nbsp;';
    var baftr='<button onclick=\"parent.documentgetElementById(' + \"'s'\" + ').scrollIntoView();\">&#x2198;&#xFE0F;</button>';
    for (itv=0; itv<tlls.length; itv++) {
      if (tlls[itv].indexOf(' GMT') != -1 && eval('' + tlls[itv].split(':').length) >= 3) {
        if ( tv.indexOf('<br>' + tlls[itv] + '<br>') != -1 && canedit) {
        if (proposedcs != '') { contprefix=proposedcs; }
        proposedcs='';
        tv=tv.replace('<br>' + tlls[itv] + '<br>', contsuffix + '<br><button onclick=\"parent.documentgetElementById(parent.startid).scrollIntoView();\">&#x2196;&#xFE0F; &#x2196;&#xFE0F;</button>&nbsp;' + bprev.replace('s',('s' + eval(-1 + tscnt)).replace('s-1','s0')) + selis.replace('thesel', 's' + tscnt + ' data-orv=s' + tscnt).replace('>' +  tlls[itv].replace(/\ /g,'  ') + '<', ' selected>' + tlls[itv].replace(/\ /g,'  ') + '<').replace('></', \"''>\" + (tlls[itv].replace(/\ /g,'  ') == '' ? tlls[itv].replace(/\ /g,'  ') : 'Journal timestamps ...') + '</') + '&nbsp;' + baftr.replace('s',('s' + eval(1 + tscnt))) + '&nbsp;<button onclick=\"parent.documentgetElementById(parent.endid).scrollIntoView();\">&#x2198;&#xFE0F; &#x2198;&#xFE0F;</button>' + '<br>' + contsuffix.replace('</span>', '<span class=sed data-ts=' + tlls[itv].replace(/\ /g,'_') + ' id=t' + tscnt + ' onblur=parent.sedit(this); contenteditable=true>'));
        } else if (tv.indexOf(tlls[itv] + '<br>') != -1 && canedit) {
        tv=tv.replace(tlls[itv] + '<br>', '<button onclick=\"parent.documentgetElementById(parent.startid).scrollIntoView();\">&#x2196;&#xFE0F; &#x2196;&#xFE0F;</button>&nbsp;' + bprev.replace('s',('s' + eval(-1 + tscnt)).replace('s-1','s0')) + selis.replace('thesel', 's' + tscnt + ' data-orv=s' + tscnt).replace('>' +  tlls[itv].replace(/\ /g,'  ') + '<', ' selected>' + tlls[itv].replace(/\ /g,'  ') + '<').replace('></', \"''>\" + (tlls[itv].replace(/\ /g,'  ') == '' ? tlls[itv].replace(/\ /g,'  ') : 'Journal timestamps ...') + '</') + '&nbsp;' + baftr.replace('s',('s' + eval(1 + tscnt))) + '&nbsp;<button onclick=\"parent.documentgetElementById(parent.endid).scrollIntoView();\">&#x2198;&#xFE0F; &#x2198;&#xFE0F;</button>' + '<br>' + contsuffix.replace('</span>', '<span class=sed data-ts=' + tlls[itv].replace(/\ /g,'_') + ' id=t' + tscnt + ' onblur=parent.sedit(this); contenteditable=true>'));
        proposedcs='';
        } else if (tv.indexOf('<br>' + tlls[itv]) != -1 && canedit) {
        if (proposedcs != '') { contprefix=proposedcs; }
        proposedcs='';
        tv=tv.replace('<br>' + tlls[itv], '<br>', contsuffix + '<br><button onclick=\"parent.documentgetElementById(parent.startid).scrollIntoView();\">&#x2196;&#xFE0F; &#x2196;&#xFE0F;</button>&nbsp;' + bprev.replace('s',('s' + eval(-1 + tscnt)).replace('s-1','s0')) + selis.replace('thesel', 's' + tscnt + ' data-orv=s' + tscnt).replace('>' +  tlls[itv].replace(/\ /g,'  ') + '<', ' selected>' + tlls[itv].replace(/\ /g,'  ') + '<').replace('></', \"''>\" + (tlls[itv].replace(/\ /g,'  ') == '' ? tlls[itv].replace(/\ /g,'  ') : 'Journal timestamps ...') + '</') + '&nbsp;' + baftr.replace('s',('s' + eval(1 + tscnt))) + '&nbsp;<button onclick=\"parent.documentgetElementById(parent.endid).scrollIntoView();\">&#x2198;&#xFE0F; &#x2198;&#xFE0F;</button>' + '' + contsuffix.replace('</span>', '<span class=sed data-ts=' + tlls[itv].replace(/\ /g,'_') + ' id=t' + tscnt + ' onblur=parent.sedit(this); contenteditable=true>'));
        proposedcs='';
        } else {
        tv=tv.replace(tlls[itv], '<button onclick=\"parent.documentgetElementById(parent.startid).scrollIntoView();\">&#x2196;&#xFE0F; &#x2196;&#xFE0F;</button>&nbsp;' + bprev.replace('s',('s' + eval(-1 + tscnt)).replace('s-1','s0')) + selis.replace('thesel', 's' + tscnt + ' data-orv=s' + tscnt).replace('>' +  tlls[itv].replace(/\ /g,'  ') + '<', ' selected>' + tlls[itv].replace(/\ /g,'  ') + '<').replace('></', \"''>\" + (tlls[itv].replace(/\ /g,'  ') == '' ? tlls[itv].replace(/\ /g,'  ') : 'Journal timestamps ...') + '</') + '&nbsp;' + baftr.replace('s',('s' + eval(1 + tscnt))) + '&nbsp;<button onclick=\"parent.documentgetElementById(parent.endid).scrollIntoView();\">&#x2198;&#xFE0F; &#x2198;&#xFE0F;</button>');
        proposedcs='';
        }
        tscnt++;
      }
    }
    return contprefix + tv + contsuffix;
  }
  
  function rez(ota) {
     if (divelem && ota == gtao) { // thanks to ideas off http://stackoverflow.com/questions/12266320/copy-div-content-to-textarea-or-text-with-the-same-font-family-style
//alert(1);
      var recto = gtao.getBoundingClientRect();
      var jrecto = document.getElementById('jcont').getBoundingClientRect();
      var drecto = document.getElementById('dcont').getBoundingClientRect();
//alert(12);
//alert(31);
      if (eval('' + recto.width) > eval('' + drecto.width)) {
//alert(31);
        document.getElementById('dcont').style.width='' + eval(30 + eval('' + recto.width)) + 'px';
      }
       if (eval('' + recto.height) > eval('' + drecto.height)) {
//alert(31);
        document.getElementById('dcont').style.height='' + eval(30 + eval('' + recto.height)) + 'px';
      }
      if (eval('' + recto.width) > eval('' + jrecto.width)) {
//alert(41);
        document.getElementById('jcont').style.width='' + eval(20 + eval('' + recto.width)) + 'px';
      }
      if (eval('' + recto.height) > eval('' + jrecto.height)) {
//alert(41);
        document.getElementById('jcont').style.height='' + eval(20 + eval('' + recto.height)) + 'px';
      }
      divelem.style.left='' + recto.left + 'px';
//alert(41);
      divelem.style.width='' + eval(0 + recto.width) + 'px';
//alert(51);
      divelem.style.height='' + recto.height + 'px';
//alert(61);
      //divelem.style.top='' + eval(-12 + recto.top) + 'px';
      divelem.style.bottom='' + eval(-12 + recto.top + recto.height) + 'px';
      divelem.style.zIndex='999';
//alert(71);
      gtao.style.color='transparent';
//alert(81);
     }
  }
  
  function analtwo(vorh) {
    if (document.getElementById('vspan')) {
      document.getElementById('vspan').style.visibility=vorh;
    }
    return vorh;
  }
  
  function anal(vorh) {
    var lstf='';
    if (vorh.toLowerCase() == 'hidden' && document.getElementById('scont')) {
      if (document.getElementById('scont').innerHTML.indexOf('-') != -1) {
        lstf=document.getElementById('scont').innerHTML.split('-')[eval(-1 + document.getElementById('scont').innerHTML.split('-').length)];
        document.getElementById('scont').innerHTML=(document.getElementById('scont').innerHTML + '~').split('-' + lstf + '~')[0] + '-<span style=visibility:hidden; id=vspan>' + lstf + '</span>';
      }
    }
    return vorh;
  }

</scr" . "ipt>
</head>
<body onload=checkls();>
<table style=width:100%;><tr><td>
<details id=dcont style=width:98%;display:" . $none . ";" . $open . "><summary id=scont>" . $jtitle . "</summary> 
<iframe onload=\"acontod = (this.contentWindow || this.contentDocument);  if (acontod != null) {  if (acontod.document) { acontod = acontod.document; } } setTimeout(function(){ window.wbt(acontod,acontod.getElementById('jc'));  acontod.getElementById('jc').scrollTop=acontod.getElementById('jc').scrollHeight; }, 2000);\" frameborder=1 style='display:" . $none . ";width:98%;height:350px;' id=jcont name=jcont srcdoc=\"" . ($jcont == '' ? $jcont : '<html><head><meta charset=UTF-8 /><scr' . 'ipt type=text/javascript src=/ytaudioonly.js defer></scr' . 'ipt><style> button { background-color:lightgreen; } </style></head><body><textarea onmousemove=parent.rez(this); id=jc style=width:98%;height:320px;background-color:#f0f0f0;>' . str_replace('"','&#34;',str_replace('>','&gt;',str_replace('<','&lt;',$jcont))) . '</textarea><div id=djc onmousemove=parent.rez(this);></div></body></html>') . "\"></iframe>
</details></td><td style='vertical-align:top;width:20%;background-color:#f5f5f5;'>
<h1>Journal</h1>
<h3>RJM Programming - February, 2026</h3>
<div id=divlist style=display:none;><button style=display:none;background-color:yellow; id=uniquej onclick=getu();></button></div>
</td></tr></table>
<br>
<hr>
<br>
<form style=background-color:#f9f9f9; onsubmit='return afterscrutiny();' action='./journal.php' method=POST target=jcont><input type=hidden name=fjname id=fjname value=''></input>
<input onfocus=\"document.getElementById('ysecret').style.visibility=analtwo('visible');\" style=background-color:lightgreen;width:30%; pattern='[^\.\,\-]+' onblur='validatename(this);' type=text id=yname name=name title='Journal Owner Name' placeholder='" . ($aname != '' ? $aname : 'Journal Owner Name') . "' value='' style=width:40%></input><br>
<input onfocus=\"document.getElementById('ysecret').style.visibility=analtwo('visible');\" style=background-color:lightgreen;width:30%; onblur='validatedob(this);' type=text pattern='[0-9]{8}' min=19700101 step=1 id=ydob name=dob title='Journal Owner Date of Birth eg. 20210112' placeholder='" . ($adob != '' ? $adob : 'Journal Owner Date of Birth eg. 20210112') . "' value='' style=width:40% required></input>&nbsp;&nbsp;<input type=submit value='Post to Journal' style=background-color:yellow; required></input><br>
<input style=background-color:lightgreen;width:30%;visibility:visible; onblur='validatesecret(this);' type=text pattern='[0-9]{6}' id=ysecret name=snum title='Journal Owner Secret 6 digit Number' placeholder='" . ($asecret != '' ? $asecret : 'Journal Owner Secret 6 digit Number') . "' value='' style=width:40% required></input><br>
<hr>
<input type=text id=ytimestamp name=timestamp placeholder='Journal Entry Timestamp' value='' style=width:40%;background-color:lightblue;></input><br><br>
<textarea oninput=\"if (eval('' + this.value.length) > eval('' + this.maxlength)) { alert('Content will be truncated to ' + this.maxlength + ' characters.');  }\" maxlength=5000 onblur='preform();' name=posting placeholder='' id=posting value='' style=width:80%;background-color:lightblue; rows=5></textarea>&nbsp;&nbsp;<button id=plus onclick=domore(); style=background-color:lightgreen;display:none;>+</button>
<div id=andmore></div>
</form>
<input type=hidden id=sc value='" . server_remote_addr(6) . "'></input>
<iframe onload=\"setTimeout(function(){ document.getElementById('ysecret').style.visibility=anal('" . $vsb . "'); }, 20000);\" src='./journal.php' id=helpout style='display:none;'></iframe>
<form style=display:none; action='./journal.php' method=POST target=_top><input type=hidden name=fjname id=fjnamemore value=''></input><input type=submit id=subfjnamemore value='Submit' style='display:none;'></input></form>
<form id=editf style=display:none; action='./journal.php' method=POST target=jjcont>
<input type=hidden name=nearby id=nearby value=''></input>
<input type=hidden name=wascont id=wascont value=''></input>
<input type=hidden name=nowcont id=nowcont value=''></input>
<input type=hidden name=relfile id=relfile value='" . $jtitle . "'></input>
<input type=submit id=editsub style=display:none; value='Submit'></input>
</form>
<iframe onload=\"if (!notfirsttime) { if (4 == 5) { setTimeout(function(){ location.href='./journal.php?fjname=" . $jtitle . "'; }, 20000); } } notfirsttime=false;\" src='/About_Us.html' id=jjcont name=jjcont style='display:none;'></iframe>
</body></html>
";
?>