Fully functional cookies to store folders status

I've just realized that the id of folders is the id in the database and has nothing to do with their actual order in the folder list… So, my code wasn't working, sorry for this.

I had only tested it on a fresh install, which means that these ids were the same as the position in the list. I corrected it and it should now be fixed (I discovered it while putting this code on my working instance…).

I had to add one id to the folders, to be able to get this particular id back in JS.