Sorry, I worked out I was looking through the code to paste why I was getting in a muddle!
I've simplified everything, so my main large image has a name of 'largeImage'
I am then using the ASP.NET Repeater control to generate my thumbnails like this:
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSourceThumbs">
<HeaderTemplate>
<h3>IMAGES</h3>
</HeaderTemplate>
<ItemTemplate>
<a href="#"><img src='<%# Eval("ImageThumb", "images/thumbs/{0}") %>' onclick="document.largeImage.src='<%# Eval("ImageURL", "images/projects/{0}") %>';" /></a>
</ItemTemplate>
</asp:Repeater>
This binds my image url to display the thumbnail, and then passes the required full image url to the onclick event. This has actually cut down on my JavaScript from before. I'm going to do a bit of testing to see if it is robust. Can you spot any problems with this method do you think? It seems okay so far.
Thanks for your reply,
Joe