title: how do I get the content of a div element relative to another div element using javascript?
body: <p>Being a newbee at this forgive me for any noob questions:</p>
  
  <p>The code:</p>
  
  <pre><code>&lt;div class="views-row views-row-5 views-row-odd views-row-last"&gt;
    &lt;div&gt;
      &lt;div class="sidebar-title"&gt;title1&lt;/div&gt;
    &lt;/div&gt;  
    &lt;div&gt;
      &lt;div&gt;
        &lt;div id="sidebar-date"&gt;14 November 2012&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;  
    &lt;div&gt;
      &lt;div class="sidebar-days-left"&gt;
        &lt;script type="text/javascript"&gt;
          var marathonDateField = document.getElementById('sidebar-date').parentNode.parentNode.childNodes[1].childNodes[0].innerHTML;
      var now = new Date();
      var then = new Date(marathonDateField);
      var gap = then.getTime() - now.getTime();
      var gap = Math.floor(gap / (1000 * 60 * 60 * 24));
      document.write("" + gap + " days left");
        &lt;/script&gt;
      &lt;/div&gt;
    &lt;/div&gt;  
    &lt;div&gt;
      &lt;div class="sidebar-link"&gt;
        &lt;a href="http://my.domain.com/"&gt;Click here to read more...&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;  
    &lt;div class="sidebar-pix"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="views-row views-row-5 views-row-odd views-row-last"&gt;
    &lt;div&gt;
      &lt;div class="sidebar-title"&gt;title2&lt;/div&gt;
    &lt;/div&gt;  
    &lt;div&gt;
      &lt;div&gt;
        &lt;div id="sidebar-date"&gt;14 december 2011&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;  
    &lt;div&gt;
      &lt;div class="sidebar-days-left"&gt;
        &lt;script type="text/javascript"&gt;
          var marathonDateField = document.getElementById('sidebar-date').parentNode.parentNode.childNodes[1].childNodes[0].innerHTML;
      var now = new Date();
      var then = new Date(marathonDateField);
      var gap = then.getTime() - now.getTime();
      var gap = Math.floor(gap / (1000 * 60 * 60 * 24));
      document.write("" + gap + " days left");
        &lt;/script&gt;
      &lt;/div&gt;
    &lt;/div&gt;  
    &lt;div&gt;
      &lt;div class="sidebar-link"&gt;
        &lt;a href="http://my.domain.com/"&gt;Click here to read more...&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;  
    &lt;div class="sidebar-pix"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm trying to get the javascript buried within div block titled title2 to extract the text formatted date for div id "sidebar-date" but instead it grabs the text formatted date from the div block titled title1 within the first div structure.</p>
  
  <p>How do i get the date from the last div section instead of from the first div section?</p>