How to get next_posts_link working with a customised page

By changing the loop to use $wp_query instead of $query it worked. My challenge for another day is to delve into the differences between $wp_query and $query!

error code: 523