JS - Device Orientation Logic