Small Optimizations. Added minified version.

Prefer appendChild vs jQuery's append
Cache the $window selector