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
Merge branch 'master' of http://github.com/Ian-Stewart-Binks/cscourseplanner into refactoring

Conflicts:
	js/grid/objects/course.js
	js/grid/timetable_util.js