This is a bit confusing and possible prone to bugs in future changes: the shrImg variable gets a value from the querystring and then gets overridden with a numerical value later on (the index of the requested media in the collection of media for the page), only then the value won't be NaN and this check be successful.

This setup is not straightforward reading the code and it's prone to bugs if someone changes the logic that replaces the value from the querystring with a number, probably a dedicated variable hinting at it's real usage would fix both.