Separates out browser-dependent code from core Flocking.
Removes references to "window" wherever it's sensible.