Possible to count # of specific div class within a div id?
<p>Have the following script:</p>

<pre><code>    var CurrentPageTop = 0;
    var PageHeight = 496;
    var TotalPages = 9;
    var CurrenPage = 1;
    function Slide( control, panel ){



            if ( control.name == "SlideDown" ){

                    if ( (CurrenPage &gt;= 1) &amp;&amp; (CurrenPage &lt;= TotalPages-1) ){
                            CurrenPage++;
                            CurrentPageTop =  ( CurrentPageTop - PageHeight );
                    }
            }

            if ( control.name == "SlideUp" ){

                    if ( (CurrenPage &gt; 1) &amp;&amp; (CurrenPage &lt;= TotalPages) ){
                            CurrenPage--;
                            CurrentPageTop = (CurrentPageTop + PageHeight);
                    }
            }       

            var PanelScroller = document.getElementById(panel);
            PanelScroller.style.top = CurrentPageTop + 'px';

            var CurrenPageId = document.getElementById("CurrenPageId");
            CurrenPageId.innerHTML = "Page " + CurrenPage + " of 9";
    }
</code></pre>

<p>which accompanies a single image gallery on a page:</p>

<pre><code>      &lt;table cellpadding="0" cellspacing="0"&gt;
    &lt;tr&gt;
            &lt;td&gt;
                    &lt;div class="SlidingPanel"&gt;
                            &lt;div id="PanelScroller"&gt;
                                    &lt;div class="Page"&gt;
         &lt;a href="surf/1.jpg" rel="shadowbox[Surf]"&gt;&lt;img src="i/gal/g1.jpg"&gt;&lt;/a&gt;
          &lt;/div&gt;
</code></pre>

<p>How would I set this up to have multiple instances on one page?</p>

<p>Some galleries have 9 images, some have 6, etc.</p>

<p>Is there a way to count the number of <code>&lt;div class="Page"&gt;</code> within a <code>&lt;div id="PanelScroller"&gt;</code> ?</p>

<p>I want to avoid having to use 3 slightly different instances of this script for 3 different galleries. I just can't wrap my head around it because I'm a novice.</p>
