moved js for dynamic loading pages to separate file