I started with Sean's version, but then found Mark's and Adam's when I was looking for a way to create a Bookmark folder. The original bits I've added are:
- The title of each tab is also pasted as the name of each bookmark (something all the others didn't seem to do).
- The Bookmark folder name is entered by the user (defaults to title of current tab).
- Handle the 'More Tabs' menu (when there are more tabs than can be displayed).
- Handle multiple tabs with the same address as the first tab (except once we cross into the 'More Tabs' section, where a tab with the same address as the first tab will cause the script to think we've reached the first tab again).
- Some new error checking.

