Modified the core widget JS to first exchange the single-use token in the URL for a session token from the WOOKIE REST API (see WOOKIE-426). Also moved these various API calls into functions rather than inline within init() for better readability.

git-svn-id: https://svn.apache.org/repos/asf/wookie/trunk@1574094 13f79535-47bb-0310-9956-ffa450edef68