mojozoom on .net page error

mojozoom on .net page error

I am using mojozoom on a .net page where I have a product image that is zoomable.
Then under that product image, there are thumbnails that change the image for the main product image location when I click on them and the new image is zoomable also.
The code is working OK, but there is a javascript error when I do this. It happens right before the first line below- the remove child. I have tried to test to see if the zoomImg is there, but haven't hit on the right syntax.
Someone has posted the code for the mojozoom plugin here,
http://javascript.pastebin.com/UNXPPyL3


Snippet
              
                document.body.removeChild(zoomImg); //error right here
                zoomImgCtr.appendChild(zoomImg);




Here is my jquery code - I have to insert it from the code behind because it has to survive other .net postbacks.

Snippet
    protected string ImageSwap()
    {
        string imageSwap = "";
        StringBuilder sw = new StringBuilder();
        sw.Append("$('img.imgthumb').click(function (e) {\n");
        sw.Append("    var t = $(this);\n");
        sw.Append("    var imgSrc = t.attr('src');\n");
        sw.Append("    var newImgSrc = imgSrc.replace('_t.jpg', '.jpg');\n");
        sw.Append("    var newZoomSrc = imgSrc.replace('_t.jpg', '_xl.jpg');\n");
        sw.Append("    $('#ProductImage').attr('src', newImgSrc);\n");
        sw.Append("     $('.mojozoom_img').attr('src',newZoomSrc);\n");
        sw.Append("    $('#ProductImage').attr('data-zoomsrc', newZoomSrc);\n");
        sw.Append("});\n");

        imageSwap = sw.ToString();
        return imageSwap;

    }

















Thanks for any help.
Judy

Snippet