How do I get the cumulative height of a series of images?
<p>I'm attempting to use JS and PHP to dictate whether or not some navigation is visible or not.  First, I get the cumulative height of a series of images.  Then I compare this height to the height of their container.  If the height of the images is greater, the navigational divs should display.</p>

<p>This almost works, but for some reason, my JS variable 'divheight' isn't gathering the image heights.  Can anyone spot my issue?</p>

<p>Note that $count is the number of images, and #th_ will amount to the ID of the final image.</p>

<pre><code>&lt;script&gt;
    $('#th_&lt;?php echo $count; ?&gt;').ready(function() {
        var divheight = 0;
        //alert('Number of images: &lt;? echo $count; ?&gt;');
        &lt;?php
        $msg = '';
        for ( $i = 1; $i &lt;= $count; $i++ ) {
            ?&gt;//alert('Cumulative height of images: 'divheight); &lt;?
            //$msg .= 'divheight += parseInt( $("#th_' . $i . '").height() );';
            $msg .= 'divheight += parseInt( document.getElementById("th_' . $i . '").height );';// . "\n";
        }
        echo $msg;
        ?&gt;
        //alert( '&lt;? echo $msg; ?&gt;' ); 
        alert( divheight + ':' + $('#ThumbContainer').height() );
        if ( divheight &lt; $('#ThumbContainer').height() ) {
            $("#ProdDetailsHoverUp").hide();
            $("#ProdDetailsHoverDown").hide();
        }
    });
&lt;/script&gt;   
</code></pre>

<p>Note, I've used both JQuery and the DOM method for getting the height of the images.</p>

<p>Thanks in advance for your help.</p>
