<?php
// family_tree.php
// RJM Programming
// September, 2024
// Trying out Python GraphViz package ... thanks to https://forum.graphviz.org/t/emojis-not-working/1935/2

  $abl=['my_family_tree',"\"Malik✅\", \"Cecil\", \"Sultan\"","\"Mehwish\", \"Miriam\", \"Sultana\"","\"Malik✅\": [\"Sultan\", \"Usman\"], \"Cecil\": [\"Margaret\", \"Christina\"], \"Sultan\": [\"Lilly\", \"Adam\"]"];
  $newabl=['my-family-tree',"\"Malik✅\", \"Cecil\", \"Sultan\"","\"Mehwish\", \"Miriam\", \"Sultana\"","\"Malik✅\": [\"Sultan\", \"Usman\"], \"Cecil\": [\"Margaret\", \"Christina\"], \"Sultan\": [\"Lilly\", \"Adam\"]"];

  $prefix='';
  $suffix='';
  $plus='<span id=plus>-</span>';
  $minus='<span id=minus>-</span>';
  $plus='<span ondblclick=domore(2); onclick=domore(1); id=plus>-</span>';
  $minus='<span ondblclick=domore(-2); onclick=domore(-1); id=minus>-</span>';
  $yes='n';
  $fmt='svg';
  $mode='Digraph';
  $shape='';
  $fsize='';
  $bcol='lightblue2';
  $bbcol='#aed8e8';
  $newt='';
  $newablzero='My%20Family%20Tree';
  $outfn='';
  $gv='.gv.';
  
  $addimg='';
  
  function plusdata($aig) {
   $outig=$aig;
   $dlm='"';
   $outgs=explode('data:', $aig);
   if (sizeof($outgs) > 1) {
     $outig=$outgs[0];
     $dlm=substr($outig,-1,1);
     for ($iop=1; $iop<sizeof($outgs); $iop++) {
       $outig.='data:' . str_replace(explode($dlm,$outgs[$iop])[0],  str_replace('%20','+',str_replace(' ','+',explode($dlm,$outgs[$iop])[0]))  ,$outgs[$iop]); 
     }
   }
   return $outig;
  }

  
  function ourfile_exists($infn) {
   global $outfn, $gv;
   $retv=file_exists($infn);
   if ($retv && strpos($infn, '.svg') !== false && 1 == 2) {
     exec('chmod 777 ' . $infn);
     exec('chown rjmprogr ' . $infn);
     exec('chgrp rjmprogr ' . $infn);
     $retc=file_get_contents($infn);
     $gv='.GV.';
     $outfn=str_replace('.gv.','.GV.',$infn);
     file_put_contents($outfn, str_replace('<g id=', '<g onclick="parent.svgit(this);" id=', $infn));
     exec('chmod 777 ' . $outfn);
     exec('chown rjmprogr ' . $outfn);
     exec('chgrp rjmprogr ' . $outfn);
   }
   return $retv;
  }
  
  $nondefshapes=str_replace("\n","","
  
<option value=box>Box</option>
 

<option value=polygon>Polygon</option>
 

<option value=ellipse>Ellipse</option>
 

<option value=oval>Oval</option>
 

<option value=circle>Circle</option>
 

<option value=point>Point</option>
 

<option value=egg>Egg</option>
 

<option value=triangle>Triangle</option>
 

<option value=plaintext>Plaintext</option>
 

<option value=plain>Plain</option>
 

<option value=diamond>Diamond</option>
 

<option value=trapezium>Trapezium</option>
 

<option value=parallelogram>Parallelogram</option>
 

<option value=house>House</option>
 

<option value=pentagon>Pentagon</option>
 

<option value=hexagon>Hexagon</option>
 

<option value=septagon>Septagon</option>
 

<option value=octagon>Octagon</option>
 

<option value=doublecircle>Doublecircle</option>
 

<option value=doubleoctagon>Doubleoctagon</option>
 

<option value=tripleoctagon>Tripleoctagon</option>
 

<option value=invtriangle>Invtriangle</option>
 

<option value=invtrapezium>Invtrapezium</option>
 

<option value=invhouse>Invhouse</option>
 

<option value=Mdiamond>Mdiamond</option>
 

<option value=Msquare>Wsquare</option>
 

<option value=Mcircle>Mcircle</option>
 

<option value=rect>Rect</option>
 

<option value=rectangle>Rectangle</option>
 

<option value=square>Square</option>
 

<option value=star>Star</option>
 

<option value=none>None</option>
 

<option value=underline>Underline</option>
 

<option value=cylinder>Cylinder</option>
 

<option value=note>Note</option>
 

<option value=tab>Tab</option>
 

<option value=folder>Folder</option>
 

<option value=box3d>Box3d</option>
 

<option value=component>Component</option>
 

<option value=promoter>Promoter</option>
 

<option value=cds>Cds</option>
 

<option value=terminator>Terminator</option>
 

<option value=utr>Utr</option>
 

<option value=primersite>Primersite</option>
 

<option value=restrictionsite>Restrictionsite</option>

<option value=fivepoverhang>Fivepoverhang</option>
 

<option value=threepoverhang>Threepoverhang</option>
 

<option value=noverhang>Noverhang</option>
 

<option value=assembly>Assembly</option>
 

<option value=signature>Signature</option>
 

<option value=insulator>Insulator</option>
 

<option value=ribosite>Ribosite</option>
 

<option value=rnastab>Rnastab</option>
 

<option value=proteasesite>Proteasesite</option>
 

<option value=proteinstab>Proteinstab</option>
 

<option value=rpromoter>Rpromoter</option>
 

<option value=rarrow>Rarrow</option>
 

<option value=larrow>Larrow</option>
 

<option value=lpromoter>Lpromoter</option>");
  
  $pyprefix='';
  $pymidbit='';
  $pysuffix='';
  
function server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    return str_replace('.','_',$rma);
}

  if (!isset($_POST['one']) && !isset($_POST['two']) && !isset($_POST['three']) && !isset($_POST['original'])) {
    $yes='y';
    $newabl[1]='';
    $newabl[2]='';
    $newabl[3]='';
    $_POST['one']=$newabl[1];
    $_POST['two']=$newabl[2];
    $_POST['three']=$newabl[3];
  } else {
    $plus='<span title=Bigger ondblclick=domore(2); onclick=domore(1); style=cursor:pointer;text-decoration:underline; id=plus>+</span>';
    $minus='<span title=Smaller ondblclick=domore(-2); onclick=domore(-1); style=cursor:pointer;text-decoration:underline; id=minus>-</span>';
  }

  if (isset($_POST['title'])) {
  $newabl[0]=trim(str_replace('+',' ',urldecode($_POST['title'])));
  $newablzero=str_replace('+','%20',urlencode($newabl[0]));
  } else if (!isset($_POST['original'])) {
  $_POST['title']=$newabl[0];
  }
  
    
  if (strpos($newabl[0], 'amily') !== false) {
     $parts=explode('-',str_replace('_','-',$newabl[0]));
     $newt='';
     for ($iy=0; $iy<sizeof($parts); $iy++) {
       $newt.=strtoupper(substr($parts[$iy],0,1)) . strtolower(substr($parts[$iy],1)) . ' ';
     }
  }


  if (isset($_POST['fmt'])) {
  $fmt=trim(str_replace('+',' ',urldecode($_POST['fmt'])));
  } else if (!isset($_POST['original'])) {
  $_POST['fmt']='svg';
  }

  if (isset($_POST['addimg'])) {
  $addimg=plusdata(str_replace('+',' ',urldecode($_POST['addimg'])));
  } else if (!isset($_POST['original'])) {
  $_POST['addimg']='';
  }

  if (isset($_POST['mode'])) {
  $mode=trim(str_replace('+',' ',urldecode($_POST['mode'])));
  } else if (!isset($_POST['original'])) {
  $_POST['mode']='Digraph';
  }

  if (isset($_POST['back'])) {
  $bcol=trim(str_replace('+',' ',urldecode($_POST['back'])));
  if (strlen($bcol) == 6) { $bcol='#' . trim(str_replace('+',' ',urldecode($_POST['back']))); $bbcol=$bcol;  } else if (strlen($bcol) == 7) { $bbcol=$bcol;  }
  } else if (!isset($_POST['original'])) {
  $_POST['back']='lightblue2';
  }

  if (isset($_POST['shape'])) {
  $shape=trim(str_replace('+',' ',urldecode($_POST['shape'])));
  } else if (!isset($_POST['original'])) {
  $_POST['shape']='';
  }

  if (isset($_POST['fsize'])) {
  $fsize=trim(str_replace('+',' ',urldecode($_POST['fsize'])));
  } else if (!isset($_POST['original'])) {
  $_POST['fsize']='';
  }
   
  if (isset($_POST['one']) && isset($_POST['two']) && isset($_POST['three'])) {
  $prefix=$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR; //'/tmp/';
  $newabl[1]=str_replace('+',' ',urldecode(str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one']))));
  $newabl[2]=str_replace('+',' ',urldecode(str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['two']))));
  $newabl[3]=str_replace('+',' ',urldecode(str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['three']))));
  $pycont=file_get_contents('./family_tree.py');

  if (trim($newt) != '') {
     $newablzero=str_replace('+','%20',urlencode(trim($newt)));
     $pycont=str_replace("My Family Tree", trim($newt), $pycont);
  }

  if (strpos($pycont, 'u=u') !== false) {
  $pyprefix=explode('u.edge(', $pycont)[0];
  $pysuffix='' . explode('u=u', $pycont)[1];
  //$pysuffix='' . explode('u.view()', $pycont)[1];
  $pycont=$pyprefix . "\n\n" . $pysuffix;
  } else if (strpos($pycont, 'u.view()') !== false) {
  $pyprefix=explode('u.edge(', $pycont)[0];
  $pysuffix='u.view()' . explode('u.view()', $pycont)[1];
  //$pysuffix='' . explode('u.view()', $pycont)[1];
  $pycont=$pyprefix . "\n\n" . $pysuffix;
  }
  
  if ($bcol != 'lightblue2' && trim($bcol) != '') {
    $pycont=str_replace('lightblue2', $bcol, $pycont);
  }
  
  if ($shape != '') {
    $pycont=str_replace("'shape': 'record'", "'shape': '" . $shape . "'", $pycont);
  }
  
  if ($fsize != '') {
    $pycont=str_replace("'6,6'", "'" . $fsize . "'", $pycont);
  }
  
  //$xone=str_replace("\t","+", str_replace('~','',   str_replace('+',' ',str_replace('+|','`|',str_replace('+;','`;',str_replace('+;','`;',str_replace('+,','`,',urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one'])) . urlencode('~'))) ))) )));
  //$xtwo=str_replace("\t","+", str_replace('~','',   str_replace('+',' ',str_replace('+|','`|',str_replace('+;','`;',str_replace('+;','`;',str_replace('+,','`,',urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['two'])) . urlencode('~'))) ))) )));
  //$xthree=str_replace("\t","+", str_replace('~','',   str_replace('+',' ',str_replace('+|','`|',str_replace('+;','`;',str_replace('+;','`;',str_replace('+,','`,',urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['three'])) . urlencode('~'))) ))) )));
  //$xone=str_replace("\t","+", str_replace('+',' ',(urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one']))))));
  //$xtwo=str_replace("\t","+", str_replace('+',' ',(urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['two']))))));
  //$xthree=str_replace("\t","+", str_replace('+',' ',(urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['three']))))));
  $xone=str_replace('+',' ',(urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one'])))));
  $xtwo=str_replace('+',' ',(urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['two'])))));
  $xthree=str_replace('+',' ',(urldecode(  str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['three'])))));
  
  $pycont=str_replace($abl[1], $xone, $pycont);
  $pycont=str_replace($abl[2], $xtwo, $pycont);
  $pycont=str_replace($abl[3], $xthree, $pycont);
  
  $pycont=str_replace($abl[0], $newabl[0], $pycont);
  if ($fmt != 'svg') {
     $pycont=str_replace("format='svg'", "format='" . $fmt . "'", $pycont);
  }
  
  if (strpos($newabl[0], 'amily') !== false) {
     $parts=explode('-',str_replace('_','-',$newabl[0]));
     $newt='';
     for ($iy=0; $iy<sizeof($parts); $iy++) {
       $newt.=strtoupper(substr($parts[$iy],0,1)) . strtolower(substr($parts[$iy],1)) . ' ';
     }
     if (trim($newt) != '') {
     $pycont=str_replace("My Family Tree", trim($newt), $pycont);
     }
  }
  
  $pycont=str_replace('doctest-output', $prefix . 'doctest-output', $pycont);
  
  if ($mode != 'Digraph' && trim($mode) != '') {
    $pycont=str_replace('Digraph', '' . $mode . '', $pycont);
  }

  if ($yes != 'y') { // use crontab 
  $suffix='_' . server_remote_addr();
  file_put_contents($prefix . 'family_tree_' . $suffix . '.py', $pycont);
  //file_put_contents($prefix . 'family_tree0_' . $suffix . '.py', $pycont);
  //file_put_contents($prefix . 'family_tree_' . $suffix . '.ksh', "#!/bin/ksh\n/usr/bin/python3 " . $prefix . "family_tree_" . $suffix . ".py >> " . $prefix . "family_tree.good 2>> " . $prefix . "family_tree.bad \nln -s " . $prefix . "doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . ".gv.pdf " . $_SERVER['DOCUMENT_ROOT'] .  DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . ".gv.pdf \nrm -f " . $prefix . "family_tree_" . $suffix . ".py \nrm -f " . $prefix . "family_tree_" . $suffix . ".ksh \nexit");
  file_put_contents($prefix . 'family_tree_' . $suffix . '.ksh', "#!/bin/ksh\n/usr/bin/python3 " . $prefix . "family_tree_" . $suffix . ".py >> " . $prefix . "family_tree.good 2>> " . $prefix . "family_tree.bad \nsleep 5\n\n/usr/bin/python3 " . $prefix . "family_tree_" . $suffix . ".py >> " . $prefix . "family_tree.good 2>> " . $prefix . "family_tree.bad \n\nrm -f " . $prefix . "family_tree_" . $suffix . ".py \nrm -f " . $prefix . "family_tree_" . $suffix . ".ksh \nexit");
  //file_put_contents($prefix . 'family_tree0_' . $suffix . '.ksh', "#!/bin/ksh\n/usr/bin/python3 " . $prefix . "family_tree_" . $suffix . ".py >> " . $prefix . "family_tree.good 2>> " . $prefix . "family_tree.bad \nsleep(5)\n\n/usr/bin/python3 " . $prefix . "family_tree_" . $suffix . ".py >> " . $prefix . "family_tree.good 2>> " . $prefix . "family_tree.bad \n\n\nrm -f " . $prefix . "family_tree_" . $suffix . ".py \nrm -f " . $prefix . "family_tree_" . $suffix . ".ksh \nexit");
  exec('chmod 777 ' . $prefix . 'family_tree_' . $suffix . '.ksh');
  exec('chown root ' . $prefix . 'family_tree_' . $suffix . '.ksh');
  exec('chgrp root ' . $prefix . 'family_tree_' . $suffix . '.ksh');
  while (file_exists($prefix . 'family_tree_' . $suffix . '.ksh')) {
    sleep(10);
  }
  } else {
  file_put_contents('/tmp/family_tree.py', $pycont);
  exec('chmod 777 ' . '/tmp/family_tree.py');
  exec('chown rjmprogr ' .'/tmp/family_tree.py');
  exec('chgrp rjmprogr ' . '/tmp/family_tree.py');
  //if (file_exists('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf')) {
    //exec('rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf');
    //exec('rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
    //unlink('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf');
    //unlink('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
  //}
  exec('/usr/bin/python3 /tmp/family_tree.py > family_tree.good 2> family_tree.bad');
  sleep(8);
  //if (file_exists($prefix . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf')) {
  //exec('ln -s ' . $prefix . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf ' . $_SERVER['DOCUMENT_ROOT'] .  DIRECTORY_SEPARATOR . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf');
  //}
  }
  } else {
  exec('/usr/bin/python3 family_tree.py');
  sleep(8);
  }
    
  if (ourfile_exists($prefix . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.' . $fmt)) {
     exec('chmod 777 ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt);
     exec('chmod 777 ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
     exec('chown rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt);
     exec('chown rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
     exec('chgrp rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt);
     exec('chgrp rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
     echo "<html>
<head>
<title>Trying out Python GraphViz hosted in PHP - RJM Programming - September, 2024 - Family Tree</title>
<scr" . "ipt type=text/javascript>
 var lasturl='', lasttext=null, gzero=null, lastx=0, lasty=0, lastw=0, lasth=0, lastp='', lastiurl='', szero=null, aimg='', lastimgc='', lastsvggeo=null, uselast=false;
 
String.prototype.toHtmlEntities = function() {
  return this.replace(/./gm, function(s) {
    return (s.match(/[a-z0-9\s]+/i)) ? s : '&#' + s.charCodeAt(0) + ';';
  });
};

 function plusdata(aig) {
   var outig=aig, dlm='\"';
   var outgs=aig.split('data:');
   if (eval('' + outgs.length) > 1) {
     outig=outgs[0];
     dlm=outig.slice(-1);
     for (var iop=1; iop<outgs.length; iop++) {
       if (outgs[iop].split(dlm)[0] != outgs[iop].split(dlm)[0].replace(/\ /g,'+').replace(/\%20/g,'+')) {
         alert('Found');
       }
       outig+='data:' + outgs[iop].replace(outgs[iop].split(dlm)[0], outgs[iop].split(dlm)[0].replace(/\ /g,'+').replace(/\%20/g,'+'));
     }
   }
   return outig;
 }
 
 function ph() {
   var aplace='';

   aimg=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('addimg=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('addimg=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (aimg != '') { document.getElementById('addimg').value=plusdata(aimg);  } 

   // one
   aplace='" . $abl[1] . "';   //'5th Edition;6th Edition,PWB 1.0|6th Edition;LSX,1 BSD,Mini Unix,Wollongong,Interdata|Interdata;Unix/TS 3.0,PWB 2.0,7th Edition';
   document.getElementById('one').placeholder=aplace;
   // two
   aplace='" . $abl[2] . "';   //'7th Edition;8th Edition,32V,V7M,Ultrix-11,Xenix,UniPlus+|V7M;Ultrix-11';
   document.getElementById('two').placeholder=aplace;
   // three
   aplace='" . $abl[3] . "';   //'8th Edition;9th Edition|1 BSD;2 BSD|2 BSD;2.8 BSD|2.8 BSD;Ultrix-11,2.9 BSD|32V;3 BSD|3 BSD;4 BSD|4 BSD;4.1 BSD|4.1 BSD;4.2 BSD|4.2 BSD;4.3 BSD,Ultrix-32|PWB 1.0;PWB 1.2,USG 1.0|PWB 1.2;PWB 2.0|USG 1.0;CB Unix 1,USG 2.0|CB Unix 1;CB Unix 2|CB Unix 2;CB Unix 3|CB Unix 3;Unix/TS++,PDP-11 Sys V|USG 2.0;USG 3.0|USG 3.0;Unix/TS 3.0|PWB 2.0;Unix/TS 3.0|Unix/TS 1.0;Unix/TS 3.0|Unix/TS 3.0;TS 4.0|Unix/TS++;TS 4.0|CB Unix 3;TS 4.0|TS 4.0;System V.0|System V.0;System V.2|System V.2;System V.3';
   document.getElementById('three').placeholder=aplace;
   
   var asize=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fsize=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fsize=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (asize != '') { document.getElementById('fsize').value=asize; } else if ('" . $fsize . "' != '') {  document.getElementById('fsize').value='" . $fsize . "';   } 
   var ashape=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('shape=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('shape=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (ashape != '') { document.getElementById('shape').value=ashape; } else if ('" . $shape . "' != '') {  document.getElementById('shape').value='" . $shape . "';   } 
   var acol=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('back=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('back=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (acol != '') { if (('' + acol.length) == '6') { document.getElementById('back').value='#' + acol; } else { document.getElementById('back').value='' + acol;   }    }
   var amode=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('mode=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('mode=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (amode != '') { document.getElementById('mode').value=amode;   }
   var atitle=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('title=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('title=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (atitle != '') { document.getElementById('ititle').value=atitle;   }
   var aone=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('one=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('one=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (aone != '') { document.getElementById('plus').title='Smaller';  document.getElementById('minus').style.cursor='Pointer'; document.getElementById('minus').style.textDecoration='underline';  document.getElementById('plus').title='Bigger';  document.getElementById('plus').style.cursor='Pointer'; document.getElementById('plus').style.textDecoration='underline';  document.getElementById('plus').innerHTML='+';  while (aone.indexOf(String.fromCharCode(9)) != -1) { aone=aone.replace(String.fromCharCode(9),'+');  }  document.getElementById('one').value=aone;   document.getElementById('none').value=aone;   }
   var atwo=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('two=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('two=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (atwo != '') {  while (atwo.indexOf(String.fromCharCode(9)) != -1) { atwo=atwo.replace(String.fromCharCode(9),'+');  } document.getElementById('two').value=atwo;   document.getElementById('ntwo').value=atwo;   }
   var athree=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('three=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('three=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (athree != '') { while (athree.indexOf(String.fromCharCode(9)) != -1) { athree=athree.replace(String.fromCharCode(9),'+');  }  document.getElementById('three').value=athree;   document.getElementById('nthree').value=athree;   }
   var afmt=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fmt=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fmt=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : 'svg';
   if (afmt != '' && document.getElementById('one').value != '') { document.getElementById('fmt').value=afmt;   }
   if (('' + location.hash).indexOf('title=') != -1 && atitle.trim() != '' && aone.trim() != '') {
     document.getElementById('mysub').click();
   }
  }
  
  function phv(tao) {
    if (tao.value == '') {
      tao.value=tao.placeholder;
    }
  }
  
  function various(indi) {
    var outdi=indi;
    outdi=outdi.replace(/\|\;/g, encodeURIComponent('|') + ';');
    outdi=outdi.replace(/\,\;/g, encodeURIComponent(',') + ';');
    outdi=outdi.replace(/\;\;/g, encodeURIComponent(';') + ';');

    outdi=outdi.replace(/\|\,/g, encodeURIComponent('|') + ',');
    outdi=outdi.replace(/\,\,/g, encodeURIComponent(',') + ',');
    outdi=outdi.replace(/\;\,/g, encodeURIComponent(';') + ',');

    outdi=outdi.replace(/\|\|/g, encodeURIComponent('|') + '|');
    outdi=outdi.replace(/\,\|/g, encodeURIComponent(',') + '|');
    outdi=outdi.replace(/\;\|/g, encodeURIComponent(';') + '|');

    return outdi;
  }
  
  function contentfix(inid) {
    document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
    //document.getElementById('one').value=document.getElementById('one').value.replace(/\+/g,'`');
    //document.getElementById('two').value=document.getElementById('two').value.replace(/\+/g,'`');
    //document.getElementById('three').value=document.getElementById('three').value.replace(/\+/g,'`');
    document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
    return inid;
  }


function emailit(inais) {
   event.stopPropagation();
   var em=null;
   window.focus(); 
   em=prompt('Please enter email address to send output ' + document.getElementById('fmt').value + ' URL link to.', '');
   if (em == null) { em=''; }
   if (em.indexOf('@') != -1) {
    document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
    document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
    //alert(document.getElementById('addimg').value);
     em+='?subject=' + document.getElementById('newablzero').value + '&body=' + encodeURIComponent( (document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19897865) + '#title=' + encodeURIComponent(document.getElementById('ititle').value) + '#back=' + encodeURIComponent(document.getElementById('back').value.replace('#','')) + '#fsize=' + encodeURIComponent(document.getElementById('fsize').value) + '#shape=' + encodeURIComponent(document.getElementById('shape').value) + '#mode=' + encodeURIComponent(document.getElementById('mode').value) + '#fmt=' + encodeURIComponent(document.getElementById('fmt').value) + '#one=' + encodeURIComponent(document.getElementById('none').value) + '#two=' + encodeURIComponent(document.getElementById('ntwo').value) + '#three=' + encodeURIComponent(document.getElementById('nthree').value) + '#addimg=' + encodeURIComponent(document.getElementById('addimg').value)).replace('#fmt=svg#one=#','#fmt=pdf#one=#')   );
     document.getElementById('dimap').innerHTML='<a style=display:none; id=theaemail target=_blank href=\"mailto:' + em + '\">Email</a>';
     document.getElementById('theaemail').click();
   } 
   return false;
}

function svghost(svgheo, imgc) {
 if (9 == 8) {
 if (gzero) {
  gzero.innerHTML+=\"<image x='0' y='0' href='/camel.png'></image>\";  
 } else {
  svgheo.innerHTML+=\"<image x='0' y='0' href='/camel.png'></image>\"; 
 }
 }
}

function psvgit() {
  svgit(lastsvgeo, lastimgc);
}

function svgit(svgeo, imgc) {
  var pres='';
  lastsvgeo=svgeo;
  lastimgc=imgc;
  if (('' + svgeo.outerHTML).indexOf('<text') == 0) {
   if ((svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]).replace('%20',' ').replace('+',' ').indexOf(' ') != -1 && lasturl != '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])) {    
     lasturl='//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])
     window.open('//www.google.com/search?sca_esv=8957a51bd870705f&sxsrf=ADLYWIL9Z95Y2XILCVHy1Ep_vA8UA0HVLw:1728014294038&q=' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]) + '&udm=2&fbs=AEQNm0CrHVBV9axs7YmgJiq-TjYcvrKLYvLdNLLD2b8MCfaxte6rE3yH_shvJRqV-Iqr8JJvO9luGxMyf8tABHRE_ER5WVi_ouuYD0ZGCgonp8RpBmOUpTB-X6dVFbJc8KMdvjlHxs0_OJiYCY4-Y60oHTMiC_1a9mkGkMIYHO4XqP68ipa4P5rJaQCtA4WPne6f0aAKhdyAMTPbTsWJEdFYpNvI5RzOgw&sa=X&ved=2ahUKEwjCwabx6vOIAxWJ7DQHHQIOJBoQtKgLegQIDRAB&biw=1433&bih=739&dpr=2', '_blank', 'top=100,left=' + eval(-600 + screen.width) + ',width=600,height=600');
     window.focus();
     uselast=true; 
     setTimeout(psvgit, 2000);
     return '';
   }  
   lasttext=svgeo;
   if (lastiurl.indexOf(\"<image x='\" + svgeo.getAttribute('x') + \"' y='\" + svgeo.getAttribute('y')) == -1 && (imgc == 'ask' || lasturl == '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]))) {
    if (('' + svgeo.getAttribute('width')).indexOf('null') != -1) {
    lastiurl=\"<image x='\" + eval(-20 + eval('' + svgeo.getAttribute('x'))) + \"' y='\" + eval(-20 + eval('' + svgeo.getAttribute('y'))) + \"' width='45' height='45' opacity='0.6' href=''></image>\"; 
    } else {
    lastiurl=\"<image x='\" + svgeo.getAttribute('x') + \"' y='\" + svgeo.getAttribute('y') + \"' opacity='0.6' width='\" + svgeo.getAttribute('width') + \"' height='\" + svgeo.getAttribute('height') + \"' href=''></image>\"; 
    }
    window.focus();
    pres=null;
    try { 
    if (lastp != 'Regarding ' + svgeo.innerHTML + ' please enter an optional image URL') {
    pres=prompt('Regarding ' + svgeo.innerHTML + ' please enter an optional image URL', '');
    }
    } catch(exc) {
    console.log('error');
    }
    if (pres == null) { console.log('err'); pres=''; if (uselast) { setTimeout(psvgit, 2000);  } } else { uselast=false;  lastp='Regarding ' + svgeo.innerHTML + ' please enter an optional image URL';  }
    if (pres != '') {
      uselast=false;
      lastp='Regarding ' + svgeo.innerHTML + ' please enter an optional image URL';
      lastiurl=lastiurl.replace(\" href=''\", \" href='\" + pres + \"'\");
      if (gzero) {
       //alert(\"<image x='0' y='0' width='45' height='45' href=\" + lastiurl.split('href=')[1]);
       //gzero.innerHTML+=\"<image x='0' y='0' width='45' height='45' href=\" + lastiurl.split('href=')[1]; //.replace(/\-/g,'');  
       //if (document.getElementById('addimg').value == '') {
       //  document.getElementById('addimg').value=' gzero.innerHTML+=\"\"; ';
       //} 
       document.getElementById('addimg').value+=lastiurl;
       //alert(document.getElementById('addimg').value);
       gzero.innerHTML+=lastiurl;
      }      
    }
   }
   if (lasturl != '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])) {
    lasturl='//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])
    if (('' + svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]).replace('%20',' ').replace('+',' ').indexOf(' ') == -1) {
    setTimeout(function(){ window.open(lasturl, '_blank', 'top=100,left=' + eval(-600 + screen.width) + ',width=600,height=600'); }, 3000);
    } else {
    lasturl+=' ';
    }
    //svgeo.innerHTML+='</text><text>+';
   }
  }
  if (1 == 2) {
   svgeo.innerHTML+='+';
   alert('' + svgeo.outerHTML);
  }
}

function naz(intvo) {
  var intv=intvo.value;
  var retval='My%20%Family%20Tree';
  var jntv=intv.replace(/\ /g,'-').replace(/\_/g,'-');
  var jst=jntv.split('-');
  if (jntv.indexOf('amily') != -1) {
    retval=jst[0].substring(0,1).toUpperCase() + jst[0].substring(1).toLowerCase() + ' ';
    for (var ij=1; ij<jst.length; ij++) {
      retval+=jst[ij].substring(0,1).toUpperCase() + jst[ij].substring(1).toLowerCase() + ' ';
    }
    retval=encodeURIComponent(retval.trim());
  }
  document.getElementById('newablzero').value=retval;
  return retval;
}

function smsit(inais) {
   event.stopPropagation();
   var em=null;
   window.focus(); 
   em=prompt('Please enter SMS number to send output ' + document.getElementById('fmt').value + ' URL link to.', '');
   if (em == null) { em=''; }
   if (em.trim() != '') {
     if (em.trim() != '') {
    document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
    document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
     em+='&body=' + encodeURIComponent( (document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19897865) + '#title=' + encodeURIComponent(document.getElementById('ititle').value) + '#back=' + encodeURIComponent(document.getElementById('back').value.replace('#','')) + '#fsize=' + encodeURIComponent(document.getElementById('fsize').value) + '#shape=' + encodeURIComponent(document.getElementById('shape').value) + '#mode=' + encodeURIComponent(document.getElementById('mode').value) + '#fmt=' + encodeURIComponent(document.getElementById('fmt').value) + '#one=' + encodeURIComponent(document.getElementById('none').value) + '#two=' + encodeURIComponent(document.getElementById('ntwo').value) + '#three=' + encodeURIComponent(document.getElementById('nthree').value) + '#addimg=' + encodeURIComponent(document.getElementById('addimg').value)).replace('#fmt=svg#one=#','#fmt=pdf#one=#')    );
     document.getElementById('dimap').innerHTML='<a style=display:none; id=theasms target=_blank href=\"sms:' + em + '\">SMS</a>';
     if (!document.getElementById('theasms') && document.getElementById('psms')) {
     document.getElementById('psms').click();
     } else {
     document.getElementById('theasms').click();
     }
     }
   }
   return false;
}

function sz(inum) {
  var uni='px';
  if (szero) {
    if (('' + szero.getAttribute('width')).indexOf('pt') != -1) { uni='pt'; } else if (('' + szero.getAttribute('width')).indexOf('%') != -1) { uni='%'; }
    szero.setAttribute('width', '' + ('' + eval(eval('' + szero.getAttribute('width').split(uni)[0])) * eval('' + inum)) + uni);
    szero.setAttribute('height', '' + ('' + eval(eval('' + szero.getAttribute('height').split(uni)[0])) * eval('' + inum)) + uni);
  }
}

function domore(hm) {
  var rectis=document.getElementById('myif').getBoundingClientRect();
  if (('' + hm) == '1') {
    document.getElementById('rtd').style.width='20%';
    document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(1.1)) + 'px';
    document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 1.1) + 'px';
  } else if (('' + hm) == '-1') {
    document.getElementById('rtd').style.width='50%';
    document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(0.9)) + 'px';
    document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 0.9) + 'px';
  } else if (('' + hm) == '-2') {
    document.getElementById('rtd').style.width='50%';
    document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(0.8)) + 'px';
    document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 0.8) + 'px';
  } else {
    document.getElementById('rtd').style.width='20%';
    document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(1.2)) + 'px';
    document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 1.2) + 'px';
  }
}

function checksvg(iois) {
  var gs=[];
  if (iois != null) { // check out window.svgDocument
    var aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
       //alert(1);
       if (aconto.document) {  
         aconto = aconto.document; 
         gs=aconto.getElementsByTagName('g'); 
         if (eval('' + gs.length) > 0) {
           gzero=gs[0];
           for (var sd=0; sd<gs.length; sd++) {
              gs[sd].onclick=function(event){ parent.svgit(event.target, '');  };
              gs[sd].ondblclick=function(event){ parent.svgit(event.target, 'ask');  };
           }
         }
         gs=aconto.getElementsByTagName('svg'); 
         if (eval('' + gs.length) > 0) {
           szero=gs[0];
           for (var sd=0; sd<gs.length; sd++) {
              gs[sd].onclick=function(event){ parent.svghost(event.target, '');  };
           }
         }
         console.log(gs.length); 
         console.log(aconto); 
       }
       //alert(11);
       if (aconto.body != null) {
         iois=iois;
         //alert('yay!');
       }
    }
    if (gzero) {
      gzero=gzero;
      " . (strlen($addimg) == 0 ? $addimg : ' gzero.innerHTML+="' . $addimg . '"') . "
      if (aimg != '') { eval(' gzero.innerHTML+=\"' + aimg + '\"');  }
    }  
  }
}

</scr" . "ipt>
<style>
  body { background-color: #e0f0d0; }
  textarea { 
     width: 99%;
     height: 90px;
  }

</style>
</head>
<body  title='Click on a GraphViz SVG node, and if the associated name has a space, a Google image search will appear (and any Right Click initiated Copy Image Address option might suit, in terms of a later Paste) before a prompt window asking about any relevant optional image URL, else a name lookup webpage will appear after the prompt window.' onload=ph();>
<h1>Trying out Python GraphViz hosted in PHP " . $plus . " Family Tree  <a id=pemail title=Email class=share  onclick=emailit(this); style=text-decoration:none;cursor:pointer;>&#128231;</a>&nbsp;<a id=psms title=SMS class=share  onclick=smsit(this); style=text-decoration:none;cursor:pointer;>&#128223;</a></h1>
<h3>RJM Programming " . $minus . " September, 2024</h3>
<h4>Thanks to <a target=_blank title='Python GraphViz package information' href='//forum.graphviz.org/t/emojis-not-working/1935/2'>https://forum.graphviz.org/t/emojis-not-working/1935/2</a></h4>
<table style=width:98%;><tr><td id=ltd>
<iframe onload='checksvg(this);' id=myif style='width:95%;height:500px;' type=application/" . $fmt . " src='/doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt . "?rand=" . rand(13456,6789056) . "'></iframe>
</td><td ondblclick=\"window.open(document.getElementById('myif').src,'_blank','top=200,left=200,width=700,height=600');\" id=rtd style=background-color:#f0f0f0;width:50%;>
<form onsubmit=\"if (document.getElementById('ititle').value.replace('family-tree','').trim() == '') { alert('Please enter a different title, then click/tap Draw again.');  return false; } document.body.style.cursor=contentfix('progress'); return true;\" method=POST action=./family_tree.php>
<p>Title ...</p><br>
<input onblur=naz(this); type=text id=ititle name=title placeholder='" . $newabl[0] . "' value=''></input>&nbsp;<select id=fmt name=fmt><option value=svg>SVG</option><option value=pdf>PDF</option></select>&nbsp;<input type=color name=back id=back title='rgb(174,216,232)' value='" . $bbcol . "'></input>&nbsp;<input type=text id=fsize name=fsize placeholder='6,6' title='Font width,height' value=''></input>&nbsp;<select id=shape name=shape><option value=''>Record</option>" . $nondefshapes . "</select>&nbsp;<select id=mode name=mode><option value=Digraph>Digraph</option><option value=Graph>Graph</option></select><br><br>
<p>Family Tree Names ...</p><br>
<textarea style=display:none; ondblclick=phv(this); title='Sex One List. Double click makes suggestion the real value' placeholder='' data-contenteditable=true id=none name=one value=''>" . str_replace("\t","+",urldecode($newabl[1])) . "</textarea>
<textarea style=display:none; ondblclick=phv(this); title='Sex Two List. Double click makes suggestion the real value' placeholder='' data-contenteditable=true id=ntwo name=two value=''>" . str_replace("\t","+",urldecode($newabl[2])) . "</textarea>
<textarea style=display:none; ondblclick=phv(this); title='Children List. Double click makes suggestion the real value' placeholder='' data-contenteditable=true id=nthree name=three value=''>" . str_replace("\t","+",urldecode($newabl[3])) . "</textarea>
<textarea ondblclick=phv(this); title='Sex One List. Double click makes suggestion the real value' placeholder='' data-name=one id=one data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[1])) . "</textarea><br>
<textarea ondblclick=phv(this); title='Sex Two List. Double click makes suggestion the real value' placeholder='' data-name=two id=two data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[2])) . "</textarea><br>
<textarea ondblclick=phv(this); title='Children List. Double click makes suggestion the real value' placeholder='' data-name=three id=three data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[3])) . "</textarea><br><br>
<input type=hidden id=addimg name=addimg value=\"" . $addimg . "\"></input>
<input id=mysub type=submit value=Draw style=background-color:pink;></input>
</form>
</td></tr></table>
<div id=dimap></div>
<input type=hidden id=newablzero value='" . $newablzero . "'></input>
</body>
</html>";
  } else {
     echo "<html>
<head>
<title>Trying out Python GraphViz hosted in PHP - RJM Programming - September, 2024 - Family Tree</title>
<scr" . "ipt type=text/javascript>
 var lasturl='', lasttext=null, gzero=null, lastx=0, lasty=0, lastw=0, lasth=0, lastp='', lastiurl='', szero=null, aimg='', lastimgc='', lastsvggeo=null, uselast=false;

String.prototype.toHtmlEntities = function() {
  return this.replace(/./gm, function(s) {
    return (s.match(/[a-z0-9\s]+/i)) ? s : '&#' + s.charCodeAt(0) + ';';
  });
};

 function plusdata(aig) {
   var outig=aig, dlm='\"';
   var outgs=aig.split('data:');
   if (eval('' + outgs.length) > 1) {
     outig=outgs[0];
     dlm=outig.slice(-1);
     for (var iop=1; iop<outgs.length; iop++) {
       if (outgs[iop].split(dlm)[0] != outgs[iop].split(dlm)[0].replace(/\ /g,'+').replace(/\%20/g,'+')) {
         alert('found');
       }
       outig+='data:' + outgs[iop].replace(outgs[iop].split(dlm)[0], outgs[iop].split(dlm)[0].replace(/\ /g,'+').replace(/\%20/g,'+'));
     }
   }
   return outig;
 }
 
 function ph() {
   var aplace='';

   aimg=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('addimg=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('addimg=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (aimg != '') { document.getElementById('addimg').value=plusdata(aimg);  } 

   // one
   aplace='" . $abl[0] . "';   //'5th Edition;6th Edition,PWB 1.0|6th Edition;LSX,1 BSD,Mini Unix,Wollongong,Interdata|Interdata;Unix/TS 3.0,PWB 2.0,7th Edition';
   document.getElementById('one').placeholder=aplace;
   // two
   aplace='" . $abl[1] . "';   //'7th Edition;8th Edition,32V,V7M,Ultrix-11,Xenix,UniPlus+|V7M;Ultrix-11';
   document.getElementById('two').placeholder=aplace;
   // three
   aplace='" . $abl[2] . "';   //'8th Edition;9th Edition|1 BSD;2 BSD|2 BSD;2.8 BSD|2.8 BSD;Ultrix-11,2.9 BSD|32V;3 BSD|3 BSD;4 BSD|4 BSD;4.1 BSD|4.1 BSD;4.2 BSD|4.2 BSD;4.3 BSD,Ultrix-32|PWB 1.0;PWB 1.2,USG 1.0|PWB 1.2;PWB 2.0|USG 1.0;CB Unix 1,USG 2.0|CB Unix 1;CB Unix 2|CB Unix 2;CB Unix 3|CB Unix 3;Unix/TS++,PDP-11 Sys V|USG 2.0;USG 3.0|USG 3.0;Unix/TS 3.0|PWB 2.0;Unix/TS 3.0|Unix/TS 1.0;Unix/TS 3.0|Unix/TS 3.0;TS 4.0|Unix/TS++;TS 4.0|CB Unix 3;TS 4.0|TS 4.0;System V.0|System V.0;System V.2|System V.2;System V.3';
   document.getElementById('three').placeholder=aplace;
   
   var asize=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fsize=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fsize=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (asize != '') { document.getElementById('fsize').value=asize; } else if ('" . $fsize . "' != '') {  document.getElementById('fsize').value='" . $fsize . "';   } 
   var ashape=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('shape=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('shape=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (ashape != '') { document.getElementById('shape').value=ashape; } else if ('" . $shape . "' != '') {  document.getElementById('shape').value='" . $shape . "';   } 
   var acol=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('back=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('back=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (acol != '') { if (('' + acol.length) == '6') { document.getElementById('back').value='#' + acol; } else { document.getElementById('back').value='' + acol;   }    }
   var amode=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('mode=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('mode=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (amode != '') { document.getElementById('mode').value=amode;   }
   var atitle=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('title=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('title=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (atitle != '') { document.getElementById('ititle').value=atitle;   }
   var aone=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('one=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('one=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (aone != '') { document.getElementById('plus').title='Smaller';  document.getElementById('minus').style.cursor='Pointer'; document.getElementById('minus').style.textDecoration='underline';  document.getElementById('plus').title='Bigger';  document.getElementById('plus').style.cursor='Pointer'; document.getElementById('plus').style.textDecoration='underline';  document.getElementById('plus').innerHTML='+';  while (aone.indexOf(String.fromCharCode(9)) != -1) { aone=aone.replace(String.fromCharCode(9),'+');  }  document.getElementById('one').value=aone;   document.getElementById('none').value=aone;   }
   var atwo=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('two=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('two=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (atwo != '') {  while (atwo.indexOf(String.fromCharCode(9)) != -1) { atwo=atwo.replace(String.fromCharCode(9),'+');  } document.getElementById('two').value=atwo;   document.getElementById('ntwo').value=atwo;   }
   var athree=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('three=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('three=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
   if (athree != '') { while (athree.indexOf(String.fromCharCode(9)) != -1) { athree=athree.replace(String.fromCharCode(9),'+');  }  document.getElementById('three').value=athree;   document.getElementById('nthree').value=athree;   }
   var afmt=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fmt=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fmt=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : 'svg';
   if (afmt != '' && document.getElementById('one').value != '') { document.getElementById('fmt').value=afmt;   }
   if (('' + location.hash).indexOf('title=') != -1 && atitle.trim() != '' && aone.trim() != '') {
     document.getElementById('mysub').click();
   }
  }
  
  function phv(tao) {
    if (tao.value == '') {
      tao.value=tao.placeholder;
    }
  }
  
  function contentfix(inid) {
    document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
    document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
    return inid;
  }
  
  function various(indi) {
    var outdi=indi;
    outdi=outdi.replace(/\|\;/g, encodeURIComponent('|') + ';');
    outdi=outdi.replace(/\,\;/g, encodeURIComponent(',') + ';');
    outdi=outdi.replace(/\;\;/g, encodeURIComponent(';') + ';');

    outdi=outdi.replace(/\|\,/g, encodeURIComponent('|') + ',');
    outdi=outdi.replace(/\,\,/g, encodeURIComponent(',') + ',');
    outdi=outdi.replace(/\;\,/g, encodeURIComponent(';') + ',');

    outdi=outdi.replace(/\|\|/g, encodeURIComponent('|') + '|');
    outdi=outdi.replace(/\,\|/g, encodeURIComponent(',') + '|');
    outdi=outdi.replace(/\;\|/g, encodeURIComponent(';') + '|');

    return outdi;
  }

function svghost(svgheo, imgc) {
 if (9 == 8) {
 if (gzero) {
  gzero.innerHTML+=\"<image x='0' y='0' href='/camel.png'></image>\";  
 } else {
  svgheo.innerHTML+=\"<image x='0' y='0' href='/camel.png'></image>\"; 
 }
 }
}

function psvgit() {
  svgit(lastsvgeo, lastimgc);
}

function svgit(svgeo, imgc) {
  var pres='';
  lastsvgeo=svgeo;
  lastimgc=imgc;
  if (('' + svgeo.outerHTML).indexOf('<text') == 0) {
   if ((svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]).replace('%20',' ').replace('+',' ').indexOf(' ') != -1 && lasturl != '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])) {    
     lasturl='//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])
     window.open('//www.google.com/search?sca_esv=8957a51bd870705f&sxsrf=ADLYWIL9Z95Y2XILCVHy1Ep_vA8UA0HVLw:1728014294038&q=' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]) + '&udm=2&fbs=AEQNm0CrHVBV9axs7YmgJiq-TjYcvrKLYvLdNLLD2b8MCfaxte6rE3yH_shvJRqV-Iqr8JJvO9luGxMyf8tABHRE_ER5WVi_ouuYD0ZGCgonp8RpBmOUpTB-X6dVFbJc8KMdvjlHxs0_OJiYCY4-Y60oHTMiC_1a9mkGkMIYHO4XqP68ipa4P5rJaQCtA4WPne6f0aAKhdyAMTPbTsWJEdFYpNvI5RzOgw&sa=X&ved=2ahUKEwjCwabx6vOIAxWJ7DQHHQIOJBoQtKgLegQIDRAB&biw=1433&bih=739&dpr=2', '_blank', 'top=100,left=' + eval(-600 + screen.width) + ',width=600,height=600');
     window.focus(); 
     uselast=true; 
     setTimeout(psvgit, 2000);
     return '';
   }  
   lasttext=svgeo;
   if (lastiurl.indexOf(\"<image x='\" + svgeo.getAttribute('x') + \"' y='\" + svgeo.getAttribute('y')) == -1 && (imgc == 'ask' || lasturl == '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]))) {
    if (('' + svgeo.getAttribute('width')).indexOf('null') != -1) {
    lastiurl=\"<image x='\" + eval(-20 + eval('' + svgeo.getAttribute('x'))) + \"' y='\" + eval(-20 + eval('' + svgeo.getAttribute('y'))) + \"' width='45' height='45' opacity='0.6' href=''></image>\"; 
    } else {
    lastiurl=\"<image x='\" + svgeo.getAttribute('x') + \"' y='\" + svgeo.getAttribute('y') + \"' opacity='0.6' width='\" + svgeo.getAttribute('width') + \"' height='\" + svgeo.getAttribute('height') + \"' href=''></image>\"; 
    }
    window.focus(); 
    pres=null;
    try { 
    if (lastp != 'Regarding ' + svgeo.innerHTML + ' please enter an optional image URL') {
    pres=prompt('Regarding ' + svgeo.innerHTML + ' please enter an optional image URL', '');
    }
    } catch(exc) {
    console.log('error');
    }
    if (pres == null) { console.log('err'); pres=''; if (uselast) { setTimeout(psvgit, 2000);  } } else { uselast=false;  lastp='Regarding ' + svgeo.innerHTML + ' please enter an optional image URL';  }
    if (pres != '') {
      uselast=false;
      lastp='Regarding ' + svgeo.innerHTML + ' please enter an optional image URL';
      lastiurl=lastiurl.replace(\" href=''\", \" href='\" + pres + \"'\");
      if (gzero) {
       //alert(\"<image x='0' y='0' width='45' height='45' href=\" + lastiurl.split('href=')[1]);
       //gzero.innerHTML+=\"<image x='0' y='0' width='45' height='45' href=\" + lastiurl.split('href=')[1]; //.replace(/\-/g,'');  
       //if (document.getElementById('addimg').value == '') {
       //  document.getElementById('addimg').value=' gzero.innerHTML+=\"\"; ';
       //} 
       document.getElementById('addimg').value+=lastiurl;
       gzero.innerHTML+=lastiurl;
      }      
    }
   }
   if (lasturl != '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])) {
    lasturl='//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])
    setTimeout(function(){ window.open(lasturl, '_blank', 'top=100,left=' + eval(-600 + screen.width) + ',width=600,height=600'); }, 3000);
    //svgeo.innerHTML+='</text><text>+';
   }
  }
  if (1 == 2) {
   svgeo.innerHTML+='+';
   alert('' + svgeo.outerHTML);
  }
}

function emailit(inais) {
   event.stopPropagation();
   var em=null;
   window.focus(); 
   em=prompt('Please enter email address to send output ' + document.getElementById('fmt').value + ' URL link to.', '');
   if (em == null) { em=''; }
   if (em.indexOf('@') != -1) {
    document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
    document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
    //alert('2:' + document.getElementById('addimg').value);
     em+='?subject=' + document.getElementById('newablzero').value + '&body=' + encodeURIComponent( (document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19897865) + '#title=' + encodeURIComponent(document.getElementById('ititle').value) + '#back=' + encodeURIComponent(document.getElementById('back').value.replace('#','')) + '#fsize=' + encodeURIComponent(document.getElementById('fsize').value) + '#shape=' + encodeURIComponent(document.getElementById('shape').value) + '#mode=' + encodeURIComponent(document.getElementById('mode').value) + '#fmt=' + encodeURIComponent(document.getElementById('fmt').value) + '#one=' + encodeURIComponent(document.getElementById('none').value) + '#two=' + encodeURIComponent(document.getElementById('ntwo').value) + '#three=' + encodeURIComponent(document.getElementById('nthree').value) + '#addimg=' + encodeURIComponent(document.getElementById('addimg').value)).replace('#fmt=svg#one=#','#fmt=pdf#one=#')   );
     document.getElementById('dimap').innerHTML='<a style=display:none; id=theaemail target=_blank href=\"mailto:' + em + '\">Email</a>';
     document.getElementById('theaemail').click();
   } 
   return false;
}


function naz(intvo) {
  var intv=intvo.value;
  var retval='My%20%Family%20Tree';
  var jntv=intv.replace(/\ /g,'-').replace(/\_/g,'-');
  var jst=jntv.split('-');
  if (jntv.indexOf('amily') != -1) {
    retval=jst[0].substring(0,1).toUpperCase() + jst[0].substring(1).toLowerCase() + ' ';
    for (var ij=1; ij<jst.length; ij++) {
      retval+=jst[ij].substring(0,1).toUpperCase() + jst[ij].substring(1).toLowerCase() + ' ';
    }
    retval=encodeURIComponent(retval.trim());
  }
  document.getElementById('newablzero').value=retval;
  return retval;
}

function smsit(inais) {
   event.stopPropagation();
   var em=null;
   window.focus(); 
   em=prompt('Please enter SMS number to send output ' + document.getElementById('fmt').value + ' URL link to.', '');
   if (em == null) { em=''; }
   if (em.trim() != '') {
     if (em.trim() != '') {
    document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
    document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
    document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
     em+='&body=' + encodeURIComponent( (document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19897865) + '#title=' + encodeURIComponent(document.getElementById('ititle').value) + '#back=' + encodeURIComponent(document.getElementById('back').value.replace('#','')) + '#fsize=' + encodeURIComponent(document.getElementById('fsize').value) + '#shape=' + encodeURIComponent(document.getElementById('shape').value) + '#mode=' + encodeURIComponent(document.getElementById('mode').value) + '#fmt=' + encodeURIComponent(document.getElementById('fmt').value) + '#one=' + encodeURIComponent(document.getElementById('none').value) + '#two=' + encodeURIComponent(document.getElementById('ntwo').value) + '#three=' + encodeURIComponent(document.getElementById('nthree').value)).replace('#fmt=svg#one=#','#fmt=pdf#one=#')    );
     document.getElementById('dimap').innerHTML='<a style=display:none; id=theasms target=_blank href=\"sms:' + em + '\">SMS</a>';
     if (!document.getElementById('theasms') && document.getElementById('psms')) {
     document.getElementById('psms').click();
     } else {
     document.getElementById('theasms').click();
     }
     }
   }
   return false;
}


function sz(inum) {
  var uni='px';
  if (szero) {
    if (('' + szero.getAttribute('width')).indexOf('pt') != -1) { uni='pt'; } else if (('' + szero.getAttribute('width')).indexOf('%') != -1) { uni='%'; }
    szero.setAttribute('width', '' + ('' + eval(eval('' + szero.getAttribute('width').split(uni)[0])) * eval('' + inum)) + uni);
    szero.setAttribute('height', '' + ('' + eval(eval('' + szero.getAttribute('height').split(uni)[0])) * eval('' + inum)) + uni);
  }
}

function domore(hm) {
  var rectis=document.getElementById('myif').getBoundingClientRect();
  if (('' + hm) == '1') {
    document.getElementById('rtd').style.width='20%';
    document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(1.1)) + 'px';
    document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 1.1) + 'px';
  } else if (('' + hm) == '-1') {
    document.getElementById('rtd').style.width='50%';
    document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(0.9)) + 'px';
    document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 0.9) + 'px';
  } else if (('' + hm) == '-2') {
    document.getElementById('rtd').style.width='50%';
    document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(0.8)) + 'px';
    document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 0.8) + 'px';
  } else {
    document.getElementById('rtd').style.width='20%';
    document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(1.2)) + 'px';
    document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 1.2) + 'px';
  }
}

