/*
Initialize the router.
The router will immediately initiate a transition to, in order of priority:
1) The init state passed as an argument
2) The state captured by the current URL
function init(initState, initParams) {
    if (options.enableLogs || Router.log)
      Router.enableLogs()

    if (options.interceptAnchors)
      interceptAnchors(router)

    hashSlashString = '#' + options.hashPrefix + '/'

    logger.log('Router init')

    initStates()
    logStateTree()

    initState = (initState !== undefined) ? initState : urlPathQuery()

    logger.log('Initializing to state {0}', initState || '""')
    transitionTo(initState, initParams)

    listenToURLChanges()

    initialized = true
    return router
  }