<?php
// cowsay.php
// RJM Programming
// February, 2025
// Thanks to https://www.linuxquestions.org/questions/programming-9/shell-question-pad-end-of-each-line-with-spaces-to-%3D-80-chars-875082/
   $suff='';
   $three=''; 
   $serious=false;
   $tabbit="";
   $celltemplate='<td id="td1"><table tabspacing=0 tabpadding=0 id="tabtd1"><tbody><tr id="trhtd1"><th id="trthtd1" title="You can edit me." contenteditable="true"></th></tr><tr id="trbtd1"><td ontouchend="toppleme(this);" oncontextmenu="toppleme(this);" ondblclick="reverseme(this);" title="Double click horizontally reverses, and right click vertically topples, and wording above is editable." id="trtdtd1"></td></tr></tbody></table></td>';
   $maybenone='none';
   if (isset($_GET['debug'])) {
     $maybenone='block';
   }
 
   if (isset($_GET['inwords'])) {
     if (isset($_GET['curc'])) {
      if ($_GET['curc'] != '1') {
       $tabbit=" if (window.parent) { if (parent.document.getElementById('trtdtd" . $_GET['curc'] . "')) {  parent.appendthenfill(); } } ";
      } else {
       $tabbit='';
      }
     } else {
      $tabbit='';
     }
     if (isset($_GET['chr'])) {
       $suff=' -c "' . str_replace('+',' ',urldecode($_GET['chr'])) . '" ';
     }
     if (!file_exists('/tmp/cowsay.wds')) {
         $serious=true; 
         file_put_contents('/tmp/cowsay.wds', $_GET['inwords']);  
     } else if (substr(file_get_contents('/tmp/cowsay.wds'),0,strlen($_GET['inwords'])) == $_GET['inwords']) {
         $serious=false;
     } else {
         $serious=true; 
         file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);  
     }
     if (isset($_GET['and']) && file_exists('/tmp/cowsay.txt')) {
     if (isset($_GET['outdrawing'])) {
       file_put_contents('/tmp/cowsay.txt', str_replace('+',' ',urldecode($_GET['outdrawing'])));
     }
     if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt');  }
     if (file_exists('/tmp/cowsaythree.txt')) { unlink('/tmp/cowsaythree.txt');  }
     if (file_exists('/tmp/cowsayzero.txt')) { unlink('/tmp/cowsayzero.txt');  }
     exec("awk '{print length}' /tmp/cowsay.txt |sort -nr|head -1 | sed 's/[^0-9]//g' > /tmp/cowsayzn.txt");
     if (isset($_GET['maxl'])) {
     exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-" . $_GET['maxl'] . "s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
     } else {
     exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-`cat /tmp/cowsayzn.txt | sed 's/[^0-9]//g'`s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
     }
     exec("cat /tmp/cowsayzero.txt | head -1 | sed 's/[^\ ]/\ /g' > /tmp/cowsaynone.txt");
     for ($i=0; $i<=100; $i++) {
        exec("cat /tmp/cowsaynone.txt >> /tmp/cowsayzero.txt");
     }
     if ($serious) {
     $three='three';
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt'); // ; cp -f /tmp/cowsaythree.txt /tmp/cowsay.txt');
     if ($tabbit != '') {  $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
     } else {
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt');
     if ($tabbit != '') {  $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
     }
     //if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt');  }
     echo "<html><head><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/></head><body onload=\"if (window.parent) { if (parent.document.getElementById('result')) {  parent.document.getElementById('result').style.textShadow='-1px 1px 1px #952dff'; parent.document.getElementById('result').value=decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay' . $three . '.txt')) . "').replace(/\+/g,' '); parent.document.getElementById('result').style.fontFamily='Courier New';  parent.document.getElementById('result').style.fontSize='8px';  parent.document.getElementById('result').title='Double click for more ... thanks to https://pypi.org/project/cowsay'; parent.document.getElementById('result').ondblclick=function(){ window.open('/cowsay.php','_blank','top=100,left=100,width=600,height=600'); };   }  }\"><textarea id=dta title='Double click for another Cow Says pearl of wisdom.' ondblclick=\"location.href='/cowsay.php';\" style='width:98%;height:90%;border:2px dotted red;font-size:8px;'>" . file_get_contents('/tmp/cowsaythree.txt') . "</textarea></body></html>";
     } else {
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsay.txt');
     echo "<html><head><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/></head><body onload=\"if (window.parent) { if (parent.document.getElementById('result')) {  parent.document.getElementById('result').style.textShadow='-1px 1px 1px #952dff'; parent.document.getElementById('result').value=decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' '); parent.document.getElementById('result').style.fontFamily='Courier New';  parent.document.getElementById('result').style.fontSize='8px';  parent.document.getElementById('result').title='Double click for more ... thanks to https://pypi.org/project/cowsay'; parent.document.getElementById('result').ondblclick=function(){ window.open('/cowsay.php','_blank','top=100,left=100,width=600,height=600'); };   }  }\"><textarea id=dta title='Double click for another Cow Says pearl of wisdom.' ondblclick=\"location.href='/cowsay.php';\" style='width:98%;height:90%;border:2px dotted red;font-size:8px;'>" . file_get_contents('/tmp/cowsay.txt') . "</textarea></body></html>";
     }
     exit;
   } else if (isset($_POST['inwords'])) {
     if (isset($_POST['curc'])) {
      if ($_POST['curc'] != '1') {
       $tabbit=" if (window.parent) { if (parent.document.getElementById('trtdtd" . $_POST['curc'] . "')) {  parent.appendthenfill(); } } ";
      } else {
       $tabbit='';
      }
     } else {
      $tabbit='';
     }
     if (isset($_POST['chr'])) {
       $suff=' -c "' . str_replace('+',' ',urldecode($_POST['chr'])) . '" ';
     }
     if (!file_exists('/tmp/cowsay.wds')) {
         $serious=true; 
         file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);  
     } else if (substr(file_get_contents('/tmp/cowsay.wds'),0,strlen($_POST['inwords'])) == $_POST['inwords']) {
         $serious=false;
     } else {
         $serious=true; 
         file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);  
     }
     if (isset($_POST['and']) && file_exists('/tmp/cowsay.txt')) {
     if (isset($_POST['outdrawing'])) {
       file_put_contents('/tmp/cowsay.txt', str_replace('+',' ',urldecode($_POST['outdrawing'])));
     }
     if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt');  }
     if (file_exists('/tmp/cowsaythree.txt')) { unlink('/tmp/cowsaythree.txt');  }
     if (file_exists('/tmp/cowsayzero.txt')) { unlink('/tmp/cowsayzero.txt');  }
     exec("awk '{print length}' /tmp/cowsay.txt |sort -nr|head -1 | sed 's/[^0-9]//g' > /tmp/cowsayzn.txt");
     if (isset($_POST['maxl'])) {
     exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-" . $_POST['maxl'] . "s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
     } else {
     exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-`cat /tmp/cowsayzn.txt | sed 's/[^0-9]//g'`s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
     }
     exec("cat /tmp/cowsayzero.txt | head -1 | sed 's/[^\ ]/\ /g' > /tmp/cowsaynone.txt");
     for ($i=0; $i<=100; $i++) {
        exec("cat /tmp/cowsaynone.txt >> /tmp/cowsayzero.txt");
     }
     if ($serious) {
     $three='three';
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt'); // ; cp -f /tmp/cowsaythree.txt /tmp/cowsay.txt');
     if ($tabbit != '') {  $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
     } else {
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt');
     if ($tabbit != '') {  $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
     }
     //if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt');  }
     echo "<html><head><style>
 margin: 0 0 0 0;
 padding: 0 0 0 0;
 tr { vertical-align: top; }
 td { vertical-align: top; }
 th { vertical-align: top; }
 * { font-family:'Courier New',Courier,monospace; }
 .img-hor { // thanks to https://stackoverflow.com/questions/32875695/flip-mirror-an-image-horizontally-vertically-with-css
        -moz-transform: scaleX(-1);
        -o-transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
        transform: scaleX(-1);
        filter: FlipH;
        -ms-filter: 'FlipH';
 }
</style><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/></head><body onload=\" " . $tabbit . " if (window.parent) { if (parent.document.getElementById('outdrawing')) {  parent.document.getElementById('outdrawing').value=parent.setlenthree(" . str_replace("\n","",file_get_contents('/tmp/cowsayzn.txt')) . ",decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' '),decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "').replace(/\+/g,' ')); } } if (window.parent) { if (parent.document.getElementById('result')) {  parent.document.getElementById('result').value=parent.setlen(" . str_replace("\n","",file_get_contents('/tmp/cowsayzn.txt')) . ",decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' ')); parent.document.getElementById('result').style.fontFamily='Courier New';  parent.document.getElementById('result').style.fontSize='8px';  parent.document.getElementById('result').title='Double click for more ... thanks to https://pypi.org/project/cowsay'; parent.document.getElementById('result').ondblclick=function(){ window.open('/cowsay.php','_blank','top=100,left=100,width=600,height=600'); };   }  }\"><textarea id=dta title='Double click for another Cow Says pearl of wisdom.' ondblclick=\"location.href='/cowsay.php';\" style='width:98%;height:90%;border:2px dotted red;font-size:8px;'>" . file_get_contents('/tmp/cowsaythree.txt') . "</textarea></body></html>";
     } else {
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsay.txt');
     echo "<html><head><style>
 margin: 0 0 0 0;
 padding: 0 0 0 0;
 tr { vertical-align: top; }
 td { vertical-align: top; }
 th { vertical-align: top; }
 * { font-family:'Courier New',Courier,monospace; }
 .img-hor { // thanks to https://stackoverflow.com/questions/32875695/flip-mirror-an-image-horizontally-vertically-with-css
        -moz-transform: scaleX(-1);
        -o-transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
        transform: scaleX(-1);
        filter: FlipH;
        -ms-filter: 'FlipH';
 }
</style><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/></head><body onload=\" " . $tabbit . " if (window.parent) { if (parent.document.getElementById('outdrawing')) {  parent.document.getElementById('outdrawing').value=parent.setlen(" . str_replace("\n","",file_get_contents('/tmp/cowsayzn.txt')) . ",decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' ')); } } if (window.parent) { if (parent.document.getElementById('result')) {  parent.document.getElementById('result').value=parent.setlen(" . str_replace("\n","",file_get_contents('/tmp/cowsayzn.txt')) . ",decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' ')); parent.document.getElementById('result').style.fontFamily='Courier New';  parent.document.getElementById('result').style.fontSize='8px';  parent.document.getElementById('result').title='Double click for more ... thanks to https://pypi.org/project/cowsay'; parent.document.getElementById('result').ondblclick=function(){ window.open('/cowsay.php','_blank','top=100,left=100,width=600,height=600'); };   }  }\"><textarea id=dta title='Double click for another Cow Says pearl of wisdom.' ondblclick=\"location.href='/cowsay.php';\" style='width:98%;height:90%;border:2px dotted red;font-size:8px;'>" . file_get_contents('/tmp/cowsay.txt') . "</textarea></body></html>";
     }
     exit;
   }
   
   echo "<html><head><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/>
