Using jQuery, how can I limit my number of ad units based on page height?
<p>My app is built using a 2-column design, with the right 300-pixel column being used to show <strong>one</strong> Adsense ad unit.</p>

<p>Since some pages are taller, I am wondering if there's a way to have jQuery determine the height of my <code>#main_wrapper</code> and show <strong>an additional ad unit</strong> if it exceeds a certain size in pixels. Sort of like this:</p>

<pre><code>    // ad unit #1 shown here by default in all pages

&lt;script&gt;

$(document).ready(function(){

            if ($('#main_wrapper').height() &gt; 660) {

            //show add unit #2
        }

});

&lt;/script&gt;
</code></pre>

<p>My issue is with how to deal with wrapping the ad unit code with the jQuery/JS condition above. A typical ad unit is:</p>

<pre><code>&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "ca-pub-123123123123";
/* Sidebar 300 Middle */
google_ad_slot = "123123123";
google_ad_width = 300;
google_ad_height = 250;
//--&gt;
&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
</code></pre>

<p>How would I insert that inside the jQuery above?</p>
