Separate app specific functions into their own js file

Break out functions into two js files...one specific to the app and the other containing generic functions for working with the Portal API. This will make it easier to use components of this app when building other apps.