LoopedIn code for phoneGap