The line that errors:
var doc = app.documents.everyItem; //Gets list of all open documents
var doc = app.documents.everyItem(); //Gets list of all open documents
(Note function-invoking parentheses after "everyItem".)
I don't know how that ever worked in CS4 either without the parentheses. You don't need the line anyway, if this is the entire script; that variable is never used.
I now realize I was misguided in my first post. Because that variable is never used, the fact that it referred to a function rather than the result of a function wouldn't have caused an error.
Try making sure the target dropdown in the ESTK is set to "Adobe InDesign CS5" rather than "ExtendScript Toolkit CS5" and run it again from there.
Also, where were you originally running the script from? It sounds like maybe you double-clicked it in the Finder rather than double-clicking it in the Scripts palette.
absqua - thank you so much. You're absolutely right. I changed the target dropdown menu, and the script then ran correctly. Hopefully that's all I'll need to do for my other ones...