Cookies: Fix bugs with selectedLectures

Global selectedLectures array was being updated at the wrong time.
Also fixed a bug where the cookies were being initialized to undefined
when starting for the first time.

Fixes #166.
Merge pull request #168 from Ian-Stewart-Binks/166-cookies

Cookies: Fix bugs with selectedLectures