Display "filename" in to title attribute or into caption.

Display "filename" in to title attribute or into caption.

So I'm just starting to piece together how to use jQuery and I'm in the middle of putting a web gallery together that uses FancyBox as the tool to overlay images. However I'm also using a PHP script to populate the page with thumbnail images from a folder and linking them to their corresponding larger image versions. What my goal is; is to have the jQuery script use the filename of the large image version as a caption when the image is overlaid. How would I go about adding those few lines of code?