targeting unique and first duplicate members of an array
<p>I have a 6 divs in a html doc that have the following characteristics:</p>

<pre><code>&lt;div id="m1_1"  title="Sept. 05, 2011" class="eheader"&gt;MR 1 &amp;#151;&lt;/div&gt;
&lt;div id="m1_8"  title="Sept. 05, 2011" class="eheader"&gt;MR 8 &amp;#151;&lt;/div&gt;
&lt;div id="m1_12" title="Sept. 05, 2011" class="eheader"&gt;MR 12 &amp;#151;&lt;/div&gt;
&lt;div id="m1_16" title="Sept. 12, 2011" class="eheader"&gt;MR 16 &amp;#151;&lt;/div&gt;
&lt;div id="m1_17" title="Sept. 12, 2011" class="eheader"&gt;MR 17 &amp;#151;&lt;/div&gt;
&lt;div id="m1_19" title="Sept. 15, 2011" class="eheader"&gt;MR 19 &amp;#151;&lt;/div&gt;       
</code></pre>

<p>Their id's are something like m1_1, m1_2, m1_3, m1_4, m1_5 and m1_6. The numerical digits after the underscore are generated dynamically so I can't directly target say… "m1_8". </p>

<p>They all share the same class which is unique to the group. In my css I'm setting the display property for divs of this class to "hidden" or "none".</p>

<p>They all have a title element which is set to the date they were created.</p>

<p>What I need is a function that will loop through the divs by class name and target all of the unique titles and the first member of any duplicate titles. In the above example, m1_19 would be targeted because its title (create date) is unique to the set. divs m1_1 and m1_16 would also be targeted because they are the first members of duplicates.</p>

<p>My function outline looks like this… of course there's a huge chunk of logic missing and I'm not even sure I set up the loop correctly. Can this be done or am I on the wrong track completely?</p>

<pre><code>function checkHeaders(){
    var hdrSet = document.getElementsByClassName("eheader");

    for (var i=0; i&lt;hdrSet.length; i++){
        if (hdrSet[i].title {
            hdrSet[i].style.display = "block";
        }
    }

}
</code></pre>
