I have the following code:
Do away with window.onload and pageshow. Whatever you want to be executed on window load, body load or page show put them in $(document).ready(), they will be executed serially once the page has been loaded.
window.onload
pageshow
$(document).ready()