<meta name='viewport' content='width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes'  >
<style>
 margin: 0 0 0 0;
 padding: 0 0 0 0;
 tr { vertical-align: top; }
 td { vertical-align: top; }
 th { vertical-align: top; }
 * { font-family:'Courier New',Courier,monospace; }
 .img-hor { // thanks to https://stackoverflow.com/questions/32875695/flip-mirror-an-image-horizontally-vertically-with-css
        -moz-transform: scaleX(-1);
        -o-transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
        transform: scaleX(-1);
        filter: FlipH;
        -ms-filter: 'FlipH';
 }
 .img-ver { // thanks to https://stackoverflow.com/questions/32875695/flip-mirror-an-image-horizontally-vertically-with-css
        -moz-transform: scaleY(-1);
        -o-transform: scaleY(-1);
        -webkit-transform: scaleY(-1);
        transform: scaleY(-1);
        filter: FlipV;
        -ms-filter: 'FlipV';
 }

 .glow {
  -webkit-animation: glow 1s linear infinite alternate;
  -moz-animation: glow 1s linear infinite alternate;
  animation: glow 1s linear infinite alternate;
 }

 /* Thanks to https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_glowing_text */

 @-webkit-keyframes glow {
  from {
    box-shadow: 0 0 3px #fff, 0 0 5px #fff, 0 0 37px #e60073, 0 0 9px #e60073, 0 0 11px #e60073, 0 0 13px #e60073, 0 0 15px #e60073;
  }

  to {
    box-shadow: 0 0 24px #fff, 0 0 6px #ff4da6, 0 0 8px #ff4da6, 0 0 10px #ff4da6, 0 0 12px #ff4da6, 0 0 14px #ff4da6, 0 0 16px #ff4da6;
  }
 }

