title: dynamically display divs with same class on the left and the next on the right and so on?
body: <p>I am trying to find a way to display divs with the same class on the left and right and so on....</p>
  
  <p>something similar to the facebook chat... so, the first one is on the left and the second one is on the right and the third one is on the left and the fourth one is on the right and so on....</p>
  
  <p>THE DIVS ARE GENRATED VIA PHP FROM THE MYSQL DATABASE.</p>
  
  <p>is this possible using CSS or do i need to use jquery/javascript?</p>
  
  <p>This is the code that I have so far:</p>
  
  <pre><code>&lt;div style="width:100%;" &gt;&lt;img style="float:left;" src="images/icon.png" width="80" height="80"/&gt;&lt;div style="float:left;"&gt;&lt;p class="messageme"&gt;Hello My friend.. &lt;/p&gt;
  
  
  &lt;/div&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>.messageme{
      width:auto;
      height:auto;
      padding:5px;
      font-size:16px;
      color:#999;
      background-color:#FFF;
      float:left;
      display: inline-block;
      clear:both;
      max-width:550px;
      text-align:left;
              -webkit-box-shadow: 0px 0px 11px 0px #CCC;
  -moz-box-shadow:    0px 0px 11px 0px #CCC;
  box-shadow:         0px 0px 11px 0px #CCC;
  
  float:left;
  
  margin-left:15px;
  
  }
  </code></pre>
  
  <p>any advise would be appreciated.</p>
  
  <p>Thanks</p>
  
  <p>okay, now I get the amount of divs using this code:</p>
  
  <pre><code>&lt;script&gt;
  var nb = $('.messageme').length;
  alert(nb);
  &lt;/script&gt;
  </code></pre>
  
  <p>I need to know how I can get even and odd numbers.. I use the folowing code but I get no alerts at all:</p>
  
  <pre><code>&lt;script&gt;
  var nb = $('.messageme').length;
  
  function isEven(nb) {
      if (nb%2 == 0)
          alert('even');
      else
          alert('odd');
  }
  &lt;/script&gt;
  </code></pre>