   function formatTitle(title, currentArray, currentIndex, currentOpts) {

       var url = currentArray[currentIndex].toString();
       var original_url = url.replace(/large/,"original");
       var title_array = new Array(); 
       title_array = title.split(' | ');
       var title = title_array[0];
       var description = title_array[1];
       var photographer = title_array[2];
       return '<div id="fancybox-title-over"><span>' + ((currentArray.length > 1) ? 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length : '' ) + '</span>'
                 + (title && title.length ? '<b>' + title + '</b>' : '' )
                 + (description && description.length ? '' + description + '<br />' : '' )
                 + (photographer && photographer.length ? '' + photographer + '' : '' )
                 
                 + ('<br /><br /><a href="' + original_url + '" target="_new">Click here for the High Resolution image</a>') 
                 + '</div>';
     }

$(document).ready(function() {
     $("a.gallery").fancybox({
       'showCloseButton'	: true,
      	'titlePosition' 		: 'over',
	      'titleFormat'		: formatTitle,
       'onComplete'	:	function() {
                    		  $("#fancybox-wrap").hover(function() {
			                       $("#fancybox-title").show();
		                      }, function() {
		                       	$("#fancybox-title").hide();
		                      });
                      }

    	});
});