th[id$='0'] { 
    background: rgba(224,240,240,0.6); //#e0f0f0;
}

th[id$='1'] { 
    background: rgba(225,241,241,0.6); //#e1f1f1;
}

th[id$='2'] {
    background: rgba(226,242,242,0.6); //#e2f2f2;
}

th[id$='3'] {
    background: rgba(227,243,243,0.6); //#e3f3f3;
}

th[id$='4'] {
    background: rgba(228,244,244,0.6); //#e4f4f4;
}

th[id$='5'] {
    background: rgba(229,245,245,0.6); //#e5f5f5;
}

th[id$='6'] {
    background: rgba(230,246,246,0.6); //#e6f6f6;
}

th[id$='7'] {
    background: rgba(231,247,247,0.6); //#e7f7f7;
}

th[id$='8'] {
    background: rgba(232,248,248,0.6); //#e2f2f2;
}

th[id$='9'] {
    background: rgba(233,249,249,0.6); //#e9f9f9;
}

td[id$='0'] {
    background: rgba(240,240,240,0.3); //#f0f0f0;
    text-shadow:-1px 1px 1px #ff2d90;
}

td[id$='1'] {
    background: rgba(241,241,241,0.3); //#f1f1f1;
    text-shadow:-1px 1px 1px #ff2d91;
    float: bottom;
}

td[id$='2'] {
    background: rgba(242,242,242,0.3); //#f2f2f2;
    text-shadow:-1px 1px 1px #ff2d92;
}

td[id$='3'] {
    background: rgba(243,243,243,0.3); //#f3f3f3;
    text-shadow:-1px 1px 1px #ff2d93;
}

td[id$='4'] {
    background: rgba(244,244,244,0.3); //#f4f4f4;
    text-shadow:-1px 1px 1px #ff2d94;
}

td[id$='5'] {
    background: rgba(245,245,245,0.3); //#f5f5f5;
    text-shadow:-1px 1px 1px #ff2d95;
}

td[id$='6'] {
    background: rgba(246,246,246,0.3); //#f6f6f6;
    text-shadow:-1px 1px 1px #ff2d96;
}

