setter and tester for newTrail are in globals, and it appears to be
working.
I have a variable called newTrail that tracks whether the
trailDirectionsPage has already been created.  I'm hoping that this will
tell me when I can use the trailDirections page that I generated before
to fill it (although I don't understand why it wasn't built every time
according to the old logic).
I can now go from Google Maps back to the trail directions page on
Android and the iPad.  There are lots of console.log statements and
alerts that need to be removed.  Just want to have something to come
back to in case removing something breaks the code.
Moved the var statement for trailDirectionsHTML to the top of
buildTrailDirectionsPage.
Commented all the alerts and tested more thoroughly on Android and iPad.
Both work okay.  Now to remove all alerts and console.log statements.
Everything works with all of the console.log() statements commented.
Now to remove them.
Removed all extraneous console.log() statements.  The ones for entering
and leaving are commented.
Removed a temporary assignment that had been used for testing.  This
works on four browsers: Chrome for Android, default Android, Safari for
iPad, and Chrome for iPad.  Now to use the smaller images and see
whether they look okay on iPad.