<?php
// xmllint_validation.php
// RJM Programming
// June, 2024
 $rowseq='';
 $colseq=' cols=5 ';
 $vsnone='none';
 $prefn='Please enter either HTML or XML file to validate ...';
 $pth='';
 $rn='' .rand(1,78477554);
 $results='';
 $precontents='';
 $contents='';
 $fn='';
 if (!isset($_GET['htmlfile']) && isset($_GET['content'])) {
   $_GET['htmlfile']=$_GET['content'];
 }
 if (!isset($_POST['htmlfile']) && isset($_POST['content'])) {
   $_POST['htmlfile']=$_POST['content'];
 } 
 if (isset($_GET['htmlfile'])) {
   if (substr(trim(urldecode($_GET['htmlfile'])) . ' ', 0, 1) == '<') {
   $contents=trim(str_replace('+',' ',urldecode($_GET['htmlfile'])));
   if (strpos(strtolower(explode('>', $contents)[0]), 'html') !== false) {
   $fn='/tmp/html_' . $rn . '.html';
   } else if (strpos(strtolower(explode('>', $contents)[0]), 'xml') !== false) {
   $fn='/tmp/xml_' . $rn . '.xml';
   } 
   file_put_contents($fn, $contents);
   } else {
   $fn=str_replace('+',' ',urldecode($_GET['htmlfile']));
   }
   if ($fn != '') {
   if (strpos($fn, 'localhost') !== false) {
     $rhs=explode('localhost' . explode('/', explode('localhost', $fn)[1])[0], $fn)[1];
     $fn=$_SERVER['DOCUMENT_ROOT'] . $rhs;
     $pth='/usr/bin/';
   } else if (strpos($fn, 'rjmprogramming.com.au') !== false) {
     $rhs=explode('rjmprogramming.com.au' . explode('/', explode('rjmprogramming.com.au', $fn)[1])[0], $fn)[1];
     $fn=$_SERVER['DOCUMENT_ROOT'] . $rhs;
   } else if (strpos($_SERVER['SERVER_NAME'], 'localhost') !== false) { 
     $pth='/usr/bin/';
   } 
   }
   if (file_exists($fn)) {
   if ($contents == '') {
     $contents=file_get_contents($fn);
   }
   $prefn=$fn;
   $fn=realpath($fn);
 if (strpos(strtolower($fn), '.xml') !== false) {
   $vsnone='block';
   $results=shell_exec($pth . 'xmllint --valid --noout ' . $fn . ' 2> ' . ' ' . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
   if (file_exists(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err')) {
     $results.="\n";
     $results.=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
     unlink(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
   }
 } else if (strpos(strtolower($fn), '.htm') !== false) {
   $vsnone='block';
   $results=shell_exec($pth . 'xmllint --html --valid --noout ' . $fn . ' 2> ' . ' ' . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
   if (file_exists(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err')) {
     $results.="\n";
     $results.=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
     unlink(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
   }
 }
   if (strpos($fn, '/tmp/') !== false) { unlink($fn);  }
   } else {
   $contents='';
   if (strpos($fn, '/tmp/') !== false) { unlink($fn);  }
   }
 } else if (isset($_POST['htmlfile'])) {
   if (substr(trim(urldecode($_POST['htmlfile'])) . ' ', 0, 1) == '<') {
   $contents=trim(str_replace('+',' ',urldecode($_POST['htmlfile'])));
   if (strpos(strtolower(explode('>', $contents)[0]), 'html') !== false) {
   $fn='/tmp/html_' . $rn . '.html';
   } else if (strpos(strtolower(explode('>', $contents)[0]), 'xml') !== false) {
   $fn='/tmp/xml_' . $rn . '.xml';
   } 
   file_put_contents($fn, $contents);
   } else {
   $fn=str_replace('+',' ',urldecode($_POST['htmlfile']));
   }
   if ($fn != '') {
   if (strpos($fn, 'localhost') !== false) {
     $rhs=explode('localhost' . explode('/', explode('localhost', $fn)[1])[0], $fn)[1];
     $fn=$_SERVER['DOCUMENT_ROOT'] . $rhs;
     $pth='/usr/bin/';
   } else if (strpos($fn, 'rjmprogramming.com.au') !== false) {
     $rhs=explode('rjmprogramming.com.au' . explode('/', explode('rjmprogramming.com.au', $fn)[1])[0], $fn)[1];
     $fn=$_SERVER['DOCUMENT_ROOT'] . $rhs;
   } else if (strpos($_SERVER['SERVER_NAME'], 'localhost') !== false) { 
     $pth='/usr/bin/';
   }
   }
   if (file_exists($fn)) {
   $prefn=$fn;
   if ($contents == '') {
     $contents=file_get_contents($fn);
   }
   $fn=realpath($fn);
 if (strpos(strtolower($fn), '.xml') !== false) {
   $vsnone='block';
   $results=shell_exec($pth . 'xmllint --valid --noout ' . $fn . ' 2> ' . ' ' . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
   if (file_exists(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err')) {
     $results.="\n";
     $results.=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
     unlink(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
   }
 } else if (strpos(strtolower($fn), '.htm') !== false) {
   $vsnone='block';
   $results=shell_exec($pth . 'xmllint --html --valid --noout ' . $fn . ' 2> ' . ' ' . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
   if (file_exists(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err')) {
     $results.="\n";
     $results.=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
     //file_put_contents('xxx.xxx', $results);
     unlink(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err');
   }
 }
   if (strpos($fn, '/tmp/') !== false) { unlink($fn);  }
   } else {
   $contents='';
   if (strpos($fn, '/tmp/') !== false) { unlink($fn);  }
   }
 }
 if ($contents != '') {
   $lines=explode("\n", $contents);
   $rowseq=' rows=' . sizeof($lines) . ' ';
   for ($ii=1; $ii<=sizeof($lines); $ii++) {
     $precontents.='' . $ii . "\n";
   }
 }
?>
<html>
<head>
<title>XML Lint Usage - RJM Programming - June, 2024</title>
<meta charset='UTF-8'/>
<script type='text/javascript'>
// /home/virtfs/rjmprogr/usr/local/cpanel/3rdparty/bin/xmllint --html --valid --noout 
var beforebih=''; //(iois.srcdoc.toLowerCase().indexOf('<body') == -1 ? iois.srcdoc : '' + iois.srcdoc.replace('<BODY','<body').replace('</BODY>','</body>').split('<body')[1].split('</body>')[0].split('</body>')[0].replace(iois.srcdoc.replace('<BODY','<body').replace('</BODY>','</body>').split('<body')[1].split('</body>')[0].split('>')[0] + '>',''));
var afterbih='';
var linenum=0;
var s1=null, s2=null;
var s1rect=null, s2rect=null;
var redrgb='rgba(255,0,0,0.2)';
var greenrgb='rgba(0,255,0,0.2)';
var orangergb='rgba(255,165,0,0.2)';
var thergb=orangergb;
var rowseq="<?php echo trim(str_replace('rows=','',$rowseq)); ?>";
var x1=0, x2=0, y1=0, y2=0;

// Thanks to https://stackoverflow.com/questions/7108270/scrolling-2-different-elements-in-same-time
function select_scroll_1(e) { s2.scrollTop = s1.scrollTop; }
function select_scroll_2(e) { s1.scrollTop = s2.scrollTop; }

function onl() {
const sanitizer = new Sanitizer();  // Default sanitizer;

// Get the frame and its Document object
const frame_element = document.getElementById("userFrame");
const unsanitized_frame_tree = frame_element.contentWindow.document;
console.log(unsanitized_frame_tree);
console.log(frame_element.contentWindow.document.body.innerHTML.length);

// Sanitize the document tree and update the frame.
const sanitized_frame_tree = sanitizer.sanitize(unsanitized_frame_tree);
console.log(sanitized_frame_tree);
frame_element.replaceChildren(sanitized_frame_tree);
console.log(frame_element.contentWindow.document.body.innerHTML.length);
}

function ifixit(iois) {
  if (iois != null) {
    var aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
     if (aconto.document) { aconto = aconto.document; }
     if (aconto.body != null) {
const unsanitized_string = (iois.srcdoc.toLowerCase().indexOf('<body') == -1 ? iois.srcdoc : '' + iois.srcdoc.replace('<BODY','<body').replace('</BODY>','</body>').split('<body')[1].split('</body>')[0].split('</body>')[0].replace(iois.srcdoc.replace('<BODY','<body').replace('</BODY>','</body>').split('<body')[1].split('</body>')[0].split('>')[0] + '>',''));  // Unsanitized string of HTML
beforebih=unsanitized_string.replace(/\>/g,'&gt;').replace(/\</g,'&lt;');
document.getElementById('before').innerHTML=beforebih;
const sanitizer = new Sanitizer();  // Default sanitizer;

// Sanitize the string
const sanitizedBody = sanitizer.sanitizeFor("body", unsanitized_string);

//We can verify the returned element type, and view sanitized HTML in string form:
console.log(sanitizedBody instanceof HTMLBodyElement);
// true
console.log(sanitizedBody.innerHTML)
// "abc  def"

// At some point later…

// Get the element to update. This must be a div to match our sanitizeFor() context.
// Set its content to be the children of our sanitized element.
iois.replaceChildren(sanitizedBody.children);
//console.log(aconto);
afterbih=aconto.body.innerHTML.replace(/\>/g,'&gt;').replace(/\</g,'&lt;');
document.getElementById('after').innerHTML=afterbih;
     }
    }
  }
}

function trythis() {
  var newsd=prompt('Optionally enter new iframe content to sanitize.', beforebih.replace(/\&gt\;/g,'>').replace(/\&lt\;/g,'<'));
  if (newsd) {
    if (newsd != beforebih.replace(/\&gt\;/g,'>').replace(/\&lt\;/g,'<')) {
      document.getElementById("userFrame").srcdoc=newsd;
    }
  }
}

function ronecheck() {
   if (document.getElementById('result1').innerHTML != '') {
      document.getElementById('incoming').innerHTML=document.getElementById('result1').value;
      document.getElementById('result1').innerHTML='';
      document.getElementById('result1').value='';
      document.getElementById('myhxfile').name='xx';
      //alert(document.getElementById('outputname').value + ' ... ' + document.getElementById('cto').value);
      if (document.getElementById('outputname').value.trim() != '') {
      document.getElementById('myform').action=document.getElementById('myform').action.split('#')[0] + '#' + encodeURIComponent(document.getElementById('outputname').value);
      } else {
      document.getElementById('myform').action=document.getElementById('myform').action.split('#')[0];
      }
      document.getElementById('mysub').click();
   }
}

function pcheckit(iois) {
   var paconto = (iois.contentWindow || iois.contentDocument);
   if (paconto != null) {
   if (paconto.document) { paconto = paconto.document; }
   if (paconto.body != null) {
         paconto.getElementsByTagName('h1')[0].style.opacity='0.0';
         if (1 == 1) { paconto.getElementsByTagName('h3')[0].style.opacity='0.0'; }
         //if (1 == 1) { paconto.getElementsByTagName('h4')[0].style.opacity='0.0'; }
   }
   }
}

function s1click(e) {
       var theheight=eval(eval('' + s1rect.height) / rowseq);
       var codelines=s2.value.split(String.fromCharCode(10));
       var errdetail='', ierr=0, linenum=0;
       if (e.touches) {
       if (e.touches[0].pageX) {
       x1=(eval(e.touches[0].pageX + document.body.scrollLeft * 1) * 1);
       y1=(eval(e.touches[0].pageY + eval(eval(e.touches[0].pageY % theheight) - theheight) + document.body.scrollTop * 1) * 1);
       linenum=Math.floor(eval(1 + eval(eval(e.touches[0].pageY + document.body.scrollTop - s1rect.top) / theheight)));
       } else {
       x1=(eval(e.touches[0].clientX + document.body.scrollLeft * 1) * 1);
       y1=(eval(e.touches[0].clientY + eval(eval(e.touches[0].clientY % theheight) - theheight) + document.body.scrollTop * 1) * 1);
       linenum=Math.floor(eval(1 + eval(eval(e.touches[0].clientY + document.body.scrollTop - s1rect.top) / theheight)));
       }
       } else if (e.clientX || e.clientY) {
        x1=(e.clientX + document.body.scrollLeft * 1);
        y1=(e.clientY + eval(eval(e.clientY % theheight) - theheight) + document.body.scrollTop * 1);
        linenum=Math.floor(eval(1 + eval(eval(e.clientY + document.body.scrollTop - s1rect.top) / theheight)));
       } else {
        x1=(e.pageX + document.body.scrollLeft * 1);
        y1=(e.pageY + eval(eval(e.pageY % theheight) - theheight) + document.body.scrollTop * 1);
        linenum=Math.floor(eval(1 + eval(eval(e.pageY + document.body.scrollTop - s1rect.top) / theheight)));
       } 
       //alert('' + linenum + ' ' + y1 + '/' + document.body.scrollTop + ' ... ' + s1.scrollTop + ' ... ' + s1rect.top + '/' + s1rect.y + ' +++ ' + theheight);
       var finds=document.getElementById('outgoing').value.split(':' + linenum + ':');
       thergb=greenrgb;
       s1.setAttribute('data-status', '');
       if (eval('' + finds.length) > 1) {
       for (ierr=1; ierr<finds.length; ierr++) {
         errdetail+=String.fromCharCode(10) + finds[eval(-1 + ierr)].split(':' + linenum + ':')[0].split(String.fromCharCode(10))[eval(-1 + finds[eval(-1 + ierr)].split(':' + linenum + ':')[0].split(String.fromCharCode(10)).length)] + ':' + linenum + ':' + finds[eval(0 + ierr)].split(String.fromCharCode(10))[0];
       }
       errdetail+=String.fromCharCode(10);
       thergb=redrgb;
       s1.setAttribute('data-status', ' (has errors ... ' + errdetail + ' ... over to the right)');
       }
       s1.title='' + linenum;
       s2.title='' + codelines[eval(-1 + linenum)];
       y1-=eval('' + s1rect.top);
       // linear-gradient(to right, yellow, yellow 20%, #009966 20%, #009966 80%, purple 80%, purple);  
       //alert('linear-gradient(to bottom, white, white ' + y1 + 'px, ' + thergb + ' ' + y1 + 'px, ' + thergb + ' ' + eval(y1 + eval('' + s2rect.height) / rowseq) + 'px,  white ' + eval(y1 + eval('' + s2rect.height) / rowseq) + 'px, white)');  
       s2.style.backgroundImage='linear-gradient(to bottom, white, white ' + y1 + 'px, ' + thergb + ' ' + y1 + 'px, ' + thergb + ' ' + eval(y1 + eval('' + s2rect.height) / rowseq) + 'px,  white ' + eval(y1 + eval('' + s2rect.height) / rowseq) + 'px, white)'; 
       s1.style.backgroundImage='linear-gradient(to bottom, white, white ' + y1 + 'px, ' + thergb + ' ' + y1 + 'px, ' + thergb + ' ' + eval(y1 + eval('' + s2rect.height) / rowseq) + 'px,  white ' + eval(y1 + eval('' + s2rect.height) / rowseq) + 'px, white)'; 
}

function s2click(e) {
       var theheight=eval(eval('' + s2rect.height) / rowseq);
       var codelines=s2.value.split(String.fromCharCode(10));
       var errdetail='', ierr=0, linenum=0;
       if (e.touches) {
       if (e.touches[0].pageX) {
       x2=(eval(e.touches[0].pageX + document.body.scrollLeft * 1) * 1);
       y2=(eval(e.touches[0].pageY + eval(eval(e.touches[0].pageY % theheight) - theheight) + document.body.scrollTop * 1) * 1);
       linenum=Math.floor(eval(1 + eval(eval(e.touches[0].pageY + document.body.scrollTop - s2rect.top) / theheight)));
       } else {
       x2=(eval(e.touches[0].clientX + document.body.scrollLeft * 1) * 1);
       y2=(eval(e.touches[0].clientY + eval(eval(e.touches[0].clientY % theheight) - theheight) + document.body.scrollTop * 1) * 1);
       linenum=Math.floor(eval(1 + eval(eval(e.touches[0].clientY + document.body.scrollTop - s2rect.top) / theheight)));
       }
       } else if (e.clientX || e.clientY) {
        x2=(e.clientX + document.body.scrollLeft * 1);
        y2=(e.clientY + eval(eval(e.clientY % theheight) - theheight) + document.body.scrollTop * 1);
        linenum=Math.floor(eval(1 + eval(eval(e.clientY + document.body.scrollTop - s2rect.top) / theheight)));
       } else {
        x2=(e.pageX + document.body.scrollLeft * 1);
        y2=(e.pageY + eval(eval(e.pageY % theheight) - theheight) + document.body.scrollTop * 1);
        linenum=Math.floor(eval(1 + eval(eval(e.pageY + document.body.scrollTop - s2rect.top) / theheight)));
       } 
       var finds=document.getElementById('outgoing').value.split(':' + linenum + ':');
       thergb=greenrgb;
       s1.setAttribute('data-status', '');
       if (eval('' + finds.length) > 1) {
       for (ierr=1; ierr<finds.length; ierr++) {
         errdetail+=String.fromCharCode(10) + finds[eval(-1 + ierr)].split(':' + linenum + ':')[0].split(String.fromCharCode(10))[eval(-1 + finds[eval(-1 + ierr)].split(':' + linenum + ':')[0].split(String.fromCharCode(10)).length)] + ':' + linenum + ':' + finds[eval(0 + ierr)].split(String.fromCharCode(10))[0];
       }
       errdetail+=String.fromCharCode(10);
       thergb=redrgb;
       s1.setAttribute('data-status', ' (has errors ... ' + errdetail + ' ... over to the right)');
       }
       s1.title='' + linenum;
       s2.title='' + codelines[eval(-1 + linenum)];
       y2-=eval('' + s2rect.top);
       s2.style.backgroundImage='linear-gradient(to bottom, white, white ' + y2 + 'px, ' + thergb + ' ' + y2 + 'px, ' + thergb + ' ' + eval(y2 + eval('' + s1rect.height) / rowseq) + 'px,  white ' + eval(y1 + eval('' + s1rect.height) / rowseq) + 'px, white)'; 
       s1.style.backgroundImage='linear-gradient(to bottom, white, white ' + y2 + 'px, ' + thergb + ' ' + y2 + 'px, ' + thergb + ' ' + eval(y2 + eval('' + s1rect.height) / rowseq) + 'px,  white ' + eval(y1 + eval('' + s1rect.height) / rowseq) + 'px, white)'; 
}

function gcbr() { 
  if (rowseq != '') {
   s1rect=s1.getBoundingClientRect();
   s1.onclick=function(event) { s1click(event);  };
   s1.ondblclick=function(event) { alert('Line ' + s1.title + s1.getAttribute('data-status') + ':' + String.fromCharCode(10) + s2.title);  };
   s2rect=s2.getBoundingClientRect();
   s2.onclick=function(event) { s2click(event);  };
   s2.ondblclick=function(event) { alert('Line ' + s1.title + s1.getAttribute('data-status') + ':' + String.fromCharCode(10) + s2.title);  };
  } 
  
  if (('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').trim() != '') {
   if (document.getElementById('myhxfile').value == '') {
     document.getElementById('myhxfile').placeholder=decodeURIComponent(('' + location.hash).replace(/^\#/g,''));
     var tf=document.getElementById('outgoing').value;
     var tfis=tf.split(':')[0];
     if (tfis.trim() != '') {
       while (tf.indexOf(tfis + ':') != -1) {
         tf=tf.replace(tfis + ':', decodeURIComponent(('' + location.hash).replace(/^\#/g,'')) + ':');
       }
       document.getElementById('outgoing').value=tf;
     }
   }
  }
}

setInterval(ronecheck, 3000);
</script>
</head>
<body style=background-color:rgb(250,250,250); onload="s1 = document.getElementById('preincoming'); s2 = document.getElementById('incoming'); s1.addEventListener('scroll', select_scroll_1, false); s2.addEventListener('scroll', select_scroll_2, false); gcbr(); " data-onload='onl();'>
<h1>XML Lint Validation</h1>
<h3>RJM Programming - June, 2024</h3>
<form onsubmit=" if (document.getElementById('myhxfile').value == '') { document.getElementById('myhxfile').name='xx';  }  return true;" action=./xmllint_validation.php id=myform method=POST target=_self>
<table style=width:95%;background-color:rgba(200,200,200,0.5); border=5>
<tr><th colspan=2 style=display:table-cell;overflow-y:hidden;text-align:center;><span style=vertical-align:top;margin-top:10px;display:inline-block;>XML Lint validation of</span>&nbsp;<input style=width:50%;vertical-align:top;margin-top:10px; onblur="if (this.value.length > 0) { document.getElementById('mysub').click();  }" name=htmlfile id=myhxfile placeholder="<?php echo str_replace('>','&gt;',str_replace('<','&lt;',$prefn)); ?>" value=""></input>&nbsp;<span id=scbi style=background-color:yellow;><iframe onload=pcheckit(this); scrolling=no frameborder=0 id=cbi data-type=file data-accept="text/html" style="border-left:2px solid yellow;background-color:yellow;z-index:1;display:inline-block;width:173px;height:228px;margin-top:-194px;" src="/HTMLCSS/client_browsing.htm?d=6910751964842271&straighttext=y"></iframe></span></th></tr>
<tr><th title='Click below makes codeline red when has errors, else green.  Double click shows the full codeline as relevant.'>Data to validate</th><th>XML Lint results</th></tr>
<tr><td style=vertical-align:top;><textarea<?php echo $rowseq; ?><?php echo $colseq; ?> data-status='' style=font-size:8px;display:inline-block;overflow-x:clip;text-wrap:nowrap;text-align:right; id=preincoming><?php echo str_replace('>','&gt;',str_replace('<','&lt;',$precontents)); ?></textarea><textarea<?php echo $rowseq; ?> onblur="if (this.value.length > 0 && '<?echo $fn; ?>' == '') { document.getElementById('mysub').click();  }" style=width:80%;font-size:8px;display:inline-block;overflow-x:clip;text-wrap:nowrap; name=content id=incoming><?php echo str_replace('>','&gt;',str_replace('<','&lt;',$contents)); ?></textarea></td><td style=vertical-align:top;><textarea<?php echo $rowseq; ?> style=width:100%; id=outgoing><?php echo str_replace('>','&gt;',str_replace('<','&lt;',$results)); ?></textarea></td></tr>
<tr><td></td><td><input type=submit id=mysub style=background-color:lightgreen;display:<?php echo $vsnone; ?> value=Validate></input></td></tr>
</table>
</form>
<div id=txtresultout></div>
<div id=resultout></div>
<div id=result></div>
<textarea style=display:none; id=result1></textarea>
<textarea style=display:none; id=result2></textarea>
<!--div id=resultav></div-->
<textarea style=display:none; id=thewords></textarea>
<input id=outputname type=hidden value=''></input>
<input id=cto type=hidden value=''></input>
<div id=dstyle></div>
</body>
</html>
