What about a different approach? ... so instead of using .replace() we'll use .each() to bind the click event to each thumbnail and replace the large image in the #panel container :
$("#thumbs img").each(function (i) {
$(this).click(function () {
var imgPanel = '<a href="http://bloc-nc.com/projects/images/gateway/gateway' + (i + 1) + '_zoom.png" class="zoom" tabindex="' + (i + 1) + '"><img src="http://bloc-nc.com/projects/images/gateway/gateway' + (i + 1) + '_large.png" id="largeImage" /></a>';
$("#panel").html(imgPanel);
}); // click
}); // each
Notice that we are building the variable imgPanel that actually replaces the number (i+1) of both the zoom image (in the href of the <a> tag) AND the the large image (in the src of the <img> tag)
Then, the content of the <div id="panel"> container is replaced depending on the thumbnail clicked.
On the other hand, it would be easy to use $("a.zoom").fancybox(); to bind fancybox to the link with class="zoom", however you are using fancybox v1.3.4 and that version doesn't support dynamically added elements, see this post for reference.
So we would need to initialize fancybox in a different way to support those dynamic elements (every time we replace the large image, we change the link .zoom dynamically)
This script should do the trick :
$(".gallery").delegate("#panel", "focusin", function () {
$("a.zoom").fancybox();
});
Notice that we are using .delegate() instead of .on() as in the post of reference because you are using a jQuery version lower than v1.7.x
So, altogether
$(document).ready(function () {
$("#thumbs img").each(function (i) {
$(this).click(function () {
var imgPanel = '<a href="http://bloc-nc.com/projects/images/gateway/gateway' + (i + 1) + '_zoom.png" class="zoom" tabindex="' + (i + 1) + '"><img src="http://bloc-nc.com/projects/images/gateway/gateway' + (i + 1) + '_large.png" id="largeImage" /></a>';
$("#panel").html(imgPanel);
}); // click
}); // each
// initialize fancybox for dynamically added elements
$(".gallery").delegate("#panel", "focusin", function () {
$("a.zoom").fancybox();
});
}); // ready
See JSFIDDLE