Add AMD support

Add AMD support and keep browser global if not on AMD environment.