code refactoring:
1. use the mvc model
2. move libraries to lib folder
3. use pagechange and pagebeforechange to transfer data between pages and refresh page