Must surely be a paths issue.
Is the page using the masterpage in a different directory that the one which works maybe?
This works for me. As the javascript is generated in the code behind it can use the tilde notation to resolve the correct path.
Check http://www.zedesigns.com/Showroom.aspx to see it in action.
protected void InsertLightbox()
{
if (!Page.ClientScript.IsClientScriptIncludeRegistered("jquery-latest.pack.js"))
Page.ClientScript.RegisterClientScriptInclude("jquery-latest.pack.js", "http://code.jquery.com/jquery-latest.pack.js");
if (!Page.ClientScript.IsClientScriptIncludeRegistered("jquery.lightbox.js"))
Page.ClientScript.RegisterClientScriptInclude("jquery.lightbox.js", System.Web.VirtualPathUtility.ToAbsolute("~/js/jquery.lightbox.js"));
if (!Page.ClientScript.IsClientScriptBlockRegistered("lightbox"))
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.AppendLine("$(document).ready(function(){");
sb.AppendFormat("$('.lightbox').lightbox( {{fileLoadingImage:'{0}',fileBottomNavCloseImage:'{1}',fitToScreen:true}} );", Page.ResolveClientUrl("~/images/lightbox/loading.gif"), Page.ResolveClientUrl("~/images/lightbox/closelabel.gif"));
sb.AppendLine("});");
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "lightbox", sb.ToString(), true);
}
Helpers.Page.AddStyleSheet(this, "~/styles/lightbox.css", "screen");
}