Alternating post layout

minimal necessary correction – move the_post(); to before the if(($i%2 == 0) :

for instance:

<?php if (have_posts()) : while(have_posts()) : the_post(); $i++; if(($i % 2) == 0) :  ?>