td[id$='7'] {
    background: rgba(247,247,247,0.3); //#f7f7f7;
    text-shadow:-1px 1px 1px #ff2d97;
}

td[id$='8'] {
    background: rgba(248,248,248,0.3); //#f8f8f8;
    text-shadow:-1px 1px 1px #ff2d98;
}

td[id$='9'] {
    background: rgba(249,249,249,0.3); //#f9f9f9;
    text-shadow:-1px 1px 1px #ff2d99;
}

table tbody tr:first-child {
    background: transparent; //#f6f6e6;
}
</style>
<script type=text/javascript>
   var gnewwithwhat='';
   var aconto=null;
   var randis=-1, randi=-1, randsofar='', fullrandis='', moder='';
   var eighty=0, topwo=null;
   var screenwidth=screen.width, screenheight=screen.height;
   var curcell=1, currow=1, initialtableih='';
   var celltemplate='<td id=\"td1\"><table tabspacing=0 tabpadding=0 id=\"tabtd1\"><tbody><tr id=\"trhtd1\"><th onblur=emsmrefresh(); id=\"trthtd1\" title=\"You can edit me.\" contenteditable=\"true\"></th></tr><tr id=\"trbtd1\"><td ontouchend=\"toppleme(this);\" oncontextmenu=\"toppleme(this);\" ondblclick=\"reverseme(this);\" title=\"Double click horizontally reverses, and right click vertically topples, and wording above is editable.\" id=\"trtdtd1\"></td></tr></tbody></table></td>';
   var speechtotextwo=null;
   //var isChromeWB = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
   var isChromeWB = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor) && !/OPR/.test(navigator.userAgent);
   if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    if (navigator.userAgent.match('CriOS')) {
    isChromeWB=true; //alert('' + isChromenm + ' ' + navigator.userAgent);
    }
   }

function window_open(a1,a2,a3) {
  if (topwo) {
    topwo.close();
    topwo=null;
  }
  return window.open(a1,a2,a3);
}

