title: best way to find end of body tag in html
body: <p>I'm writing a program to add some code to html files</p>
  
  <p>I was going to use a series of indexof and loops to find what is essentially ""X
  (where X is the spot im looking for)</p>
  
  <p>It occurred to me that there might be a more eloquent way of doing this</p>
  
  <p>does anyone have any suggestions.</p>
  
  <p>what it looks like currently</p>
  
  <pre><code>&lt;body onLoad="JavaScript:top.document.title='Abraham L Barbrow'; if (self == parent) document.getElementById('divFrameset').style.display='block';"&gt;
  </code></pre>
  
  <p>what it should look like when im done</p>
  
  <hr>
  
  <pre><code>&lt;body onLoad="JavaScript:top.document.title='Abraham L Barbrow'; if (self == parent) document.getElementById('divFrameset').style.display='block';"&gt;
  &lt;script type="text/javascript"&gt;
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  try {
  var pageTracker = _gat._getTracker("UA-9xxxxxx-1");
  pageTracker._trackPageview();
  } catch(err) {}&lt;/script&gt;
  </code></pre>