The show
and hide
functions are being called before the elements that they affect.
You should either move the scripts to be after those elements (simpler), or defer their execution until the end of the page (slightly more complicated, but generally considered "more correct").