Yeah, sorry — I accidentally left out what it was for. This is Javascript, which is something entirely different from Applescript; they might as well be two different languages. Oh wait — they are :p
The AppleScript Editor can only handle AppleScript; with the ESTK you can edit lots of different programming languages, but fortunately its default setting for new documents is … Javascript! (A lucky escape for me, there!)
I prefer Javascript over AppleScript — both scripting languages have their strengths, but Javascripts single huge advantage is the same script works on both Mac OS X and Windows versions of InDesign!
AppleScript, on the other hand, only works on OS X. I've said on a few occasions the third supported option, VBScript, has no good points at all – but that's just me. Anyway, VBS only works on Windows.
(Edit:)
.. saved it to my Indesign CS5 scripts folder, restarted Indesign ..
You don't have to do that! Next time you save a script into the Scripts folder and go back to InDesign, you will see it's already there, in the Scripts panel!