Finding tables assinging ID's Shrinking to fit parent div And making bigger
<p>Hi this is a follow on question from a previous post. <a href="http://stackoverflow.com/questions/10503276/reducing-font-size-in-table-so-the-table-fits-inside-a-div">here</a></p>

<p>I have html pages generated from a database some of which may contain multiple tables, these tables may not fit there parent div so what i need to do is the following</p>

<ol>
<li>find all tables in the page</li>
<li>assign an id to the table if it doesn't exist</li>
<li>shrink the text within the table so it fits with the parent div</li>
<li>wrap the table in it's own unique div</li>
<li>add a button so on click the table is shown in a fancybox hence 4</li>
</ol>

<p>I've managed to do 1, 3 &amp; 5 manually  but number 2 is proving an issue it seems that Tid is not being assigned and therefor in the function ShrinkTable Tid is unknown so firebug says TabWidth is Nan Not a Number at this line.</p>

<pre><code> var TabWidth = parseInt($("#" + Tid).width(), 10);
</code></pre>

<p>I've create a <a href="http://jsfiddle.net/HolyG6/wG5hF/" rel="nofollow">jsfiddle</a></p>

<p>can somebody look at the fiddle &amp; tell why Tid is not being assigned to the table And how to do 4 so on clicking the button only the table appears in the Fancybox?</p>

<p>Thanx Holly</p>
