although if you are changing the image onclick, you may end up with an object of objects, and you can use the name of the sub-object to retrieve the data:
Code:
<script>
var fotos={
dog:{title:"Fido",
filename:"Fido.jpg",
item:"3706",
caption: "woof!",
avail: "available"
},
cat:{title:"Whiskas",
filename:"Whiskas.jpg",
item:"9384",
caption: "meow!",
avail: "sold out"
}
}
var pic1="dog";
var pic2="cat"
alert(fotos[pic1].filename);
alert(fotos[pic2].caption);
</script>
That's the basics (or the easiest-to-maintain that I can see) - the finer points depend on how your page is set up and what you want to do