title: Hide and show div element with prototype and scriptaculous
body: <p>I'm trying to use prototype and scriptaculous to hide and display a div element but the function (below) to take advantage of the prototype setStyle property isn't working and I'm not sure what the problem is.</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
      function bodyOnload() {
              $('content1').setStyle({ display: 'none' });
              $('content2').setStyle({ display: 'none' });
      }
  &lt;/script&gt;    
  
  
  
  &lt;script type="text/javascript" language="javascript"&gt;
  
      var currentId = null;
  
      Effect.Accordion = function (contentId) {
          var slideDown = 0.5;
          var slideUp = 0.5;
  
          contentId = $(contentId);
  
          if (currentId != contentId) {
              if (currentId == null) {
                  new Effect.SlideDown(contentId, {duration: slideDown});
                  } else {
                  new Effect.SlideUp(currentId, {duration: slideUp});
                  new Effect.SlideDown(contentId, {duration: slideDown});
              }
              currentId = contentId; 
          } else {
              new Effect.SlideUp(currentId, {duration: slideUp});
              currentId = null;
          }
      };
      &lt;/script&gt;
  </code></pre>
  
  <p>The preceding function is called as such:</p>
  
  <pre><code>&lt;div id="accordion"&gt;
      &lt;div id="part1"&gt;
          &lt;div id="nav1" onclick="new Effect.Accordion('content1');"&gt;
              Post a comment 1
          &lt;/div&gt;
          &lt;div id="content1"&gt;
              &lt;form id="form" name="form" action="post.php" method="post"&gt;
              &lt;textarea name="commentbody" cols="20" rows="10"&gt;&lt;/textarea&gt;
              &lt;button type="submit"&gt;Post Comment&lt;/button&gt;
              &lt;input type="hidden" name="blogID" value="1" /&gt;
              &lt;input type="hidden" name="userID" value="3" /&gt;
              &lt;input type="hidden" name="parentID" value="7" /&gt;
              &lt;div class="spacer"&gt;&lt;/div&gt;&lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
          &lt;div id="part2"&gt;
          &lt;div id="nav2" onclick="new Effect.Accordion('content2');"&gt;
              Post a comment 2
          &lt;/div&gt;
          &lt;div id="content2"&gt;
              &lt;form id="form" name="form" action="post.php" method="post"&gt;
              &lt;textarea name="commentbody" cols="20" rows="10"&gt;&lt;/textarea&gt;
              &lt;button type="submit"&gt;Post Comment&lt;/button&gt;
              &lt;input type="hidden" name="blogID" value="1" /&gt;
              &lt;input type="hidden" name="userID" value="3" /&gt;
              &lt;input type="hidden" name="parentID" value="7" /&gt;
              &lt;div class="spacer"&gt;&lt;/div&gt;&lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here's what happens with the code.</p>
  
  <ul>
  <li>In both ie and firefox it does nothing but when you click on the link that calls the effect.accordion method the method works as expected. The problem is with the prototype function which doesn't hide the elements. Any help with be greatly appreciated. </li>
  </ul>