title: show/hide button
body: <p>I inserted a few show/hide button on my application. 
  My problem is: when I click on any button always is opened first. 
  That's the function:</p>
  
  <pre><code>function showHide(shID) {
    if (document.getElementById(shID)) {
      if (document.getElementById(shID+'-show').style.display != 'none') {
        document.getElementById(shID+'-show').style.display = 'none';
        document.getElementById(shID).style.display = 'block';
      }
      else {
        document.getElementById(shID+'-show').style.display = 'inline';
        document.getElementById(shID).style.display = 'none';
      }
    } 
  }
  </code></pre>
  
  <p>And this is my insert function:</p>
  
  <pre><code>function insert($string)
  {
      $result = '&lt;div id="wrap"&gt;
  
              &lt;a href="#" id="example-show" class="showLink" onclick="showHide(\'example\');return false;"&gt;Vizualizare&lt;/a&gt;&lt;/p&gt;
          &lt;div id="example" class="more"&gt;
              &lt;p&gt; '. $string .'&lt;/p&gt;
              &lt;p&gt;&lt;a href="#" id="example-hide" class="hideLink" onclick="showHide(\'example\');return false;"&gt;Ascunde&lt;/a&gt;&lt;/p&gt;
          &lt;/div&gt;
                  &lt;/div&gt;';
      return $result;
  }
  </code></pre>