Thanks for your help, i managed it a slightly different way but you put me on the right track.
<?php if (have_posts()) : $box = 0 ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php $box++ ?>
<div class="box-<?php echo $box; ?>"></div><!--.box-->
<?php endwhile; ?>
<?php else : ?>
<h1>Not Found</h1>
<?php endif; ?>