JS code for switching panels (with # nav)