you could make something like this:
<script>
$(function() {
alt=$("#thumbs a").attr("alt");
// select the thumbnails and make them trigger our overlay
$("#thumbs a").overlay({
// each trigger uses the same overlay with the id "gallery"
target: '#gallery',
// optional exposing effect
expose: '#000000'
// let the gallery plugin do its magic!
}).gallery({
// the plugin accepts its own set of configuration options
speed: 800,
template: '<strong>${title}</strong>'+alt+'<br/><span>Image ${index} of ${total}</span>'
});
});