Layer name=imageLayer
What are the XY coordinates of the image's left and top?
The new contents for the 'coordinates' layer overwrite the old. The bgColor set by the script will only show where there is actual content, since layers only work in NC4! To see what LOOKS like the original size layer you must rewrite the whole layer tag and all its attributes with your document.write.
See Rewrite a layer.