function anop() {
  if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    topwo=window_open('https://www.google.com/intl/en/chrome/demos/speech.html','_blank','top=120,left=' + eval(eval('' + screen.width) - 690) + ',width=690,height=550');
    setTimeout(function(){  topwo.scrollTo(0,0);  topwo.document.getElementById('tdm').style.opacity='0.0';   }, 6000);
    setInterval(function(){  if (!topwo.closed) { topwo.focus(); }  topwo.location.href='https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?rand=' + Math.floor(Math.random() * 1987967) + '&mode=4';  setTimeout(function(){ topwo.scrollTo(0,0);   topwo.document.getElementById('tdm').style.opacity='0.0'; }, 6000);  }, 30000);
  } else {
    topwo=window.open('https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?rand=' + Math.floor(Math.random() * 1987967) + '&mode=4','_blank','top=120,left=' + eval(eval('' + screen.width) - 690) + ',width=690,height=550');
    setTimeout(function(){  topwo.scrollTo(0,0);  topwo.document.getElementById('tdm').style.opacity='0.0';   }, 6000);
    setInterval(function(){ if (!topwo.closed) { topwo.focus(); } topwo.location.href='https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?rand=' + Math.floor(Math.random() * 1987967) + '&mode=4';  setTimeout(function(){ topwo.scrollTo(0,0);   topwo.document.getElementById('tdm').style.opacity='0.0'; }, 6000);  }, 30000);
  }
}



  function is_ch() {
    is__chrome=false;
  }
  
  function rtrim(inzx) {
    var outzx=inzx;
    while ((' ' + outzx).slice(-1) == ' ' && outzx != '') {
     if (outzx != '') {
      if (('' + outzx.length) == '1') {
      outzx=='';
      } else {
      outzx=outzx.substring(0,eval(-1 + outzx.length));
      }
     }
    }
    return outzx;
  }
  
  function emsmrefresh() {
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(hgf) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     if (21 == 21) {
     document.getElementById('spancartoon').disabled=false;
     } else {
     document.getElementById('spancartoon').style.display='inline';
     }
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
  }
  
  function reverseme(tdo) {
    var thisihis='';
    console.log('here at reverseme');
    if (tdo.outerHTML.indexOf(' class=') == -1) {
    console.log('Here first time at reverseme');
      // trbtd1 vs trtdtd1
      tdo.setAttribute('data-trorig',encodeURIComponent(document.getElementById(tdo.id.replace('tdtd','btd')).innerHTML));
      console.log(tdo.getAttribute('data-trorig'));
    }
    console.log('Here look for class at reverseme');
    //if (tdo.outerHTML.indexOf(' class=\"img_hor') == -1) {
    if (tdo.outerHTML.indexOf('img_hor') == -1) {
    console.log('Here reverse at reverseme');
      if (tdo.outerHTML.indexOf('img_ver') != -1) {
      tdo.style.transform='scaleY(-1) scaleX(-1)';
      } else {
      tdo.style.transform='scaleX(-1)';
      }
      tdo.className=('' + tdo.className).replace(/^null/g,'').replace(/^indefined/g,'') + ' img_hor';
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    } else if (('' + tdo.getAttribute('data-trorig')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    console.log('Here reinstate second way at reverseme');
      thisihis=decodeURIComponent('' + tdo.getAttribute('data-trorig'));
      document.getElementById(tdo.id.replace('tdtd','btd')).innerHTML=thisihis;
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    } else {
    console.log('Here reinstate at reverseme');
      tdo.className='imJUNKg_hor';
      tdo.style.transform='scaleX(-1)';
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(exvgh) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    }
  }
  
  function toppleme(tdo) {
    var thisihis='';
    console.log('here at reverseme');
    if (tdo.outerHTML.indexOf(' class=') == -1) {
    console.log('Here first time at topplememe');
      // trbtd1 vs trtdtd1
      tdo.setAttribute('data-trorig',encodeURIComponent(document.getElementById(tdo.id.replace('tdtd','btd')).innerHTML));
      console.log(tdo.getAttribute('data-trorig'));
    }
    console.log('Here look for class at topplememe');
    //if (tdo.outerHTML.indexOf(' class=\"img_ver') == -1) {
    if (tdo.outerHTML.indexOf('img_ver') == -1) {
    console.log('Here reverse at topplememe');
      if (tdo.outerHTML.indexOf('img_hor') != -1) {
      tdo.style.transform='scaleX(-1) scaleY(-1)';
      } else {
      tdo.style.transform='scaleY(-1)';
      }
      tdo.className=('' + tdo.className).replace(/^null/g,'').replace(/^indefined/g,'') + ' img_ver';
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    } else if (('' + tdo.getAttribute('data-trorig')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    console.log('Here reinstate second way at topplememe');
      thisihis=decodeURIComponent('' + tdo.getAttribute('data-trorig'));
      document.getElementById(tdo.id.replace('tdtd','btd')).innerHTML=thisihis;
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    } else {
    console.log('Here reinstate at toppleme');
      tdo.className='imJUNKg_ver';
      tdo.style.transform='scaleY(-1)';
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    }
  }


  function chkit(iois) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
         if (aconto.document) { aconto = aconto.document; }
       }       
   }
   
   function nocrlf(incx) {
     var outcx=incx;
     while (outcx.indexOf(String.fromCharCode(10)) != -1) {
       outcx=outcx.replace(String.fromCharCode(10), '');
     }
     return outcx;
   }
   
   function brize(infg) {
     var outfg=infg, doit=true, lookforhbit=true, theheadbit='';
     var origlen=eval('' + infg.length);
     var outsare=infg.split(String.fromCharCode(10));
     for (var ij=eval(-1 + outsare.length); ij>=0; ij--) {
        if (doit && outsare[ij].trim() == '') {
          origlen-=eval(1 + eval('' + outsare[ij].length));
          outfg=infg.substring(0,origlen);
        } else {
          doit=false;
          if (lookforhbit && outsare[ij].indexOf(' =') != -1 && outsare[ij].indexOf(' =-') == -1 && outsare[ij].indexOf(' ==' + String.fromCharCode(92)) == -1) {
            lookforhbit=false;
            theheadbit=outfg.split(outsare[ij])[0] + outsare[ij] + String.fromCharCode(10);
          }
        }
     }
     if (theheadbit != '') {
       outfg=outfg.split(theheadbit)[1];
       while (theheadbit.indexOf(String.fromCharCode(10)) != -1) {
         theheadbit=theheadbit.replace(String.fromCharCode(10), '<br>');
       }
     }
     while (outfg.indexOf(String.fromCharCode(10)) != -1) {
       outfg=outfg.replace(String.fromCharCode(10), '<br>');
     }
     if (theheadbit != '') {
       document.getElementById('trthtd' + curcell).innerHTML=theheadbit.replace(/\ /g, '&nbsp;');
     }
     return outfg.replace(/\ /g, '&nbsp;');
   }
   
   function setlen(towhat, withwhat) {
     var newwithwhat=withwhat, onerec='';
     var minmaxlen=0, maxlen=0, irecs=0;
     var recs=withwhat.split(String.fromCharCode(13) + String.fromCharCode(10));
     for (irecs=0; irecs<recs.length; irecs++) {
        if (eval('' + recs[irecs].length) > maxlen) { maxlen=eval('' + recs[irecs].length);  }
        //if (eval('' + rtrim(recs[irecs]).length) > minmaxlen) { minmaxlen=eval('' + rtrim(recs[irecs]).length);  }
     }
     eighty=0;
     if (minmaxlen != 0) { maxlen=minmaxlen; }
     //alert('Maxlen=' + maxlen);
     document.getElementById('maxl').value='' + maxlen;
     newwithwhat='';
     while (eval('' + newwithwhat.length) < maxlen) {
       newwithwhat+=' ';
     }
     onerec=newwithwhat;
     newwithwhat='';
     for (irecs=0; irecs<recs.length; irecs++) {
        if (eval('' + recs[irecs].length) > maxlen) { 
          recs[irecs]=recs[irecs].substring(0,maxlen);
        }
        if (eval('' + recs[irecs].length) < maxlen) { 
          while (eval('' + recs[irecs].length) < maxlen) { 
            recs[irecs]+=' ';
          }
          newwithwhat+=recs[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
        } else {
          newwithwhat+=recs[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
        }
     }
     for (var jj=0; jj<100; jj++) {
        newwithwhat+=onerec + String.fromCharCode(13) + String.fromCharCode(10);
     }
     if (aconto.getElementById('dta')) {
       gnewwithwhat=newwithwhat;
       setTimeout(function(){ aconto.getElementById('dta').innerHTML=''; aconto.getElementById('dta').value=gnewwithwhat; if (document.getElementById('nonct').outerHTML.split('>')[0].indexOf(' open') == -1) { aconto.getElementById('dta').style.display='none'; }  }, 5000);
     }
     if (document.getElementById('outdrawing')) {
       document.getElementById('outdrawing').value=newwithwhat;
     }
     document.getElementById('backuptable').innerHTML=initialtableih;
     curcell=1;
     if (curcell == 1) {
       appendthenfill(encodeURIComponent(newwithwhat));
     }
     document.getElementById('atop').style.display='block';
     setTimeout(function(){ if (document.getElementById('nonct').outerHTML.split('>')[0].indexOf(' open') == -1) { aconto.getElementById('dta').style.display='none'; location.href='#atop'; } paddingtopit(); }, 1000); 
     return newwithwhat;
   }
   
   function reopen() {
       aconto.getElementById('dta').style.display='block';
       document.getElementById('atop').style.display='block';
       document.getElementById('backuptable').style.display='block';
   }
   
   function ourencodeURIComponent(incx) {
      return incx.replace(/\%0A/g,'').replace(/\%20/g,'+');
   }
   
   function appendthenfill(xnewwithwhat) {
     document.getElementById('tr' + currow).innerHTML+=celltemplate.replace(/1/g, '' + eval(1 + curcell));
     document.getElementById('trtdtd' + curcell).innerHTML=brize(decodeURIComponent(xnewwithwhat).replace(/\+/g,' '));
     curcell++;
     document.getElementById('curc').value='' + curcell;
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
   }

   function setlenthree(towhat, withwhat, three) {
     var newwithwhat=withwhat, onerec='';
     var minmaxlen=0, maxlen=0, irecs=0;
     var recs=[];
     
     if (withwhat.indexOf(String.fromCharCode(13) + String.fromCharCode(10)) != -1) {
       recs=withwhat.split(String.fromCharCode(13) + String.fromCharCode(10));
     } else if (withwhat.indexOf(String.fromCharCode(10) + String.fromCharCode(13)) != -1) {
       recs=withwhat.split(String.fromCharCode(10) + String.fromCharCode(13));
     } else if (withwhat.indexOf(String.fromCharCode(10)) != -1) {
       recs=withwhat.split(String.fromCharCode(10));
     } else if (withwhat.indexOf(String.fromCharCode(13)) != -1) {
       recs=withwhat.split(String.fromCharCode(13));
     } else {
       recs=[withwhat];
     } 
     //alert('' + recs[0].slice(-1).charCodeAt() + ' !' + recs[0] + '!');

     var recsextra=three.split(String.fromCharCode(10));
     for (irecs=0; irecs<recs.length; irecs++) {
        if (eval('' + recs[irecs].length) > maxlen) { maxlen=eval('' + recs[irecs].length);  }
        //if (eval('' + rtrim(recs[irecs]).length) > minmaxlen) { minmaxlen=eval('' + rtrim(recs[irecs]).length);  }
     }
     //alert('minmaxlen=' + minmaxlen + ' and maxlen=' + maxlen);
     if (minmaxlen != 0) { maxlen=minmaxlen; }
     eighty+=64;
     maxlen=eighty;
     document.getElementById('maxl').value='' + maxlen;
     newwithwhat='';
     while (eval('' + newwithwhat.length) < maxlen) {
       newwithwhat+=' ';
     }
     onerec=newwithwhat;
     newwithwhat='';
     for (irecs=0; irecs<recs.length; irecs++) {
        if (eval('' + recs[irecs].length) > maxlen) { 
          recs[irecs]=recs[irecs].substring(0,maxlen);
        }
        if (eval('' + recs[irecs].length) < maxlen) { 
          while (eval('' + recs[irecs].length) < maxlen) { 
            recs[irecs]+=' ';
          }
          if (eval('' + recsextra.length) > irecs) {
          newwithwhat+=recs[irecs] + recsextra[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
          console.log('recS[' + irecs + ']=' + recs[irecs] + recsextra[irecs]);
          } else {
          newwithwhat+=recs[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
          console.log('reCS[' + irecs + ']=' + recs[irecs]);
          }
        } else {
          if (eval('' + recsextra.length) > irecs) {
          newwithwhat+=recs[irecs] + recsextra[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
          console.log('rEcs[' + irecs + ']=' + recs[irecs] + recsextra[irecs]);
          } else {
          newwithwhat+=recs[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
          console.log('REcs[' + irecs + ']=' + recs[irecs]);
          }
        }
     }
     for (var jj=recs.length; jj<eval(recs.length + 100); jj++) {
        if (eval('' + recsextra.length) > jj) {
        newwithwhat+=onerec + recsextra[jj] + String.fromCharCode(13) + String.fromCharCode(10);
        } else {
        newwithwhat+=onerec + String.fromCharCode(13) + String.fromCharCode(10);
        }
     }
     if (aconto.getElementById('dta')) {
       gnewwithwhat=newwithwhat;
       //var woo=window.open('','_blank','top=10,left=10,width=500,height=500');
       //woo.document.write('<p>' + gnewwithwhat + '</p>');
       setTimeout(function(){ aconto.getElementById('dta').innerHTML=''; aconto.getElementById('dta').value=gnewwithwhat;  if (document.getElementById('nonct').outerHTML.split('>')[0].indexOf(' open') == -1) { aconto.getElementById('dta').style.display='none'; } }, 5000);
     } //else {
       //var woo=window.open('','_blank','top=10,left=310,width=500,height=500');
       //woo.document.write('<p>' + newwithwhat + '</p>');
     //}
     if (document.getElementById('outdrawing')) {
       document.getElementById('outdrawing').value=newwithwhat;
     }
     if (curcell == 1) {
       appendthenfill(encodeURIComponent(newwithwhat));
     }
     document.getElementById('atop').style.display='block';
     setTimeout(function(){ if (document.getElementById('nonct').outerHTML.split('>')[0].indexOf(' open') == -1) { aconto.getElementById('dta').style.display='none'; location.href='#atop'; } paddingtopit(); }, 1000); 
     return newwithwhat;
   }
   
   function atobmaybe(incx) {
     //alert(incx);
     if (incx.indexOf('PHR') == 0) {
       return window.atob(incx);
     }
     return incx;
   }
   
   function lhchk() {
     var allowanop=true;
     if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       try {
       document.getElementById('nonct').open=false;
       document.getElementById('nonct').removeAttribute('open');
       } catch(excsd) {
       document.getElementById('nonct').removeAttribute('open');
       }
       //document.getElementById('atop').style.display='block';
       document.getElementById('backuptable').style.display='block';
     }
     if (('' + document.URL + '#' + decodeURIComponent(decodeURIComponent('' + location.hash))).indexOf('cartoon=') != -1) {
        var wasdih=document.getElementById('divback').innerHTML;
        if (('' + document.URL).indexOf('cartoon=') != -1) {
        document.getElementById('divback').innerHTML=atobmaybe(decodeURIComponent(('' + document.URL).split('cartoon=')[1].replace(/^\=/g,'').split('&')[0].split('#')[0])).replace(/\+/g,' ');
   //alert(document.URL);
        } else {    
        document.getElementById('divback').innerHTML=atobmaybe(decodeURIComponent(('' + '#' + decodeURIComponent(decodeURIComponent('' + location.hash))).split('cartoon=')[1].replace(/^\=/g,'').split('#')[0])).replace(/\+/g,' ');
   //alert((decodeURIComponent(('' + '#' + decodeURIComponent(decodeURIComponent('' + location.hash))).split('cartoon=')[1].replace(/^\=/g,'').split('#')[0])).replace(/\+/g,' '));
        }
        if (document.getElementById('divback').innerHTML.trim() == '') {
          document.getElementById('divback').innerHTML=wasdih;
        } else {
         allowanop=false;
        }
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
        location.href='#divback';
     }
     paddingtopit();
     setTimeout(function(){ document.getElementById('backuptable').className='noclass';  }, 7000);
     if (isChromeWB && window.self == window.parent && allowanop) {
     anop(); //speechtotextwo=window.open('https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?mode=3', '_blank', 'top=0,left=' + eval(-300 + screenwidth) + ',width=300,height=500');
     } else {
     document.getElementById('spanspeak').style.display='inline';
     }
   }
   
   function paddingtopit() {
      var maxtwo=0, thistwo=0;
      var thhs=[], tdhs=[], it=0;
      var thdids=[];
      //trthtd1 
      //trtdtd1
      var tds=document.getElementsByTagName('td');
      for (it=0; it<tds.length; it++) {
         if (('' + tds[it].id).indexOf('trtdtd') != -1) {
           if (('' + tds[it].style.paddingTop).replace(/^null/g,'').replace(/^undefined/g,'').trim() != '') {
             tds[it].style.paddingTop='0px';
           }
         }
      }
      for (it=0; it<tds.length; it++) {
         if (('' + tds[it].id).indexOf('trtdtd') != -1) {
           tdhs.push(eval('' + tds[it].getBoundingClientRect().height));
           thdids.push('' + tds[it].id);
         }
      }
      var ths=document.getElementsByTagName('th');
      for (it=0; it<ths.length; it++) {
         if (('' + ths[it].id).indexOf('trthtd') != -1) {
           thhs.push(eval('' + ths[it].getBoundingClientRect().height));
           thistwo=eval(thhs[it] + tdhs[it]);
           if (thistwo > maxtwo) { maxtwo=thistwo; }
         }
      }
      for (it=0; it<tdhs.length; it++) {
           thistwo=eval(thhs[it] + tdhs[it]);
           if (thistwo < maxtwo) {
              document.getElementById(thdids[it]).style.paddingTop='' + eval(maxtwo - thistwo) + 'px';
           }
      }   
   }
   
   function showcartoon() {
        document.getElementById('atop').style.display='block';
        document.getElementById('backuptable').style.display='block';
        location.href='#divback';
   }

function tbg() {
  var ftdelim='';
  var finaltranscript='';
  if (document.getElementById('theblurbgoes').title != '' && 1 == 2) {
   if (document.getElementById('theblurbgoes').value.trim() != '') {
     finaltranscript=document.getElementById('theblurbgoes').value;
     document.getElementById('theblurbgoes').value='';
     if (window.opener) { 
      if (window.opener.document.getElementById('url')) { 
           if (('' + window.opener.document.getElementById('url').innerHTML.trim() + '~').indexOf((finaltranscript + '~')) == -1) {
           if (window.opener.document.getElementById('url').innerHTML != '' && window.opener.document.getElementById('url').innerHTML == top.opener.document.getElementById('url').innerHTML.trim() && finaltranscript.substring(0,1) != ' ') {
           ftdelim=' ';
           }
           console.log('Prehere with ' + finaltranscript);
           window.opener.document.getElementById('url').innerHTML=window.opener.document.getElementById('url').innerHTML + ftdelim + finaltranscript;
           console.log('Posthere with ' + finaltranscript);
           }
      }
     }
   }
   setTimeout(tbg,1000);
  }
}

</script>  
</head><body onload=\" lhchk(); initialtableih=document.getElementById('backuptable').innerHTML;\"><h1 id=myh1>Cow Says ...</h1><h3>RJM Programming - February, 2025 - <span id=spancartoon style=cursor:pointer; title='Show in Cartoon mode' onclick='showcartoon();' disabled>Cartoon&#128172;</span>&nbsp;<span id=spanspeak style=cursor:pointer;display:none; title='Show speaking window' onclick='anop();'>Speak&#128483;</span>&nbsp;<a style=display:none; id=aemail target=top href='mailto:?subject=Cartoon&body='>Email&#128231;</a>&nbsp;&nbsp;<a style=display:none; id=asms target=_top href='sms:&body='>SMS&#128223;</a></h3><h4>Thanks to <a target=_blank title='https://pypi.org/project/cowsay/' href='//pypi.org/project/cowsay/'>https://pypi.org/project/cowsay/</a></h4><form onsubmit=\"document.getElementById('myiframe').style.display='block'; return true;\" target=myiframe method=POST action='/cowsay.php'><input type=hidden name=curc id=curc value=1></input><input type=hidden name=maxl id=maxl value=0></input><sup style=vertical-align:top;>\"</sup><textarea style=\"display:none;font-family:'Courier New',Courier,monospace;\" id=outdrawing name=outdrawing></textarea><textarea placeholder=\"In cartoon section, double click horizontally reverses, and right click vertically topples, and wording above is editable.\" style=\"font-family:'Courier New',Courier,monospace;\" data-id=myta id=url cols=50 rows=5 name=inwords></textarea><sup style=vertical-align:top;>\"</sup>&nbsp;&nbsp;&#128488;&nbsp;<select style=display:inline-block;background-color:lightgreen; name=chr>
<option value='cow'>Cow</option>
<option value='beavis'>Beavis</option>
<option value='cheese'>Cheese</option>
<option value='daemon'>Daemon</option>
<option value='dragon'>Dragon</option>
<option value='fox'>Fox</option>
<option value='ghostbusters'>Ghostbusters</option>
<option value='kitty'>Kitty</option>
<option value='meow'>Meow</option>
<option value='miki'>Miki</option>
<option value='milk'>Milk</option>
<option value='octopus'>Octopus</option>
<option value='pig'>Pig</option>
<option value='stegosaurus'>Stegosaurus</option>
<option value='stimpy'>Stimpy</option>
<option value='trex'>TRex</option>
<option value='turkey'>Turkey</option>
<option value='turtle'>Turtle</option>
<option value='tux'>Tux</option>
   </select><br><br><input type=submit value='Cow Says ...' style=background-color:lightblue;></input>&nbsp;&nbsp;<input type=submit value='Cow Says ... and ...' style=background-color:orange; name=and></input></form><br><br><details onclick=reopen(); id=nonct open><summary id=mysum></summary><iframe onload=chkit(this); name=myiframe id=myiframe frameborder=0 style=display:none;width:100%;height:100%; src='/About_Us.html'></iframe></details><br>
<div id=divback>
<a style=display:none; id=atop href='#myh1'>Back to top ...</a>
<table tabspacing=0 tabpadding=0 id=backuptable style=\"display:" . $maybenone . ";font-family:Courier New,Courier,monospace;font-size:6px;\">
<tbody id=tbod>
<tr id=\"tr1\">" . $celltemplate . "</tr>
</tbody>
</table>
</div>
</body></html>";
?>