@Not sure if anyone else ran into this issue, but it doesn't seem like anyone checked this code with a document library that contained folders. When I did, it bombed out. The fix was to completely remove the checking for a folder. This seemed to fix it right up. Not sure if someone forgot to code the RenderDocFolderLink and RenderListFolderLink functions or what exactly those are supposed to refer to but whatever they are, they don't work correctly and simply removing the entire checking for and individual processing of folders seems to work just fine.
Also, one other note, putting a link to the pdffix.js file in the Master Page seems to work just fine for sites that have Publishing feature active.