truncate a string in the middle with javascript
<p>anyone have a handy method to truncate a string in the middle? Something like:</p>

<pre><code>truncate ('abcdefghi', 8);
</code></pre>

<p>would result in</p>

<pre><code>'abc...hi'
</code></pre>

<p>UPDATE:</p>

<p>to be a bit more complete</p>

<ul>
<li>if the string is &lt;= maxLength, return the string</li>
<li>otherwise, return a version of the string that is maxLength, with a chunk taken out of the middle, and replaced with "...". </li>
<li>count the three characters of "..." in the total, so if maxLength is 8, you'll only see 5 characters from the original string</li>
</ul>
