Sample orientation code for phonegap