Thanks Jason,
When I put in your code Dreamweaver was showing an error (attachment 1) and I got no results.
I added a closing tag after the <?php do (attachment 2) and that does split the results into blocks of 5.
But it is not adding the beginning div and ul tags for the subsequent sets of 5 and nothing except the li tags on a set less than 5.
The result:
<div>
<ul>
<li>image1</li>
<li>image2</li>
<li>image3</li>
<li>image4</li>
<li>image5</li>
</ul>
</div>
<li>image6</li>
<li>image7</li>
<li>image8</li>
<li>image9</li>
<li>image10</li>
</ul>
</div>
<li>image11</li>
<li>image12</li>
<li>image13</li>
<li>image14</li>
<li>image15</li>
</ul>
</div>
<li>image16</li>
<li>image17</li>
Can you point out where I am going wrong.
Thanks in advance.