I have this script I wrote to check the current URL, and advance the page to the next URL in an array when needed.

I am trying to just have the file names in the array and set the rest of the path in a seperate variable. The script needs to determine the path, because this site will likely be moving to different URLs.

the problem: when I explicitly state the path I need it works, when I use code to determine the path It adds an "undefined" into the URL that causes a 404 error. Any adea what I have done wrong?