Apparently, this piece of code (which I have not touched at all) is wrong somewhere. New images aren't being opened up like they should be and the page just reports an error.
What is the error you're getting? The code you posted is for viewing how other users rated an image and doesn't have anything to do with opening images in a new window.