Add onloadfired and visiblefired flags to mark if these events have fired.

These two event handlers set a flag if either onload or visibility have fired.
We can use this, for example, to determine if the user leaves a page before
onload fires, ie, they got tired of waiting for it to load.
Subscribe to xhr_load event and handle it differently from page load

For xhr load, the page identifier is specified in event.name, so use that,
and fire a beacon even if a load beacon has already been fired.
add unloaded flag to make sure we do not fire unload more than once
Add unloadstate to debug message.
blank line for readability
Add cookie start time to beacon if we aren't using it to help with server-side debugging.
Call done() on unload as well just in case the user left the page before
the onload event fired.

We will only send a beacon if unload fired before onload, and will include
a rt.abrt flag on the beacon.
do not block unload beacon if page has not finished loading
measure navtiming on load or unload, whichever happens first
Add an onBeacon event

The onBeacon event fires concurrently with the beacon being sent
(though practically, since JavaScript in browsers is single-threaded),
it is sent as soon as control returns from the sendBeacon() method.
Event names are case-insensitive

Convert event name to lower case before subscribing.  Event
names should be case insensitive, and doing this ensures that
we match without considering case.

We don't use toLocaleLowerCase because all our event names are
ASCII safe.
Comments and jslinting
Add custom events for browsers that support it

On browsers that support CustomEvents (with a shim for IE9 & 10),
we will now fire a custom event for the following situations:

- onBoomerangLoaded: fired when boomerang has loaded.
  event.detail contains a reference to the BOOMR object under the "BOOMR" key

- onBeforeBoomerangBeacon: fired before boomerang beacons, you can use this event
  to manipulate what gets sent on the beacon by using BOOMR.addVar or BOOMR.removeVar
  event.detail contains an object map of all the variables that will go onto the beacon

- onBoomerangBeacon: fired concurrently with boomerang sending off the beacon.
  event.detail contains an object map of all the variables that went onto the beacon
  You can use this event to clear the beacon of any variables that should not be
  persisted across multiple beacons on a page
Add custom event to README
merge lines
print test output to document instead of console so we can test easily on mobile devices
IE11 defines a CustomEvent object that is different from all the other browsers' CustomEvent object
Fix a few jslint complaints
Run try/catch block only once

Rather than run through the try/catch block every time we need to
dispatch an event, we run through it once at initialization, and
decide at that time what we need to do on subsequent calls.  This
should be faster.
wrong variable name