function checksvg(iois) {
  if (iois != null) {
    var aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
       //alert(2);
       if (aconto.document) {  
         aconto = aconto.document; 
         gs=aconto.getElementsByTagName('g'); 
         if (eval('' + gs.length) > 0) {
           gzero=gs[0];
           for (var sd=0; sd<gs.length; sd++) {
              gs[sd].onclick=function(event){ parent.svgit(event.target, '');  };
              gs[sd].ondblclick=function(event){ parent.svgit(event.target, 'ask');  };
           }
         }
         gs=aconto.getElementsByTagName('svg'); 
         if (eval('' + gs.length) > 0) {
           for (var sd=0; sd<gs.length; sd++) {
              gs[sd].onclick=function(event){ parent.svghost(event.target, '');  };
           }
         }
         console.log(gs.length); 
         console.log(aconto); 
       }
       //alert(22);
       if (aconto.body != null) {
         iois=iois;
         //alert('Yay!');
       }
    if (gzero) {
      gzero=gzero;
      " . (strlen($addimg) == 0 ? $addimg : ' gzero.innerHTML+="' . $addimg . '"') . "
      if (aimg != '') { eval(' gzero.innerHTML+=\"' + aimg + '\"');  }
    }  
    }  
  }
}

</scr" . "ipt>
<style>
  body { background-color: #e0f0d0; }
  textarea { 
     width: 99%;
     height: 90px;
  }

</style>
</head>
<body title='Click on a GraphViz SVG node, and if the associated name has a space, a Google image search will appear (and any Right Click initiated Copy Image Address option might suit, in terms of a later Paste) before a prompt window asking about any relevant optional image URL, else a name lookup webpage will appear after the prompt window.' onload=ph();>
<h1>Trying out Python GraphViz hosted in PHP " . $plus . " Family Tree <a id=pemail title=Email class=share  onclick=emailit(this); style=text-decoration:none;cursor:pointer;>&#128231;</a>&nbsp;<a id=psms title=SMS class=share  onclick=smsit(this); style=text-decoration:none;cursor:pointer;>&#128223;</a></h1>
<h3>RJM Programming  " . $minus . " September, 2024</h3>
<h4>Thanks to <a target=_blank title='Python GraphViz package information' href='//graphviz.readthedocs.io/en/stable/examples.html'>https://graphviz.readthedocs.io/en/stable/examples.html</a></h4>
<table style=width:98%;><tr><td id=ltd>
<iframe onload='checksvg(this);' id=myif style='width:95%;height:500px;' type=application/" . $fmt . " src='/doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt . "?rand=" . rand(13456,6789056) . "'></iframe>
</td><td ondblclick=\"window.open(document.getElementById('myif').src,'_blank','top=200,left=200,width=700,height=600');\" id=rtd style=background-color:#f0f0f0;width:50%;>
<form onsubmit=\"if (document.getElementById('ititle').value.replace('family-tree','').trim() == '') { alert('Please enter a different title, then click/tap Draw again.');  return false; } document.body.style.cursor=contentfix('progress');  return true;\" method=POST action=./family_tree.php>
<p>Title ...</p><br>
<input onblur=naz(this); type=text id=ititle name=title placeholder='" . $newabl[0] . "' value=''></input>&nbsp;<select id=fmt name=fmt><option value=svg>SVG</option><option value=pdf>PDF</option></select>&nbsp;<input type=color name=back id=back title='rgb(174,216,232)' value='" . $bbcol . "'></input>&nbsp;<input type=text id=fsize name=fsize placeholder='6,6' title='Font width,height' value=''></input>&nbsp;<select id=shape name=shape><option value=''>Record</option>" . $nondefshapes . "</select>&nbsp;<select id=mode name=mode><option value=Digraph>Digraph</option><option value=Graph>Graph</option></select><br><br>

<p>Family Tree Names ...</p><br>
<textarea style=display:none; ondblclick=phv(this); title='Sex One List. Double click makes suggestion the real value' placeholder='' data-contenteditable=true id=none name=one value=''>" . str_replace("\t","+",urldecode($newabl[1])) . "</textarea>
<textarea style=display:none; ondblclick=phv(this); title='Sex Two List. Double click makes suggestion the real value' placeholder='' data-contenteditable=true id=ntwo name=two value=''>" . str_replace("\t","+",urldecode($newabl[2])) . "</textarea>
<textarea style=display:none; ondblclick=phv(this); title='Children List. Double click makes suggestion the real value' placeholder='' data-contenteditable=true id=nthree name=three value=''>" . str_replace("\t","+",urldecode($newabl[3])) . "</textarea>
<textarea ondblclick=phv(this); title='Sex One List. Double click makes suggestion the real value' placeholder='' data-name=one id=one data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[1])) . "</textarea><br>
<textarea ondblclick=phv(this); title='Sex Two List. Double click makes suggestion the real value' placeholder='' data-name=two id=two data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[2])) . "</textarea><br>
<textarea ondblclick=phv(this); title='Children List. Double click makes suggestion the real value' placeholder='' data-name=three id=three data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[3])) . "</textarea><br><br>
<input type=hidden id=addimg name=addimg value=\"" . $addimg . "\"></input>
<input id=mysub type=submit value=Draw style=background-color:pink;></input>
</form>
</td></tr></table>
<input type=hidden id=newablzero value='" . $newablzero . "'></input>
<div id=dimap></div>
</body>
</html>";
  }

?>