Fixed issue with rotating images on some mobile browsers (JS variable
name "orientation" caused a conflict). Cleaned up some more code.