it sounds to me like you need to set your data into objects (which is kind of js's version of a table). You can then access the object's properties using dot or square bracket notation.
If you are cycling through your images (like in a slideshow) it may be worth putting your objects into an array to make it easier to refer to them numerically.
Here's the basic setup, anyway:
Code:
<script>
var dog={title:"Fido",
filename:"Fido.jpg",
item:"3706",
caption: "woof!",
avail: "available"
}
alert(dog.filename);
alert(dog["item"]);
</script>