add js by #attached - hook_page_alter in theme's template.php
I think your problem is you're trying to use a hook from a theme template.php? (Assuming because you have mytheme_page_alter as your function name for hook_page_alter). If you're not getting the JS included, it's specifically because you can't use hooks in template.php files. You need to create a new module.