Implemented module pattern (thanks to @Eliasvo for the idea)

also added some comments and added a method to set the status instead of toggling.
Added deleteCookie for cleaner code

also renamed some setCookie params
Some more code cleanup
Bumped jQuery to version 1.9.0
Removed unnecessary onClick listener from the pageAction
Popup switches to the correct state
Cleaned up the onUpdated listener in the background.js
Cleaned up the updateIcon method
Show current status in popup

and cleaned popup.js somewhat